<commit_before><?php namespace Codesleeve\AssetPipeline\Filters;

use Assetic\Cache\CacheInterface;

class CacheEnvironmentFilter implements CacheInterface
{
    public function __construct(CacheInterface $cache, $environment = 'production', $environments = 'production')
    {
        $this->cache = $cache;
        $this->environment = $environment;
        $this->environments = !is_array($environments) ? explode(',', $environments) : $environments;
    }

    public function has($key)
    {
        if ($this->shouldCache()) {
            return $this->cache->has($key);
        }

        return false;
    }

    public function get($key)
    {
        if ($this->shouldCache()) {
            return $this->cache->get($key);
        }
    }

    public function set($key, $value)
    {
        if ($this->shouldCache()) {
            return $this->cache->set($key, $value);
        }
    }

    public function remove($key)
    {
        if ($this->shouldCache()) {
            return $this->cache->remove($key);
        }
    }

    private function shouldCache()
    {
        return in_array($this->environment, $this->environments);
    }
}<commit_msg>putting in cacheOverride for cli assets:clean<commit_after><?php namespace Codesleeve\AssetPipeline\Filters;

use Assetic\Cache\CacheInterface;

class CacheEnvironmentFilter implements CacheInterface
{
    public $cacheOverride = null;

    public function __construct(CacheInterface $cache, $environment = 'production', $environments = 'production')
    {
        $this->cache = $cache;
        $this->environment = $environment;
        $this->environments = !is_array($environments) ? explode(',', $environments) : $environments;
    }

    public function has($key)
    {
        if ($this->shouldCache()) {
            return $this->cache->has($key);
        }

        return false;
    }

    public function get($key)
    {
        if ($this->shouldCache()) {
            return $this->cache->get($key);
        }
    }

    public function set($key, $value)
    {
        if ($this->shouldCache()) {
            return $this->cache->set($key, $value);
        }
    }

    public function remove($key)
    {
        if ($this->shouldCache()) {
            return $this->cache->remove($key);
        }
    }

    private function shouldCache()
    {
        return !is_null($this->cacheOverride) ? $this->cacheOverride : in_array($this->environment, $this->environments);
    }
}
{'fraction_non_alphanumeric': 0.1448388412892697, 'fraction_numerical': 0.0, 'mean_word_length': 2.448663853727145, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '4229431', 'n_tokens_mistral': 696, 'n_tokens_neox': 683, 'n_words': 138}