<commit_before><?php namespace Canducci\ZipCode;

use Canducci\ZipCode\Contracts\ZipCodeInfoContract;

/**
 * Class ZipCodeInfo
 * @package Canducci\ZipCode
 */
class ZipCodeInfo implements ZipCodeInfoContract {

    /**
     * @var string $valueJson
     */
    private $valueJson = null;

    /**
     * Construct ZipCodeInfo
     *
     * @param string $valueJson
     * @throws ZipCodeException
     */
    public function __construct($valueJson) 
    {
        if (is_string($valueJson))
        {
            $this->valueJson = $valueJson;
            if ($this->json_validate_zipcode() === false)
            {
                throw new ZipCodeException( trans('canducci-zipcode::zipcode.invalid_json_zip') );
            }
        }
        else
        {
            throw new ZipCodeException( trans('canducci-zipcode::zipcode.invalid_format_type_string') );
        }
    }

    /**
     * return JSON Javascript
     *
     * @return JSON Javascript
     */
    public function getJson()
    {
        if (!is_null($this->valueJson))
        {
            return $this->valueJson;    
        }
        return null;        
    }

    /**
     * return Array
     *
     * @return Array
     */
    public function getArray()
    {
        if (!is_null($this->valueJson))
        {
		    return json_decode($this->getJson(), true);
        }
        return null;
    }

    /**
     * return stdClass (Object)
     *
     * @return \stdClass
     */
    public function getObject()
    {
        if (!is_null($this->valueJson))
        {
	   	    return json_decode($this->getJson(), false);
        }
        return null;
    }
	
    /**     
     * validate zipcode format
     *
     * @return bool
     */
    private function json_validate_zipcode() 
    {
        if (is_string($this->valueJson)) 
        {<commit_msg>update g3<commit_after><?php namespace Canducci\ZipCode;

use Canducci\ZipCode\Contracts\ZipCodeInfoContract;

/**
 * Class ZipCodeInfo
 * @package Canducci\ZipCode
 */
class ZipCodeInfo implements ZipCodeInfoContract {

    /**
     * @var string $valueJson
     */
    private $valueJson = null;

    /**
     * Construct ZipCodeInfo
     *
     * @param string $valueJson
     * @throws ZipCodeException
     */
    public function __construct($valueJson) 
    {
        if (is_string($valueJson))
        {
            $this->valueJson = $valueJson;
            if ($this->json_validate_zipcode() === false)
            {
                throw new ZipCodeException( trans('canducci-zipcode::zipcode.invalid_json_zip') );
            }
        }
        else
        {
            throw new ZipCodeException( trans('canducci-zipcode::zipcode.invalid_format_type_string') );
        }
    }

    /**
     * return JSON Javascript
     *
     * @return JSON Javascript
     */
    public function getJson()
    {
        if (!empty($this->valueJson))
        {
            return $this->valueJson;
        }
        return null;        
    }

    /**
     * return Array
     *
     * @return Array
     */
    public function getArray()
    {
        if (!emtpy($this->valueJson))
        {
		    return json_decode($this->valueJson, true);
        }
        return null;
    }

    /**
     * return stdClass (Object)
     *
     * @return \stdClass
     */
    public function getObject()
    {
        if (!empty($this->valueJson))
        {
	   	    return json_decode($this->valueJson, false);
        }
        return null;
    }
	
    /**     
     * validate zipcode format
     *
     * @return bool
     */
    private function json_validate_zipcode() 
    {
        if (!empty($this->valueJson) && is_string($this->valueJson))
        {
{'fraction_non_alphanumeric': 0.11771087605098997, 'fraction_numerical': 0.00027122321670735016, 'mean_word_length': 1.6880466472303206, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '5378799', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1059, 'n_words': 200}