PHP Designing Interfaces in PHP Using Interfaces Extending a Collection

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 76,184 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

2 Answers

Felipe Giovanni de Moura Santos
Felipe Giovanni de Moura Santos
19,208 Points

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();
}
Glenré Charl Labuschagné
Glenré Charl Labuschagné
21,806 Points

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