src/lastfmapi/Api/TagApi.php
public function search($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['tag'])) {
            $vars = array(
                'method' => 'tag.search',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                $opensearch = $call->results->children('http://a9.com/-/spec/opensearch/1.1/');
                if ($opensearch->totalResults > 0) {
                    $searchResults['totalResults'] = (string) $opensearch->totalResults;
                    $searchResults['startIndex'] = (string) $opensearch->startIndex;
                    $searchResults['itemsPerPage'] = (string) $opensearch->itemsPerPage;
                    $i = 0;
                    foreach ($call->results->tagmatches->tag as $tag) {
                        $searchResults['results'][$i]['name'] = (string) $tag->name;
                        $searchResults['results'][$i]['count'] = (string) $tag->count;
                        $searchResults['results'][$i]['url'] = (string) $tag->url;
                        $i++;
                    }
                    return $searchResults;
                } else {
                    throw new NoResultsException('No results');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include tag variable in the call for this method');
        }
    }
public function search($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['tag'])) {
            $vars = array(
                'method' => 'tag.search',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                $opensearch = $call->results->children('http://a9.com/-/spec/opensearch/1.1/');
                if ($opensearch->totalResults > 0) {
                    $searchResults['totalResults'] = (string) $opensearch->totalResults;
                    $searchResults['startIndex'] = (string) $opensearch->startIndex;
                    $searchResults['itemsPerPage'] = (string) $opensearch->itemsPerPage;
                    $i = 0;
                    foreach ($call->results->tagmatches->tag as $tag) {
                        $searchResults['results'][$i]['name'] = (string) $tag->name;
                        $searchResults['results'][$i]['count'] = (string) $tag->count;
                        $searchResults['results'][$i]['url'] = (string) $tag->url;
                        $i++;
                    }
                    return $searchResults;
                } else {
                    throw new NoResultsException('No results');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include tag variable in the call for this method');
        }
    }
public function search ( $ methodVars ) { // Check for required variables if ( ! empty ( $ methodVars [ 'tag' ] ) ) { $ vars = array ( 'method' => 'tag.search' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ opensearch = $ call -> results -> children ( 'http://a9.com/-/spec/opensearch/1.1/' ) ; if ( $ opensearch -> totalResults > 0 ) { $ searchResults [ 'totalResults' ] = ( string ) $ opensearch -> totalResults ; $ searchResults [ 'startIndex' ] = ( string ) $ opensearch -> startIndex ; $ searchResults [ 'itemsPerPage' ] = ( string ) $ opensearch -> itemsPerPage ; $ i = 0 ; foreach ( $ call -> results -> tagmatches -> tag as $ tag ) { $ searchResults [ 'results' ] [ $ i ] [ 'name' ] = ( string ) $ tag -> name ; $ searchResults [ 'results' ] [ $ i ] [ 'count' ] = ( string ) $ tag -> count ; $ searchResults [ 'results' ] [ $ i ] [ 'url' ] = ( string ) $ tag -> url ; $ i ++ ; } return $ searchResults ; } else { throw new NoResultsException ( 'No results' ) ; } } else { return false ; } } else { throw new InvalidArgumentException ( 'You must include tag variable in the call for this method' ) ; } }
Search for a tag by name. Returns matches sorted by relevance
@deprecated as of march 15 2016, 'tag.search' method is not available
@param array $methodVars An array with the following required values: <i>tag</i>
@return array
Search for a tag by name . Returns matches sorted by relevance