<commit_before><?php

namespace Unity\Component\Config\Drivers\File;

use Unity\Component\Config\Drivers\File\Exceptions\ConfigFileNotFoundException;

class JsonDriver extends FileDriver
{
    /**
     * JsonDriver constructor.
     */
    function __construct()
    {
        parent::__construct('json');
    }

    /**
     * Gets the configuration
     *
     * @param mixed $config The required configuration
     * @param $sources
     * @return mixed
     */
    function get($config, $sources)
    {
        $this->denote($config, $jsonFile, $keys);
        
        $configArray = $this->getConfigArray($jsonFile, $sources);

        return $this->getConfig($configArray, $keys);
    }

    function getConfigArray($jsonFile, $sources)
    {
        if(is_array($sources))
            foreach ($sources as $source) {
                $configArray = $this->getJsonAsArray($jsonFile, $source);

                if($configArray)
                    return $configArray;
            }

        $configArray = $this->getJsonAsArray($jsonFile, $sources);

        if($configArray)
            return $configArray;

        throw new ConfigFileNotFoundException("Cannot find configuration file \"{$this->getFileNameWithExt($arrayFile)}\" in any specified sources");
    }

    function getJsonAsArray($jsonFile, $source)
    {
        $fileFullPath = $this->getFullPath($jsonFile, $source);

        if($this->fileExists($fileFullPath))
        {
            $fileContent = file_get_contents($fileFullPath);

            return (array)json_decode($fileContent);
        }
    }
}<commit_msg>Replaced $arrayFile to $jsonFile<commit_after><?php

namespace Unity\Component\Config\Drivers\File;

use Unity\Component\Config\Drivers\File\Exceptions\ConfigFileNotFoundException;

class JsonDriver extends FileDriver
{
    /**
     * JsonDriver constructor.
     */
    function __construct()
    {
        parent::__construct('json');
    }

    /**
     * Gets the configuration
     *
     * @param mixed $config The required configuration
     * @param $sources
     * @return mixed
     */
    function get($config, $sources)
    {
        $this->denote($config, $jsonFile, $keys);
        
        $configArray = $this->getConfigArray($jsonFile, $sources);

        return $this->getConfig($configArray, $keys);
    }

    function getConfigArray($jsonFile, $sources)
    {
        if(is_array($sources))
            foreach ($sources as $source) {
                $configArray = $this->getJsonAsArray($jsonFile, $source);

                if($configArray)
                    return $configArray;
            }

        $configArray = $this->getJsonAsArray($jsonFile, $sources);

        if($configArray)
            return $configArray;

        throw new ConfigFileNotFoundException("Cannot find configuration file \"{$this->getFileNameWithExt($jsonFile)}\" in any specified sources");
    }

    function getJsonAsArray($jsonFile, $source)
    {
        $fileFullPath = $this->getFullPath($jsonFile, $source);

        if($this->fileExists($fileFullPath))
        {
            $fileContent = file_get_contents($fileFullPath);

            return (array)json_decode($fileContent);
        }
    }
}
{'fraction_non_alphanumeric': 0.12375, 'fraction_numerical': 0.0, 'mean_word_length': 2.4642857142857144, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '222618', 'n_tokens_mistral': 900, 'n_tokens_neox': 865, 'n_words': 165}