Source for file User.php
Documentation is available at User.php
/** Represents a user and provides different methods to query user information.
* @package php-lastfm-api
* @author Felix Bruns <felixbruns@web.de>
/** Indicates if the user is a subscriber.
/** The number of playlist of this user.
/** The last track the user played.
/** I have no idea. Haha. TODO.
/** Possible time periods.
/** Create an Artist object.
* @param string $name Username.
* @param string $url Last.fm URL of this user.
* @param string $language Language of this user.
* @param string $country Country of this user.
* @param integer $age Age of this user.
* @param string $gender Gender of this user.
* @param boolean $subscriber Subscriber status of this user.
* @param integer $playCount Track play count of this user.
* @param string $playlists Number of playlist of this user.
* @param array $images An array of cover art images of different sizes.
* @param Track $lastTrack Last track the user played.
* @param float $match Similarity value.
* @param integer $weight Still no idea.
public function __construct($name, $url, $language, $country, $age, $gender,
$subscriber, $playCount, $playlists,
array $images, $lastTrack, $match, $weight){
parent::__construct($name, '', $url, $images, 0, $playCount);
$this->language =
$language;
$this->country =
$country;
$this->subscriber =
$subscriber;
$this->playlists =
$playlists;
$this->lastTrack =
$lastTrack;
/** Returns the users language.
* @return string The users language.
/** Returns the users country.
* @return string The users country.
/** Returns the users age.
* @return integer The users age.
/** Returns the users gender.
* @return string The users gender.
/** Returns if the user is a subscriber.
* @return boolean The users subscription status (true or false).
return $this->subscriber;
/** Returns the number of playlists of this user.
* @return integer Number of playlists.
/** Returns the last played track of this user.
* @return Track A Track object.
/** Returns the similarity match of this user.
* @return float A floating-point number.
* @return integer I don't even know if it's an integer right now.
/** Get a list of upcoming events that this user is attending. Easily integratable into calendars, using the iCal standard.
* @param string $user The user to fetch the events for. (Required)
* @return array An array of Event objects.
foreach($xml->children() as $event){
/** Get a list of the user's friends on last.fm.
* @param string $user The last.fm username to fetch the friends of. (Required)
* @param boolean $recentTracks Whether or not to include information about friends' recent listening in the response. (Optional)
* @param integer $limit An integer used to limit the number of friends returned. (Optional)
* @return array An array of User objects.
public static function getFriends($user, $recentTracks =
null, $limit =
null){
'recenttracks' =>
$recenttracks,
foreach($xml->children() as $friend){
/** Get information about a user profile.
* @param Session $session A session obtained by {@link de.felixbruns.lastfm.Auth#getSession Auth::getSession} or {@link de.felixbruns.lastfm.Auth#getMobileSession Auth::getMobileSession}. (Required)
* @return User A User object.
public static function getInfo($session){
'recenttracks' =>
$recenttracks,
/** Get the last 50 tracks loved by a user.
* @param string $user The user name to fetch the loved tracks for. (Required)
* @return array An array of Track objects.
foreach($xml->children() as $track){
/** Get a list of a user's neighbours on last.fm.
* @param string $user The last.fm username to fetch the neighbours of. (Required)
* @param integer $limit An integer used to limit the number of neighbours returned. (Optional)
* @return array An array of Track objects.
foreach($xml->children() as $neighbour){
/** Get a paginated list of all events a user has attended in the past.
* @param string $user The username to fetch the events for. (Required)
* @param integer $limit The number of events to return per page. (Optional)
* @param integer $page The page number to scan to. (Optional)
* @return PaginatedResult A PaginatedResult object.
public static function getPastEvents($user, $limit =
null, $page =
null){
foreach($xml->children() as $event){
/** Get a list of a user's playlists on last.fm.
* @param string $user The last.fm username to fetch the playlists of. (Required)
* @return array An array of Playlist objects.
foreach($xml->children() as $playlist){
/** Get a list of the recent tracks listened to by this user. Indicates now playing track if the user is currently listening.
* @param string $user The last.fm username to fetch the recent tracks of. (Required)
* @param integer $limit An integer used to limit the number of tracks returned. (Optional)
* @return array An array of Playlist objects.
foreach($xml->children() as $track){
/** Get Last.fm artist recommendations for a user.
* @param integer $limit The number of events to return per page. (Optional)
* @param integer $page The page number to scan to. (Optional)
* @return PaginatedResult A PaginatedResult object.
foreach($xml->children() as $artist){
/** Get a paginated list of all events recommended to a user by last.fm, based on their listening profile.
* @param integer $limit The number of events to return per page. (Optional)
* @param integer $page The page number to scan to. (Optional)
* @return PaginatedResult A PaginatedResult object.
foreach($xml->children() as $event){
/** Get shouts for this user.
* @param string $user The username to fetch shouts for. (Required)
* @return array An array of Shout objects.
foreach($xml->children() as $shout){
/** Get the top albums listened to by a user. You can stipulate a time period. Sends the overall chart by default.
* @param string $user The user name to fetch top albums for. (Required)
* @param integer $period The time period over which to retrieve top albums for. (Optional)
* @return array An array of Album objects.
foreach($xml->children() as $album){
/** Get the top artists listened to by a user. You can stipulate a time period. Sends the overall chart by default.
* @param string $user The user name to fetch top artists for. (Required)
* @param integer $period The time period over which to retrieve top artists for. (Optional)
* @return array An array of Artist objects.
foreach($xml->children() as $artist){
/** Get the top tags used by this user.
* @param string $user The user name to fetch top tags for. (Required)
* @param integer $limit Limit the number of tags returned. (Optional)
* @return array An array of Tag objects.
public static function getTopTags($user, $limit =
null){
foreach($xml->children() as $tag){
/** Get the top tracks listened to by a user. You can stipulate a time period. Sends the overall chart by default.
* @param string $user The user name to fetch top tracks for. (Required)
* @param integer $period The time period over which to retrieve top tracks for. (Optional)
* @return array An array of Track objects.
foreach($xml->children() as $track){
/** Get an album chart for a user profile, for a given date range. If no date range is supplied, it will return the most recent album chart for this user.
* @param string $user The last.fm username to fetch the charts of. (Required)
* @param string $from The date at which the chart should start from. See {@link de.felixbruns.lastfm.User#getWeeklyChartList User::getWeeklyChartList} for more. (Optional)
* @param string $to The date at which the chart should end on. See {@link de.felixbruns.lastfm.User#getWeeklyChartList User::getWeeklyChartList} for more. (Optional)
* @return array An array of Album objects.
foreach($xml->children() as $album){
/** Get an artist chart for a user profile, for a given date range. If no date range is supplied, it will return the most recent artist chart for this user.
* @param string $user The last.fm username to fetch the charts of. (Required)
* @param string $from The date at which the chart should start from. See {@link de.felixbruns.lastfm.User#getWeeklyChartList User::getWeeklyChartList} for more. (Optional)
* @param string $to The date at which the chart should end on. See {@link de.felixbruns.lastfm.User#getWeeklyChartList User::getWeeklyChartList} for more. (Optional)
* @return array An array of Artist objects.
foreach($xml->children() as $artist){
/** Get a list of available charts for this user, expressed as date ranges which can be sent to the chart services.
* @param string $user The last.fm username to fetch the charts list for. (Required)
* @return array An array of from/to unix timestamp pairs.
foreach($xml->children() as $chart){
/** Get a track chart for a user profile, for a given date range. If no date range is supplied, it will return the most recent track chart for this user.
* @param string $user The last.fm username to fetch the charts of. (Required)
* @param string $from The date at which the chart should start from. See {@link de.felixbruns.lastfm.User#getWeeklyChartList User::getWeeklyChartList} for more. (Optional)
* @param string $to The date at which the chart should end on. See {@link de.felixbruns.lastfm.User#getWeeklyChartList User::getWeeklyChartList} for more. (Optional)
* @return array An array of Track objects.
foreach($xml->children() as $track){
/** Create a User object from a SimpleXMLElement.
* @param SimpleXMLElement $xml A SimpleXMLElement.
* @return User A User object.
foreach($xml->image as $image){
Documentation generated on Mon, 22 Dec 2008 16:57:51 +0100 by phpDocumentor 1.4.1