本文整理汇总了PHP中Album::fromSimpleXMLElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Album::fromSimpleXMLElement方法的具体用法?PHP Album::fromSimpleXMLElement怎么用?PHP Album::fromSimpleXMLElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album::fromSimpleXMLElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWeeklyAlbumChart
/** Get an album chart for a group, for a given date range. If no date range is supplied, it will return the most recent album chart for this group.
*
* @param string $group The last.fm group name to fetch the charts of. (Required)
* @param integer $from The date at which the chart should start from. See {@link de.felixbruns.lastfm.Group#getWeeklyChartList Group::getWeeklyChartList} for more. (Optional)
* @param integer $to The date at which the chart should end on. See {@link de.felixbruns.lastfm.Group#getWeeklyChartList Group::getWeeklyChartList} for more. (Optional)
* @return array An array of Album objects.
*
* @static
* @access public
* @throws Error
*/
public static function getWeeklyAlbumChart($group, $from = null, $to = null)
{
$xml = CallerFactory::getDefaultCaller()->call('group.getWeeklyAlbumChart', array('group' => $group, 'from' => $from, 'to' => $to));
$albums = array();
foreach ($xml->children() as $album) {
$albums[] = Album::fromSimpleXMLElement($album);
}
return $albums;
}
示例2: getAlbums
/** A paginated list of all the albums in a user's library, with play counts and tag counts.
*
* @param string $user The user whose library you want to fetch. (Required)
* @param integer $limit Limit the amount of albums returned (maximum/default is 50). (Optional)
* @param integer $page The page number you wish to scan to. (Optional)
* @return PaginatedResult A PaginatedResult object.
*
* @static
* @access public
* @throws Error
*/
public static function getAlbums($user, $limit = null, $page = null)
{
$xml = CallerFactory::getDefaultCaller()->call('library.getAlbums', array('user' => $user, 'limit' => $limit, 'page' => $page));
$albums = array();
foreach ($xml->children() as $album) {
$albums[] = Album::fromSimpleXMLElement($album);
}
$perPage = Util::toInteger($xml['perPage']);
return new PaginatedResult(Util::toInteger($xml['totalPages']) * $perPage, (Util::toInteger($xml['page']) - 1) * $perPage, $perPage, $albums);
}
示例3: getTopAlbums
/** Get the top albums tagged by this tag, ordered by tag count.
*
* @param string $tag The tag name in question. (Required)
* @return array An array of Album objects.
*
* @static
* @access public
* @throws Error
*/
public static function getTopAlbums($tag)
{
$xml = CallerFactory::getDefaultCaller()->call('tag.getTopAlbums', array('tag' => $tag));
$albums = array();
foreach ($xml->children() as $album) {
$albums[] = Album::fromSimpleXMLElement($album);
}
return $albums;
}
示例4: search
/** Search for an album by name. Returns album matches sorted by relevance.
*
* @param string $album The album name in question. (Required)
* @param integer $limit Limit the number of albums returned at one time. Default (maximum) is 30. (Optional)
* @param integer $page Scan into the results by specifying a page number. Defaults to first page. (Optional)
* @return PaginatedResult A PaginatedResult object.
* @see PaginatedResult
*
* @static
* @access public
* @throws Error
*/
public static function search($album, $limit = null, $page = null)
{
$xml = CallerFactory::getDefaultCaller()->call('album.search', array('album' => $album, 'limit' => $limit, 'page' => $page));
$albums = array();
foreach ($xml->albummatches->children() as $album) {
$artists[] = Album::fromSimpleXMLElement($album);
}
$opensearch = $xml->children('http://a9.com/-/spec/opensearch/1.1/');
return new PaginatedResult(Util::toInteger($opensearch->totalResults), Util::toInteger($opensearch->startIndex), Util::toInteger($opensearch->itemsPerPage), $albums);
}