<commit_before><?php
/**
 * Spiral Framework.
 *
 * @license   MIT
 * @author    <NAME> (Wolfy-J)
 * @copyright ©2009-2015
 */
namespace Spiral\Core\Plugins;

use Spiral\Core\CoreException;

trait ConfigCacheTrait
{
    /**
     * Preloaded configs configuration. Using common memory cache for all configs will speed up application, but every
     * config change has to manually reset this cache. Attention, average memory consumption will increase.
     *
     * This plugin is unnecessary to use on small applications with low amount of used components.
     *
     * @var array
     */
    protected $configCache = array();

    /**
     * Load configuration files specified in application config directory. Config file may have extension, locked under
     * Core::getEnvironment() directory, this section will replace original config while application is under giver
     * environment. All config files with merged environment stored under cache directory.
     *
     * @param string $config Config filename (no .php)
     * @return mixed|array
     * @throws CoreException
     */
    public function loadConfig($config)
    {
        if (!$this->configCache)
        {
            $this->configCache = $this->loadData('cache-config');
            if (!is_array($this->configCache))
            {
                $this->configCache = array();
            }
        }

        if (isset($this->configCache[$config]))
        {
            return $this->configCache[$config];
        }

        //First time load
        $this->configCache[$config] = $data = parent::loadConfig($config);

        //Caching
        $this->saveData('cache-config', $this->configCache);

        return $data;
    }
}<commit_msg>Comment is corrected<commit_after><?php
/**
 * Spiral Framework.
 *
 * @license   MIT
 * @author    <NAME> (Wolfy-J)
 * @copyright ©2009-2015
 */
namespace Spiral\Core\Plugins;

use Spiral\Core\CoreException;

trait ConfigCacheTrait
{
    /**
     * Preloaded configs cache. Using common memory cache for all configs will speed up application, but every
     * config change has to manually reset this cache. Attention, average memory consumption will increase.
     *
     * This plugin is unnecessary to use on small applications with low amount of used components.
     *
     * @var array
     */
    protected $configCache = array();

    /**
     * Load configuration files specified in application config directory. Config file may have extension, locked under
     * Core::getEnvironment() directory, this section will replace original config while application is under giver
     * environment. All config files with merged environment stored under cache directory.
     *
     * @param string $config Config filename (no .php)
     * @return mixed|array
     * @throws CoreException
     */
    public function loadConfig($config)
    {
        if (!$this->configCache)
        {
            $this->configCache = $this->loadData('cache-config');
            if (!is_array($this->configCache))
            {
                $this->configCache = array();
            }
        }

        if (isset($this->configCache[$config]))
        {
            return $this->configCache[$config];
        }

        //First time load
        $this->configCache[$config] = $data = parent::loadConfig($config);

        //Caching
        $this->saveData('cache-config', $this->configCache);

        return $data;
    }
}

{'fraction_non_alphanumeric': 0.1059988351776354, 'fraction_numerical': 0.004659289458357601, 'mean_word_length': 2.435, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, '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': '359124', 'n_tokens_mistral': 896, 'n_tokens_neox': 874, 'n_words': 286}