A paginated list of all the tracks in a user's library, with play counts and tag counts
@param array $methodVars An array with the following required values: <i>user</i> and optional values: <i>page</i>, <i>limit</i>
@return array
189093
public function getTracks($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['user'])) {
            $vars = array(
                'method' => 'library.gettracks',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                $tracks['page'] = (string) $call->tracks['page'];
                $tracks['perPage'] = (string) $call->tracks['perPage'];
                $tracks['totalPages'] = (string) $call->tracks['totalPages'];
                $i = 0;
                foreach ($call->tracks->track as $track) {
                    $tracks['results'][$i]['name'] = (string) $track->name;
                    // THIS DOESN'T WORK AS DOCUMENTED  --- $tracks['results'][$i]['rank'] = (string) $track['rank'];
                    $tracks['results'][$i]['playcount'] = (string) $track->playcount;
                    $tracks['results'][$i]['tagcount'] = (string) $track->tagcount;
                    $tracks['results'][$i]['url'] = (string) $track->url;
                    $tracks['results'][$i]['streamable'] = (string) $track->streamable;
                    $tracks['results'][$i]['fulltrack'] = (string) $track->streamable['fulltrack'];
                    $tracks['results'][$i]['artist']['name'] = (string) $track->artist->name;
                    $tracks['results'][$i]['artist']['mbid'] = (string) $track->artist->mbid;
                    $tracks['results'][$i]['artist']['url'] = (string) $track->artist->url;
                    $tracks['results'][$i]['image']['small'] = (string) $track->image[0];
                    $tracks['results'][$i]['image']['medium'] = (string) $track->image[1];
                    $tracks['results'][$i]['image']['large'] = (string) $track->image[2];
                    $i++;
                }
                return $tracks;
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include a user variable in the call for this method');
        }
    }
1181518
public function getTopTracks($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['user'])) {
            $vars = array(
                'method' => 'user.gettoptracks',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                if (count($call->toptracks->track) > 0) {
                    $i = 0;
                    foreach ($call->toptracks->track as $track) {
                        $toptracks[$i]['name'] = (string) $track->name;
                        $toptracks[$i]['rank'] = (string) $track['rank'];
                        $toptracks[$i]['playcount'] = (string) $track->playcount;
                        $toptracks[$i]['mbid'] = (string) $track->mbid;
                        $toptracks[$i]['url'] = (string) $track->url;
                        $toptracks[$i]['streamable'] = (string) $track->streamable;
                        $toptracks[$i]['fulltrack'] = (string) $track->streamable['fulltrack'];
                        $toptracks[$i]['artist']['name'] = (string) $track->artist->name;
                        $toptracks[$i]['artist']['mbid'] = (string) $track->artist->mbid;
                        $toptracks[$i]['artist']['url'] = (string) $track->artist->url;
                        $toptracks[$i]['images']['small'] = (string) $track->image[0];
                        $toptracks[$i]['images']['medium'] = (string) $track->image[1];
                        $toptracks[$i]['images']['large'] = (string) $track->image[2];
                        $i++;
                    }

                    return $toptracks;
                } else {
                    throw new NoResultsException('This user has no top tracks');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist variable in the call for this method');
        }
    }
767603
public function dump_vars($vars)
    {
        $this->last_selector = null;
        $args = array();
        foreach (func_get_args() as $index => $func) {
            if ($func instanceof PheryResponse || $func instanceof PheryFunction) {
                $args[$index] = array($this->typecast($func, true, true));
            } elseif (is_object($func)) {
                $args[$index] = array(get_object_vars($func));
            } else {
                $args[$index] = array($func);
            }
        }

        return $this->cmd(6, $args);
    }
945597
protected function queryVars()
    {
        $resultColumns = $this->dataRecord->getDataSingleton()->getSearchFields();
        $columns = [];
        foreach ($resultColumns as $field) {
            $columns[$field->getName()] = '';
        }

        $arr = array_merge(
            $columns,
            [
                'action_doRegistryFilter' => 'Filter',
                'Sort' => '',
                'Dir' => ''
            ]
        );

        foreach ($arr as $key => $val) {
            if (isset($_GET[$key])) {
                $arr[$key] = $_GET[$key];
            }
        }

        return $arr;
    }
601841
public function removeTag($methodVars)
    {
        // Only allow full authed calls
        if ($this->getFullAuth() === true) {
            // Check for required variables
            if (!empty($methodVars['album']) && !empty($methodVars['artist']) && !empty($methodVars['tag'])) {
                // Set the variables
                $vars = array(
                    'method' => 'album.removetag',
                    'api_key' => $this->getAuth()->apiKey,
                    'sk' => $this->getAuth()->sessionKey
                );
                $vars = array_merge($vars, $methodVars);

                // Generate a call signature
                $sig = $this->apiSig($this->getAuth()->apiSecret, $vars);
                $vars['api_sig'] = $sig;

                // Do the call
                if ($call = $this->apiPostCall($vars)) {
                    return true;
                } else {
                    return false;
                }
            } else {
                throw new InvalidArgumentException('You must include album, artist and tags variables in the call for this method');
            }
        } else {
            throw new NotAuthenticatedException('Method requires full auth. Call auth.getSession using lastfmApiAuth class');
        }
    }
1222039
public function getAllTrafficSources_Usage($parameters = [], $parseResult = true)
    {
        $this->setParams([
            'metrics'    => 'ga:sessions,ga:pageviews,ga:sessionDuration,ga:exits',
            'dimensions' => 'ga:source,ga:medium',
            'sort'       => '-ga:sessions',
        ]);

        return $this->execute($parameters, $parseResult);
    }
1106512
public static function listAllDiscountPromotionsAsync(array $parameters = [])
    {
        return self::listAllDiscountPromotionsAsyncWithHttpInfo($page, $size, $sort)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
562219
public function getPagerActions(array $controls, GridField $gridField)
    {
        $actions = array();

        foreach ($controls as $key => $arguments) {
            $action = GridField_FormAction::create(
                $gridField,
                'pagination_' . $key,
                $arguments['title'],
                'paginate',
                $arguments['args']
            );

            if (isset($arguments['extra-class'])) {
                $action->addExtraClass($arguments['extra-class']);
            }

            if (isset($arguments['disable-previous']) && $arguments['disable-previous']) {
                $action = $action->performDisabledTransformation();
            } elseif (isset($arguments['disable-next']) && $arguments['disable-next']) {
                $action = $action->performDisabledTransformation();
            }

            $actions[$key] = $action;
        }

        return $actions;
    }
1239684
public function getRecentTracks($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['user'])) {
            $vars = array(
                'method' => 'user.getrecenttracks',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                if (count($call->recenttracks->track) > 0) {
                    $i = 0;
                    foreach ($call->recenttracks->track as $track) {
                        $recentTracks[$i]['name'] = (string) $track->name;
                        if (isset($track['nowplaying'])) {
                            $recentTracks[$i]['nowplaying'] = true;
                        }
                        $recentTracks[$i]['mbid'] = (string) $track->mbid;
                        $recentTracks[$i]['url'] = (string) $track->url;
                        $recentTracks[$i]['date'] = (string) $track->date['uts'];
                        $recentTracks[$i]['streamable'] = (string) $track->streamable;
                        $recentTracks[$i]['artist']['name'] = (string) $track->artist;
                        $recentTracks[$i]['artist']['mbid'] = (string) $track->artist['mbid'];
                        $recentTracks[$i]['album']['name'] = (string) $track->album;
                        $recentTracks[$i]['album']['mbid'] = (string) $track->album['mbid'];
                        $recentTracks[$i]['images']['small'] = (string) $track->image[0];
                        $recentTracks[$i]['images']['medium'] = (string) $track->image[1];
                        $recentTracks[$i]['images']['large'] = (string) $track->image[2];
                        $i++;
                    }

                    return $recentTracks;
                } else {
                    throw new NoResultsException('This user has no recent tracks');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist variable in the call for this method');
        }
    }
884974
private function getTweetsVars($tweets, $vars)
    {
        /** @var string $firstTweetId */
        $firstTweetId = $tweets[0]->getId();

        $vars['previous'] = $this->tweetRepository
            ->getPreviousTweetId($firstTweetId);
        $vars['next'] = $this->tweetRepository
            ->getNextTweetId($firstTweetId);

        // Only update the cookie if the last Tweet Id is bigger than
        //  the one in the cookie
        if ($firstTweetId > $vars['cookieId']) {
            $vars['cookie'] = $this->createCookie($firstTweetId);
            $vars['cookieId'] = $firstTweetId;
        }

        $vars['number'] = $this->tweetRepository
            ->countPendingTweets($vars['cookieId']);

        $vars['first'] = $firstTweetId;

        return $vars;
    }
1205692
private function finalResultPages(array $fields, array $resultPage)
    {
        return array_map(
            function ($resultRows) use ($fields) {
                return $this->getRows($resultRows, $fields);
            },
            $resultPage
        );
    }
199327
public function getTopTags($methodVars)
    {
        $vars = array(
            'method' => 'chart.gettoptags',
            'api_key' => $this->auth->apiKey
        );
        $vars = array_merge($vars, $methodVars);

        if ($call = $this->apiGetCall($vars)) {
            $i = 0;
            foreach ($call->tags->tag as $tags) {
                $topTags[$i]['name'] = (string) $tags->name;
                $topTags[$i]['playcount'] = (string) $tags->playcount;
                $topTags[$i]['listeners'] = (string) $tags->listeners;
                $topTags[$i]['mbid'] = (string) $tags->mbid;
                $topTags[$i]['url'] = (string) $tags->url;
                $topTags[$i]['streamable'] = (string) $tags->streamable;
                $topTags[$i]['image']['small'] = (string) $tags->image[0];
                $topTags[$i]['image']['medium'] = (string) $tags->image[1];
                $topTags[$i]['image']['large'] = (string) $tags->image[2];
                $topTags[$i]['image']['extralarge'] = (string) $tags->image[3];
                $topTags[$i]['image']['mega'] = (string) $tags->image[4];
                $i++;
            }

            return $topTags;
        } else {
            return false;
        }
    }
907249
public function getRecords($filter = '', $order = ['.id'], $page = 1, $count = null, $dataDimensions = null)
    {

        if ($dataDimensions == null) {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        $caching = false;

        if ($this->isContentQueryRecordsCaching() && ($filter != '' || $count != null)) {
            $caching = true;
        }
        if ($this->isAllContentRecordsCaching() && ($filter == null && $count == null)) {
            $caching = true;
        }

        if ($caching) {

            if (!is_array($order)) {
                $order = [$order];
            }

            $cacheKey = $this->createCacheKey('records-query',
                                              [$this->getCurrentContentTypeName(), $filter, $page, $count, join(',', $order)], $dataDimensions);

            $data = $this->getCacheProvider()->fetch($cacheKey);
            if ($data) {
                $data = json_decode($data, true);

                $recordFactory = $this->getRecordFactory();
                $records       = $recordFactory->createRecordsFromJSONRecordsArray($this->getCurrentContentTypeDefinition(),
                                                                                   $data);

                foreach ($records as $record) {
                    $record->setRepository($this);
                    $record->setLanguage($dataDimensions->getLanguage());
                    $record->setWorkspace($dataDimensions->getWorkspace());
                    $record->setViewName($dataDimensions->getViewName());
                }

                return $records;
            }

            $records = parent::getRecords($filter, $order, $page, $count, $dataDimensions);

            $data = json_encode($records);

            $this->getCacheProvider()->save($cacheKey, $data, $this->contentQueryRecordsCaching);

            return $records;
        }

        return parent::getRecords($filter, $order, $page, $count, $dataDimensions);
    }
1110483
public function getVars() {
		$dbFieldFunctions = $this->reflector->getDBFieldFunctions();

		if($this->vars != null) return $this->vars;
		
		$vars = array ();
		$counts = array ();
		$booleans = $this->getPossibleBooleans();
		$search = $this->getTopLevelContent();
		
		preg_match_all("/\\$[A-Za-z0-9._]+/", $search, $variables);		
		
		if($variables || $booleans) {
			foreach(reset($variables) as $m) {
				$label = str_replace("$","", $m);

				// If using the dot syntax, this may be a has_one, or an invocation of a DBField method.
				if(stristr($label, ".") !== false) {
					list($relation, $name) = explode('.', $label);
					$name = preg_replace('/\(.*\)/','',$name);
					// The variable is a core template accessor. Move on.
					if(in_array(strtolower($relation), $this->reflector->getTemplateAccessors())) {					
						continue;
					}
					// The method being called against the variable is a DBField function.
					// Use that information to assign a probable FieldType					
					$methodName = strtolower($name);
					if(array_key_exists($methodName, $dbFieldFunctions)) {
						$class = $dbFieldFunctions[$methodName];
						$vars[$relation] = $dbFieldFunctions[$methodName];
					}
					// The variable name is the same as a ViewableData class. Chances are
					// this is a has_one to another class, e.g. $has_one = array ('File' => 'File');
					elseif(is_subclass_of($relation, 'ViewableData')) {
						$vars[$relation] = $relation;
					}
					// This variable is using a dot syntax, and neither the variable nor the
					// method are known. It must be a user-defined has_one.
					else {
						$vars[$relation] = "has_one";
					}
				}
				else {
					if(!isset($counts[$label])) $counts[$label] = 0;
					$counts[$label]++;
	
					if(!in_array($label, $vars) && !$this->getChildByName($label)) {
						// This is a <% with %> block, and it's not using a common template accessor,
						// e.g. $Up, so we can make a guess about the datatype of this variable.
						if(!$this->isLoop() && !in_array(strtolower($label), $this->reflector->getTemplateAccessors())) {
							$vars[$label] = $this->reflector->inferDatatype($label);
						}
						// This is a loop, and the variable is not something like $First, $Last, or $Pos.
						else if($this->isLoop() && !in_array(strtolower($label), $this->reflector->getListFunctions())) {
							$vars[$label] = $this->reflector->inferDatatype($label);
						}
					}					
				}
			}
		}

		foreach($booleans as $b) {
			if(isset($counts[$b])) {
				$counts[$b]--;
				if($counts[$b] == 0) {
					$vars[$b] = 'Boolean';
				}
			}
		}

		return $this->vars = $vars;
	}
684094
public function getTopTracks($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['artist']) || !empty($methodVars['mbid'])) {
            $vars = array(
                'method' => 'artist.gettoptracks',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                if (count($call->toptracks->track) > 0) {
                    $i = 0;
                    foreach ($call->toptracks->track as $tracks) {
                        $topTracks[$i]['rank'] = (string) $tracks['rank'];
                        $topTracks[$i]['name'] = (string) $tracks->name;
                        $topTracks[$i]['playcount'] = (string) $tracks->playcount;
                        $topTracks[$i]['streamable'] = (string) $tracks->streamable;
                        $topTracks[$i]['url'] = (string) $tracks->url;
                        $topTracks[$i]['image']['small'] = (string) $tracks->image[0];
                        $topTracks[$i]['image']['medium'] = (string) $tracks->image[1];
                        $topTracks[$i]['image']['large'] = (string) $tracks->image[2];
                        $i++;
                    }

                    return $topTracks;
                } else {
                    throw new NoResultsException('Artist has no top tracks');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist varialbe in the call for this method');
        }
    }
130848
public function search($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['album'])) {
            $vars = array(
                'method' => 'album.search',
                'api_key' => $this->getAuth()->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            $searchresults = array();
            if ($call = $this->apiGetCall($vars)) {
                $callNamespaces = $call->getDocNamespaces(true);
                // fix missing namespace (sic)
                if (!isset($callNamespaces['opensearch'])) {
                    $call->results->addAttribute('xmlns:xmlns:opensearch', 'http://a9.com/-/spec/opensearch/1.1/');
                    $call = new SimpleXMLElement($call->asXML());
                }
                $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->albummatches->album as $album) {
                        $searchresults['results'][$i]['name'] = (string) $album->name;
                        $searchresults['results'][$i]['artist'] = (string) $album->artist;
                        $searchresults['results'][$i]['id'] = (string) $album->id;
			$searchresults['results'][$i]['mbid'] = (string) $album->mbid;
                        $searchresults['results'][$i]['url'] = (string) $album->url;
                        $searchresults['results'][$i]['streamable'] = (string) $album->streamable;
                        $searchresults['results'][$i]['image']['small'] = (string) $album->image[0];
                        $searchresults['results'][$i]['image']['medium'] = (string) $album->image[1];
                        $searchresults['results'][$i]['image']['large'] = (string) $album->image[2];
                        $i++;
                    }

                    return $searchresults;
                } else {
                    throw new NoResultsException('No results', 90);
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include album variable in the call for this method');
        }
    }
775225
public function getVars()
    {
        $vars = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);

        $vars->env = $_ENV;
        $vars->server = $_SERVER;
        $vars->session = $_SESSION;
        $vars->cookies = $_COOKIE;
        $vars->get = $_GET;
        $vars->post = $_POST;
        $vars->files = $_FILES;

        if (function_exists('apache_request_headers')) {
            $vars->headers = apache_request_headers();
        } elseif (function_exists('getallheaders')) {
            $vars->headers = getallheaders();
        } else {
            $vars->headers = [];
            foreach ($_SERVER as $name => $value) {
                if (substr($name, 0, 5) == 'HTTP_') {
                    $vars->headers[ str_replace(' ', '-',
                        ucwords(strtolower(str_replace('_', ' ', substr($name, 5))))) ] = $value;
                }
            }
        }

        return $vars;
    }