<commit_before><?php
namespace LastFm\Src;

use LastFm\Src\Caller\CallerFactory as CallerFactory;
use LastFm\Src\PaginatedResult as PaginatedResult;
use LastFm\Src\Event as Event;
use LastFm\Src\Util as Util;
use LastFm\Src\Artist as Artist;
use LastFm\Src\Track as Track;

/** Provides different methods to query geo based information.
 *
 * @package	LastFm API
 * @author <NAME> <<EMAIL>>
 * @version	1.0
 */
class Geo {
	/** Get all events in a specific location by country or city name.
	 *
	 * @param	string	$location	Specifies a location to retrieve events for (service returns nearby events by default). (Optional)
	 * @param	float	$lat		Specifies a latitude value to retrieve events for (service returns nearby events by default). (Optional)
	 * @param	float	$long		Specifies a longitude value to retrieve events for (service returns nearby events by default). (Optional)
	 * @param	integer	$distance	Find events within a specified distance. (Optional)
	 * @param	integer	$page		Display more results by pagination. (Optional)
	 * @return	PaginatedResult		A PaginatedResult object.
	 *
	 * @static
	 * @access	public
	 * @throws	Error
	 */
	public static function getEvents($location = null, $lat = null, $long = null,
									 $distance = null, $page = null){
		$xml = CallerFactory::getDefaultCaller()->call('geo.getEvents', array(
			'location' => $location,
			'lat'      => $lat,
			'long'     => $long,
			'distance' => $distance,
			'page'     => $page
		));

		$events = array();

		foreach($xml->children() as $event){
			$events[] = Event::fromSimpleXMLElement($event);
		}

		$perPage = intval(ceil(
			Util::toInteger($xml['total']) / Util::toInteger($xml['totalpages'])
		));

		return new PaginatedResult(
			Util::toInteger($xml['total']),
			(Util::toInteger($xml['page']) - 1) * $perPage,
			$perPage,
			$events
		);
	}

	/** Get the most popular artists on last.fm by country.
	 *
	 * @param	string	country		A country name, as defined by the ISO 3166-1 country names standard. (Required)
	 * @return	array				An array of Artist objects.
	 *
	 * @static
	 * @access	public
	 * @throws	Error
	 */
	public static function getTopArtists($country){
		$xml = CallerFactory::getDefaultCaller()->call('geo.getTopArtists', array(
			'country' => $country
		));

		$artists = array();

		foreach($xml->children() as $artist){
			$artists[] = Artist::fromSimpleXMLElement($artist);
		}

		return $artists;
	}

	/** Get the most popular tracks on last.fm by country.
	 *
	 * @param	string	country		A country name, as defined by the ISO 3166-1 country names standard. (Required)
	 * @param	string	location	A metro name, to fetch the charts for (must be within the country specified). (Optional)
	 * @return	array				An array of Track objects.
	 *
	 * @static
	 * @access	public
	 * @throws	Error
	 */
	public static function getTopTracks($country, $location = null){
		$xml = CallerFactory::getDefaultCaller()->call('geo.getTopTracks', array(
			'country'  => $country,
			'location' => $location
		));

		$tracks = array();

		foreach($xml->children() as $track){
			$tracks[] = Track::fromSimpleXMLElement($track);
		}

		return $tracks;
	}
}

<commit_msg>Updated Geo class<commit_after><?php
namespace LastFm\Src;

use LastFm\Src\Caller\CallerFactory as CallerFactory;
use LastFm\Src\PaginatedResult as PaginatedResult;
use LastFm\Src\Event as Event;
use LastFm\Src\Util as Util;
use LastFm\Src\Artist as Artist;
use LastFm\Src\Track as Track;

/** Provides different methods to query geo based information.
 *
 * @package	LastFm API
 * @author <NAME> <<EMAIL>>
 * @version	1.0
 */
class Geo {
	/** Get all events in a specific location by country or city name.
	 *
	 * @param	string	$location	Specifies a location to retrieve events for (service returns nearby events by default). (Optional)
	 * @param	float	$lat		Specifies a latitude value to retrieve events for (service returns nearby events by default). (Optional)
	 * @param	float	$long		Specifies a longitude value to retrieve events for (service returns nearby events by default). (Optional)
	 * @param	integer	$distance	Find events within a specified distance. (Optional)
	 * @param	integer	$page		Display more results by pagination. (Optional)
	 * @return	PaginatedResult		A PaginatedResult object.
	 *
	 * @static
	 * @access	public
	 * @throws	Error
	 */
	public static function getEvents($location = null, $lat = null, $long = null,
									 $distance = null, $page = null){
		$xml = CallerFactory::getDefaultCaller()->call('geo.getEvents', array(
			'location' => $location,
			'lat'      => $lat,
			'long'     => $long,
			'distance' => $distance,
			'page'     => $page
		));

		$events = array();

		foreach($xml->children() as $event){
			$events[] = Event::fromSimpleXMLElement($event);
		}

		$perPage = intval(ceil(
			Util::toInteger($xml['total']) / Util::toInteger($xml['totalpages'])
		));

		return new PaginatedResult(
			Util::toInteger($xml['total']),
			(Util::toInteger($xml['page']) - 1) * $perPage,
			$perPage,
			$events
		);
	}

	/** Get the most popular artists on last.fm by country.
	 *
	 * @param	string	country		A country name, as defined by the ISO 3166-1 country names standard. (Required)
	 * @param 	integer $page 		Specify the result page (optional)
	 * @param 	integer $limit 		Limit the number of results to be fetches (Optional)
	 * @return	array				An array of Artist objects.
	 *
	 * @static
	 * @access	public
	 * @throws	Error
	 */
	public static function getTopArtists($country, $page = 1, $limit = 36){
		$xml = CallerFactory::getDefaultCaller()->call('geo.getTopArtists', array(
			'country' => $country,
			'page' => $page,
			'limit' => $limit
		));

		$artists = array();

		foreach($xml->children() as $artist){
			$artists[] = Artist::fromSimpleXMLElement($artist);
		}

		return $artists;
	}

	/** Get the most popular tracks on last.fm by country.
	 *
	 * @param	string	country		A country name, as defined by the ISO 3166-1 country names standard. (Required)
	 * @param 	integer $page 		Specify the result page (optional)
	 * @param 	integer $limit 		Limit the number of results to be fetches (Optional)
	 * @param	string	location	A metro name, to fetch the charts for (must be within the country specified). (Optional)
	 * @return	array				An array of Track objects.
	 *
	 * @static
	 * @access	public
	 * @throws	Error
	 */
	public static function getTopTracks($country, $page = 1, $limit = 36, $location = null){
		$xml = CallerFactory::getDefaultCaller()->call('geo.getTopTracks', array(
			'country'  => $country,
			'location' => $location,
			'page' => $page,
			'limit' => $limit
		));

		$tracks = array();

		foreach($xml->children() as $track){
			$tracks[] = Track::fromSimpleXMLElement($track);
		}

		return $tracks;
	}
}
{'fraction_non_alphanumeric': 0.13297872340425532, 'fraction_numerical': 0.004728132387706856, 'mean_word_length': 3.7568517217146873, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2516677', 'n_tokens_mistral': 2364, 'n_tokens_neox': 2102, 'n_words': 692}