Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Designing Interfaces in PHP Using Interfaces Extending a Collection

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Have I got these interfaces right?

The reason I ask is initially I didn't have these interface files created.

TrackableInterface.php
<?php 

interface TrackableInterface {

}
ShareableInterface.php
<?php 

interface ShareableInterface {

}

But I'm following along from Workspaces for this project. I got the feeling that the preceding code challenge was going to ask us to create the interfaces ourselves (and then we add them to the project).

But the code challenge was an entirely different example.

I followed this video and then realised I didn't have the 2 new interfaces set up. I added the above ones myself later on and the site seems to work. Is there anything I'm missing? :)

Thanks

5 Answers

Me too.

But we can get the answer from the videos and from the files offered on the downloads section (remember to check them once in a while when feeling lost).

1.First, she told us to create a TrackableInterface to get the AUTHOR and the DATE from the post:

<?php
interface TrackableInterface
{
   public function getAuthor();
   public function getDateTime();
}

2.Second, she told us to create a ShareableInterface to share the post on social media:

<?php
interface ShareableInterface
{
   public function shareTwitter();
   public function shareEmail();
   public function shareFacebook();
}

Thanks for answers here, i would say this wasn't made very clear in the videos!

Glenré Charl Labuschagné
Glenré Charl Labuschagné
23,204 Points

Yip, you definitely have to create the 2 additional Interfaces as per Felipe Giovanni de Moura Santos.

This was the question I came to ask. The preceding challenge definitely didn't create those interfaces.