Created
September 12, 2012 16:02
-
-
Save davb/3707691 to your computer and use it in GitHub Desktop.
Skeleton implementation of the FeeligoUserAdapter interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
[...] | |
// require the source file containing the Feeligo_Mysite_User_Friends_Selector class | |
require_once(str_replace('//','/',dirname(__FILE__).'/').'mysite_user_friends_selector.php'); | |
[...] | |
class Feeligo_Mysite_User_Adapter implements FeeligoUserAdapter { | |
[...] | |
/** | |
* returns a FeeligoUsersSelector to select friends of this user | |
* | |
* @return FeeligoUsersSelector | |
*/ | |
public function friends_selector() { | |
return new Feeligo_Mysite_User_Friends_Selector($this); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Feeligo_Mysite_User_Adapter | |
* | |
* this class implements the Adapter pattern to adapt the interface | |
* of the local User model as expected by the Feeligo API | |
*/ | |
require_once(str_replace('//','/',dirname(__FILE__).'/').'sdk/interfaces/user_adapter.php'); | |
/** | |
* this file provides a skeleton implementation, modify to your needs. | |
*/ | |
class Feeligo_Mysite_User_Adapter implements FeeligoUserAdapter { | |
/** | |
* constructor | |
* expects an instance of your existing User model (if you have one) | |
* or a database row, as the adaptee | |
* | |
* @param mixed $adaptee | |
*/ | |
public function __construct($adaptee) { | |
$this->_adaptee = $adaptee; | |
} | |
/** | |
* returns the unique identifier of the user | |
* | |
* @return string | |
*/ | |
public function id() { | |
//TODO: implement this | |
//return $this->_adaptee->id; | |
} | |
/** | |
* the user's display name | |
* | |
* human-readable name which is shown to other users | |
* | |
* @return string | |
*/ | |
public function name() { | |
//TODO: implement this | |
//return $this->_adaptee->name; | |
} | |
/** | |
* the URL of the user's profile page (full URL, not only the path) | |
* | |
* @return string | |
*/ | |
public function link() { | |
//TODO: implement this | |
//return $this->_adaptee->link; | |
} | |
/** | |
* the URL of the user's profile picture | |
* | |
* @return string | |
*/ | |
public function picture_url() { | |
//TODO: implement this | |
//return $this->_adaptee->picture_url; | |
} | |
/** | |
* returns a FeeligoUsersSelector to select friends of this user | |
* | |
* @return FeeligoUsersSelector | |
*/ | |
public function friends_selector() { | |
//TODO: implement this | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment