Class User

Description

Represents a user and provides different methods to query user information.

Located in /src/User.php (line 9)

Media
   |
   --User
Class Constant Summary
 PERIOD_3MONTHS = '3month'
 PERIOD_6MONTHS = '6month'
 PERIOD_12MONTHS = '12month'
 PERIOD_OVERALL = 'overall'
Method Summary
static User fromSimpleXMLElement ( $xml)
static array getEvents (string $user)
static array getFriends (string $user, [boolean $recentTracks = null], [integer $limit = null])
static User getInfo (Session $session)
static array getLovedTracks (string $user)
static array getNeighbours (string $user, [integer $limit = null])
static PaginatedResult getPastEvents (string $user, [integer $limit = null], [integer $page = null])
static array getPlaylists (string $user)
static array getRecentTracks (string $user, [integer $limit = null])
static PaginatedResult getRecommendedArtists ([integer $limit = null], [integer $page = null],  $session)
static PaginatedResult getRecommendedEvents ([integer $limit = null], [integer $page = null],  $session)
static array getShouts (string $user)
static array getTopAlbums (string $user, [integer $period = null])
static array getTopArtists (string $user, [integer $period = null])
static array getTopTags (string $user, [integer $limit = null])
static array getTopTracks (string $user, [integer $period = null])
static array getWeeklyAlbumChart (string $user, [string $from = null], [string $to = null])
static array getWeeklyArtistChart (string $user, [string $from = null], [string $to = null])
static array getWeeklyChartList (string $user, [ $from = null], [ $to = null])
static array getWeeklyTrackChart (string $user, [string $from = null], [string $to = null])
User __construct (string $name, string $url, string $language, string $country, integer $age, string $gender, boolean $subscriber, integer $playCount, string $playlists,  $images, Track $lastTrack, float $match, integer $weight)
integer getAge ()
string getCountry ()
string getGender ()
string getLanguage ()
float getMatch ()
integer getPlaylistCount ()
integer getWeight ()
boolean isSubscriber ()
Methods
static method fromSimpleXMLElement (line 701)

Create a User object from a SimpleXMLElement.

  • return: A User object.
  • access: public
static User fromSimpleXMLElement ( $xml)
  • SimpleXMLElement $xml: A SimpleXMLElement.
static method getEvents (line 207)

Get a list of upcoming events that this user is attending. Easily integratable into calendars, using the iCal standard.

  • return: An array of Event objects.
  • throws: Error
  • access: public
static array getEvents (string $user)
  • string $user: The user to fetch the events for. (Required)
static method getFriends (line 232)

Get a list of the user's friends on last.fm.

  • return: An array of User objects.
  • throws: Error
  • access: public
static array getFriends (string $user, [boolean $recentTracks = null], [integer $limit = null])
  • string $user: The last.fm username to fetch the friends of. (Required)
  • boolean $recentTracks: Whether or not to include information about friends' recent listening in the response. (Optional)
  • integer $limit: An integer used to limit the number of friends returned. (Optional)
static method getInfo (line 257)

Get information about a user profile.

  • return: A User object.
  • throws: Error
  • access: public
static User getInfo (Session $session)
  • Session $session: A session obtained by getSession or getMobileSession. (Required)
static method getLovedTracks (line 276)

Get the last 50 tracks loved by a user.

  • return: An array of Track objects.
  • throws: Error
  • access: public
static array getLovedTracks (string $user)
  • string $user: The user name to fetch the loved tracks for. (Required)
static method getNeighbours (line 300)

Get a list of a user's neighbours on last.fm.

  • return: An array of Track objects.
  • throws: Error
  • access: public
static array getNeighbours (string $user, [integer $limit = null])
  • string $user: The last.fm username to fetch the neighbours of. (Required)
  • integer $limit: An integer used to limit the number of neighbours returned. (Optional)
static method getPastEvents (line 327)

Get a paginated list of all events a user has attended in the past.

  • return: A PaginatedResult object.
  • see: PaginatedResult
  • throws: Error
  • access: public
