<commit_before><?php
namespace AssetCompress;

use AssetCompress\AssetFilter;
use Cake\Core\App;
use Exception;
use RuntimeException;

/**
 * A collection for creating and interacting with filter sets.
 *
 */
class AssetFilterCollection {

/**
 * Config object.
 *
 * @var \AssetCompress\AssetConfig
 */
	protected $_config = array();

/**
 * An array of filters.
 *
 * @var array
 */
	protected $_filters = array();

/**
 * Construct a filter collection.
 *
 * @param array $filters An array of filters as keys, with their settings as the values.
 * @param array $config An array of global settings for all filters. Contains 'paths'
 */
	public function __construct(array $filters, array $config, array $filterSettings) {
		$this->_config = $config;
		$this->_buildFilters($filters, $filterSettings);
	}

/**
 * Builds the filters in the collection.
 *
 * @throws Exception
 */
	protected function _buildFilters($filters, $settings) {
		foreach ($filters as $name) {
			$className = App::className($name, 'Filter');
			if (!class_exists($className)) {
				$className = App::className('AssetCompress.' . $name, 'Filter');
			}
			if (!class_exists($className)) {
				throw new Exception(sprintf('Cannot not load filter "%s".', $name));
			}
			$config = array_merge($this->_config, isset($settings[$className]) ? $settings[$className] : array());
			$filter = new $className();
			$this->addFilter($filter);
			$filter->settings($config);
		}
	}

/**
 * Append a filter to the list of filters in the collection.
 *
 * @param AssetFilterInterface $filter The filter to append.
 */
	public function addFilter(AssetFilterInterface $filter) {
		$this->_filters[] = $filter;
	}

/**
 * Check to see if the Collection contains a filter with
 * a specific classname.
 *
 * @param string $name The classname you want to check.
 * @return boolean.
 */
	public function has($name) {<commit_msg>Fix filter config key<commit_after><?php
namespace AssetCompress;

use AssetCompress\AssetFilter;
use Cake\Core\App;
use Exception;
use RuntimeException;

/**
 * A collection for creating and interacting with filter sets.
 *
 */
class AssetFilterCollection {

/**
 * Config object.
 *
 * @var \AssetCompress\AssetConfig
 */
	protected $_config = array();

/**
 * An array of filters.
 *
 * @var array
 */
	protected $_filters = array();

/**
 * Construct a filter collection.
 *
 * @param array $filters An array of filters as keys, with their settings as the values.
 * @param array $config An array of global settings for all filters. Contains 'paths'
 */
	public function __construct(array $filters, array $config, array $filterSettings) {
		$this->_config = $config;
		$this->_buildFilters($filters, $filterSettings);
	}

/**
 * Builds the filters in the collection.
 *
 * @throws Exception
 */
	protected function _buildFilters($filters, $settings) {
		foreach ($filters as $name) {
			$className = App::className($name, 'Filter');
			if (!class_exists($className)) {
				$className = App::className('AssetCompress.' . $name, 'Filter');
			}
			if (!class_exists($className)) {
				throw new Exception(sprintf('Cannot not load filter "%s".', $name));
			}
			$filter = new $className();
			$this->addFilter($filter);
			$className = join('', array_slice(explode('\\', $className), -1));
			$config = array_merge($this->_config, isset($settings[$className]) ? $settings[$className] : array());
			$filter->settings($config);
		}
	}

/**
 * Append a filter to the list of filters in the collection.
 *
 * @param AssetFilterInterface $filter The filter to append.
 */
	public function addFilter(AssetFilterInterface $filter) {
		$this->_filters[] = $filter;
	}

/**
 * Check to see if the Collection contains a filter with
 * a specific classname.
 *
 * @param string $name The classname you want to check.
 * @return boolean.
 */
	public function has($name) {
{'fraction_non_alphanumeric': 0.1419656786271451, 'fraction_numerical': 0.00026001040041601667, 'mean_word_length': 4.075197889182058, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '3283901', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1111, 'n_words': 364}