<commit_before><?php
	/**
     * @author confact
     * @copyright 2013
     * @project MMDb
     * @version 1.0
	 */
	class Spotify
	{

        /**
         * Search on different type to get json of metadata of results.
         *
         * @param str $query
         * @param str $type
         * @param bool $page
         * @return array|mixed
         */
        function search($query, $type = "album", $page = FALSE)
		{
			// Fetch the data from Metadata API
			$url = 'http://ws.spotify.com/search/1/'.$type.'.json?q='.urlencode($query);
			($page != FALSE ? $url .= "&page=".$page : '');
			$data = json_decode( @file_get_contents($url));
			//check if data is not set, they make it a empty array
			(!isset($data) ? $data=array() : '');
			
			return $data;
		}

        /**
         * Get metadata based on the Spotify key.
         *
         * @param str $key
         * @param str $type
         * @return array|mixed
         */
        function lookup($key, $type = "album")
		{
			// Fetch the data from Metadata API
			$url = 'http://ws.spotify.com/lookup/1/.json?uri=spotify:'.$type.':'.$key;
			$data = json_decode( @file_get_contents($url));
			//check if data is not set, they make it a empty array
			(!isset($data) ? $data=array() : '');
			
			return $data;
		}

	}<commit_msg>fixed better format and correct php docs following Symfony2 standard<commit_after><?php
/**
 * A PHP wrapper for Spotify Metadata API
 * 
 * @author    confact <<EMAIL>>
 * @copyright 2013 confact
 * @project MMDb
 * @release <0.1>
 */
class Spotify
{

    /**
     * Search on different type to get json of metadata of results.
     *
     * @param str  $query
     * @param str  $type
     * @param bool $page
     * 
     * @return array|mixed
     */

    public function search($query, $type = "album", $page = false)
    {
        // Fetch the data from Metadata API
        $url = 'http://ws.spotify.com/search/1/' . $type . '.json?q=' . urlencode($query);
        ($page != false ? $url .= "&page=" . $page : '');
        $data = json_decode(@file_get_contents($url));
        //check if data is not set, they make it a empty array
        (!isset($data) ? $data = array() : '');

        return $data;
    }

    /**
     * Get metadata based on the Spotify key.
     *
     * @param str $key
     * @param str $type
     * 
     * @return array|mixed
     */

    public function lookup($key, $type = "album")
    {
        // Fetch the data from Metadata API
        $url = 'http://ws.spotify.com/lookup/1/.json?uri=' . $key;
        $data = json_decode(@file_get_contents($url));
        //check if data is not set, they make it a empty array
        (!isset($data) ? $data = array() : '');

        return $data;
    }

}
{'fraction_non_alphanumeric': 0.15595325054784515, 'fraction_numerical': 0.00620891161431702, 'mean_word_length': 2.019845644983462, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2581767', 'n_tokens_mistral': 931, 'n_tokens_neox': 870, 'n_words': 257}