static PaginatedResult getPastEvents (string $user, [integer $limit = null], [integer $page = null])
  • string $user: The username to fetch the events for. (Required)
  • integer $limit: The number of events to return per page. (Optional)
  • integer $page: The page number to scan to. (Optional)
static method getPlaylists (line 359)

Get a list of a user's playlists on last.fm.

  • return: An array of Playlist objects.
  • throws: Error
  • access: public
static array getPlaylists (string $user)
  • string $user: The last.fm username to fetch the playlists of. (Required)
static method getRecentTracks (line 383)

Get a list of the recent tracks listened to by this user. Indicates now playing track if the user is currently listening.

  • return: An array of Playlist objects.
  • throws: Error
  • access: public
static array getRecentTracks (string $user, [integer $limit = null])
  • string $user: The last.fm username to fetch the recent tracks of. (Required)
  • integer $limit: An integer used to limit the number of tracks returned. (Optional)
static method getRecommendedArtists (line 408)

Get Last.fm artist recommendations for a user.

  • return: A PaginatedResult object.
  • throws: Error
  • access: public
static PaginatedResult getRecommendedArtists ([integer $limit = null], [integer $page = null],  $session)
  • integer $limit: The number of events to return per page. (Optional)
  • integer $page: The page number to scan to. (Optional)
  • $session
static method getRecommendedEvents (line 440)

Get a paginated list of all events recommended to a user by last.fm, based on their listening profile.

  • return: A PaginatedResult object.
  • throws: Error
  • access: public
static PaginatedResult getRecommendedEvents ([integer $limit = null], [integer $page = null],  $session)
  • integer $limit: The number of events to return per page. (Optional)
  • integer $page: The page number to scan to. (Optional)
  • $session
static method getShouts (line 471)

Get shouts for this user.

  • return: An array of Shout objects.
  • throws: Error
  • access: public
static array getShouts (string $user)
  • string $user: The username to fetch shouts for. (Required)
static method getTopAlbums (line 495)

Get the top albums listened to by a user. You can stipulate a time period. Sends the overall chart by default.

  • return: An array of Album objects.
  • throws: Error
  • access: public
static array getTopAlbums (string $user, [integer $period = null])
  • string $user: The user name to fetch top albums for. (Required)
  • integer $period: The time period over which to retrieve top albums for. (Optional)
static method getTopArtists (line 520)

Get the top artists listened to by a user. You can stipulate a time period. Sends the overall chart by default.

  • return: An array of Artist objects.
  • throws: Error
  • access: public
static array getTopArtists (string $user, [integer $period = null])
  • string $user: The user name to fetch top artists for. (Required)
  • integer $period: The time period over which to retrieve top artists for. (Optional)
static method getTopTags (line 545)

Get the top tags used by this user.

  • return: An array of Tag objects.
  • throws: Error
  • access: public
static array getTopTags (string $user, [integer $limit = null])
  • string $user: The user name to fetch top tags for. (Required)
  • integer $limit: Limit the number of tags returned. (Optional)
static method getTopTracks (line 570)

Get the top tracks listened to by a user. You can stipulate a time period. Sends the overall chart by default.

  • return: An array of Track objects.
  • throws: Error
  • access: public
static array getTopTracks (string $user, [integer $period = null])
  • string $user: The user name to fetch top tracks for. (Required)
  • integer $period: The time period over which to retrieve top tracks for. (Optional)
static method getWeeklyAlbumChart (line 596)

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.

  • return: An array of Album objects.
  • throws: Error
  • access: public
static array getWeeklyAlbumChart (string $user, [string $from = null], [string $to = null])
  • string $user: The last.fm username to fetch the charts of. (Required)
  • string $from: The date at which the chart should start from. See getWeeklyChartList for more. (Optional)
  • string $to: The date at which the chart should end on. See getWeeklyChartList for more. (Optional)
static method getWeeklyArtistChart (line 623)

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.

  • return: An array of Artist objects.
  • throws: Error
  • access: public
