本文整理匯總了PHP中Iterator::uasort方法的典型用法代碼示例。如果您正苦於以下問題:PHP Iterator::uasort方法的具體用法?PHP Iterator::uasort怎麽用?PHP Iterator::uasort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Iterator
的用法示例。
在下文中一共展示了Iterator::uasort方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getIterator
/**
* {@inheritdoc}
*/
public function getIterator()
{
if ($this->sortedIterator === null) {
$this->sortedIterator = new \ArrayIterator($this->enumerable()->toArray(true));
$this->sortedIterator->uasort($this->comparator());
}
return $this->sortedIterator;
}
示例2: lookup
/**
* Performs calls to the lookup method in the Spotify Web APIs
* @param string $uri
* @param array $options
* @link https://developer.spotify.com/technologies/web-api/lookup/
*/
public function lookup($uri, $options)
{
$uri_object = new SpotifyURI($uri);
if ($uri_object->is_valid) {
$q = '?uri=' . $uri;
}
if (Constants::DETAILED_INFO) {
switch ($uri_object->type) {
case 'artist':
$q .= '&extras=albumdetail';
break;
case 'album':
$q .= '&extras=trackdetail';
break;
//nothing extra to fetch
//nothing extra to fetch
case 'track':
default:
break;
}
}
$this->query_string = $q;
$data = $this->_call_spotify_api();
$it = new Iterator($data);
isset($options['filter']) ? new Filter($it) : '';
isset($options['sort']) ? $it->uasort(array($options['sort'])) : '';
return new Response(1, $data);
// parse the lookup response.
}