<commit_before><?php

namespace PulkitJalan\GeoIP\Drivers;

use GuzzleHttp\Exception\RequestException;

class TelizeDriver extends AbstractGeoIPDriver
{
    /**
     * Get array of data using telize.
     *
     * @param string $ip
     *
     * @return array
     */
    public function get($ip)
    {

        try {
            $data = json_decode($this->guzzle->get($this->getUrl($ip), [
                'headers' => [
                                'X-Mashape-Key' => array_get($this->config, 'key'),
                                'Accept' => 'application/json'
                            ]
            ])->getBody(), true);
        } catch (RequestException $e) {
            return [];
        }

        return [
            'city'        => array_get($data, 'city'),
            'country'     => array_get($data, 'country'),
            'countryCode' => array_get($data, 'country_code'),
            'latitude'    => array_get($data, 'latitude'),
            'longitude'   => array_get($data, 'longitude'),
            'region'      => array_get($data, 'region'),
            'regionCode'  => array_get($data, 'region_code'),
            'timezone'    => array_get($data, 'timezone'),
            'postalCode'  => array_get($data, 'postal_code'),
            'isp'         => array_get($data, 'organization'), // unsure what to return here; previously it was 'isp', but that does not exist anylonger.
        ];
    }

    /**
     * Get the telize url.
     *<commit_msg>removed isp<commit_after><?php

namespace PulkitJalan\GeoIP\Drivers;

use GuzzleHttp\Exception\RequestException;

class TelizeDriver extends AbstractGeoIPDriver
{
    /**
     * Get array of data using telize.
     *
     * @param string $ip
     *
     * @return array
     */
    public function get($ip)
    {

        try {
            $data = json_decode($this->guzzle->get($this->getUrl($ip), [
                'headers' => [
                                'X-Mashape-Key' => array_get($this->config, 'key'),
                                'Accept' => 'application/json'
                            ]
            ])->getBody(), true);
        } catch (RequestException $e) {
            return [];
        }

        return [
            'city'        => array_get($data, 'city'),
            'country'     => array_get($data, 'country'),
            'countryCode' => array_get($data, 'country_code'),
            'latitude'    => array_get($data, 'latitude'),
            'longitude'   => array_get($data, 'longitude'),
            'region'      => array_get($data, 'region'),
            'regionCode'  => array_get($data, 'region_code'),
            'timezone'    => array_get($data, 'timezone'),
            'postalCode'  => array_get($data, 'postal_code')
        ];
    }

    /**
     * Get the telize url.
     *
{'fraction_non_alphanumeric': 0.15048025613660618, 'fraction_numerical': 0.0, 'mean_word_length': 1.6603595080416274, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, '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': '4484950', 'n_tokens_mistral': 833, 'n_tokens_neox': 817, 'n_words': 159}