<commit_before><?php
/**
 * @copyright Copyright (c) 2016 <NAME>
 * @license https://github.com/ischenko/yii2-jsloader/blob/master/LICENSE
 * @link https://github.com/ischenko/yii2-jsloader#readme
 */

namespace ischenko\yii2\jsloader\base;

use ischenko\yii2\jsloader\helpers\JsExpression;
use Yii;
use yii\base\Object;
use yii\web\View;
use yii\web\AssetBundle;
use yii\helpers\FileHelper;
use ischenko\yii2\jsloader\LoaderInterface;
use ischenko\yii2\jsloader\ConfigInterface;
use ischenko\yii2\jsloader\ModuleInterface;
use ischenko\yii2\jsloader\filters\Position as PositionFilter;
use ischenko\yii2\jsloader\filters\ClassName as ClassNameFilter;

/**
 * Base class for JS loaders
 *
 * @author <NAME> <<EMAIL>>
 * @since 1.0
 */
abstract class Loader extends Object implements LoaderInterface
{
    const RUNTIME_DIR = '@runtime/jsloader';

    /**
     * @var View
     */
    private $view;

    /**
     * @var ClassNameFilter
     */
    private $ignoredBundles;

    /**
     * @var PositionFilter
     */
    private $ignoredPositions;

    /**
     * Loader constructor.
     *
     * @param View $view
     * @param array $config
     */
    public function __construct(View $view, array $config = [])
    {
        parent::__construct($config);

        $this->view = $view;
        $this->setIgnoreBundles([]);
        $this->setIgnorePositions([View::POS_HEAD]);
    }

    /**
     * @return \ischenko\yii2\jsloader\ConfigInterface an object that implements configuration interface
     */
    abstract public function getConfig();

    /**
     * Performs actual rendering of the JS loader<commit_msg>Fixed issue when the loader configuration gets rewritten by default values<commit_after><?php
/**
 * @copyright Copyright (c) 2016 <NAME>
 * @license https://github.com/ischenko/yii2-jsloader/blob/master/LICENSE
 * @link https://github.com/ischenko/yii2-jsloader#readme
 */

namespace ischenko\yii2\jsloader\base;

use ischenko\yii2\jsloader\helpers\JsExpression;
use Yii;
use yii\base\Object;
use yii\web\View;
use yii\web\AssetBundle;
use yii\helpers\FileHelper;
use ischenko\yii2\jsloader\LoaderInterface;
use ischenko\yii2\jsloader\ConfigInterface;
use ischenko\yii2\jsloader\ModuleInterface;
use ischenko\yii2\jsloader\filters\Position as PositionFilter;
use ischenko\yii2\jsloader\filters\ClassName as ClassNameFilter;

/**
 * Base class for JS loaders
 *
 * @author <NAME> <<EMAIL>>
 * @since 1.0
 */
abstract class Loader extends Object implements LoaderInterface
{
    const RUNTIME_DIR = '@runtime/jsloader';

    /**
     * @var View
     */
    private $view;

    /**
     * @var ClassNameFilter
     */
    private $ignoredBundles;

    /**
     * @var PositionFilter
     */
    private $ignoredPositions;

    /**
     * Loader constructor.
     *
     * @param View $view
     * @param array $config
     */
    public function __construct(View $view, array $config = [])
    {
        $this->view = $view;
        $this->setIgnoreBundles([]);
        $this->setIgnorePositions([View::POS_HEAD]);

        parent::__construct($config);
    }

    /**
     * @return \ischenko\yii2\jsloader\ConfigInterface an object that implements configuration interface
     */
    abstract public function getConfig();

    /**
     * Performs actual rendering of the JS loader
{'fraction_non_alphanumeric': 0.12481066343532263, 'fraction_numerical': 0.00969403211148137, 'mean_word_length': 3.132665832290363, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 4, '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': '4781578', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1050, 'n_words': 225}