static array getWeeklyArtistChart (string $user, [string $from = null], [string $to = null])
  • string $user: The last.fm username to fetch the charts of. (Required)
  • string $from: The date at which the chart should start from. See getWeeklyChartList for more. (Optional)
  • string $to: The date at which the chart should end on. See getWeeklyChartList for more. (Optional)
static method getWeeklyChartList (line 648)

Get a list of available charts for this user, expressed as date ranges which can be sent to the chart services.

  • return: An array of from/to unix timestamp pairs.
  • throws: Error
  • access: public
static array getWeeklyChartList (string $user, [ $from = null], [ $to = null])
  • string $user: The last.fm username to fetch the charts list for. (Required)
  • $from
  • $to
static method getWeeklyTrackChart (line 676)

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.

  • return: An array of Track objects.
  • throws: Error
  • access: public
static array getWeeklyTrackChart (string $user, [string $from = null], [string $to = null])
  • string $user: The last.fm username to fetch the charts of. (Required)
  • string $from: The date at which the chart should start from. See getWeeklyChartList for more. (Optional)
  • string $to: The date at which the chart should end on. See getWeeklyChartList for more. (Optional)
Constructor __construct (line 101)

Create an Artist object.

  • access: public
User __construct (string $name, string $url, string $language, string $country, integer $age, string $gender, boolean $subscriber, integer $playCount, string $playlists,  $images, Track $lastTrack, float $match, integer $weight)
  • string $name: Username.
  • string $url: Last.fm URL of this user.
  • string $language: Language of this user.
  • string $country: Country of this user.
  • integer $age: Age of this user.
  • string $gender: Gender of this user.
  • boolean $subscriber: Subscriber status of this user.
  • integer $playCount: Track play count of this user.
  • string $playlists: Number of playlist of this user.
  • array $images: An array of cover art images of different sizes.
  • Track $lastTrack: Last track the user played.
  • float $match: Similarity value.
  • integer $weight: Still no idea.

Redefinition of:
Media::__construct()
Create a media object.
getAge (line 140)

Returns the users age.

  • return: The users age.
  • access: public
integer getAge ()
getCountry (line 131)

Returns the users country.

  • return: The users country.
  • access: public
string getCountry ()
getGender (line 149)

Returns the users gender.

  • return: The users gender.
  • access: public
string getGender ()
getLanguage (line 122)

Returns the users language.

  • return: The users language.
  • access: public
string getLanguage ()
getLastTrack (line 176)

Returns the last played track of this user.

  • return: A Track object.
  • access: public
Track getLastTrack ()
getMatch (line 185)

Returns the similarity match of this user.

  • return: A floating-point number.
  • access: public
float getMatch ()
getPlaylistCount (line 167)

Returns the number of playlists of this user.

  • return: Number of playlists.
  • access: public
integer getPlaylistCount ()
getWeight (line 194)

Returns whatever.

  • return: I don't even know if it's an integer right now.
  • access: public
integer getWeight ()
isSubscriber (line 158)

Returns if the user is a subscriber.

  • return: The users subscription status (true or false).
  • access: public
boolean isSubscriber ()

Inherited Methods

Inherited From Media

Media::__construct()
Media::getImage()
Media::getListeners()
Media::getMbid()
Media::getName()
Media::getPlayCount()
Media::getUrl()
Class Constants
PERIOD_3MONTHS = '3month' (line 79)
PERIOD_6MONTHS = '6month' (line 80)
PERIOD_12MONTHS = '12month' (line 81)
PERIOD_OVERALL = 'overall' (line 78)

Possible time periods.

  • access: public

Inherited Constants

Inherited from Media

Media::IMAGE_EXTRALARGE
Media::IMAGE_HUGE
Media::IMAGE_LARGE
Media::IMAGE_MEDIUM
Media::IMAGE_ORIGINAL
Media::IMAGE_SMALL
Media::IMAGE_UNKNOWN

Documentation generated on Mon, 22 Dec 2008 16:57:51 +0100 by phpDocumentor 1.4.1