<commit_before><?php

namespace Sober\Themer;

use Noodlehaus\Config;
use Sober\Themer\ConfigNoFile;
use Sober\Themer\Module\Template;
use Sober\Themer\Module\Plugin;

class Loader
{
    // expose template configs for theming
    public $templates = [];

    // protected
    protected $file;
    protected $types = ['template', 'plugin'];
    protected $type;
    protected $config;

    public function __construct()
    {
        $this->getFiles();
    }

    /**
     * Get files
     */
    protected function getFiles()
    {
        foreach ($this->types as $this->type) {
            $this->file = (has_filter('sober/themer/' . $this->type . '/file') ?  apply_filters('sober/themer/' . $this->type . '/file', rtrim($this->type)) : get_stylesheet_directory() . '/' . $this->type . 's.json');
            $this->load($this->file);
        }
    }

    /**
     * Load
     */
    protected function load($file)
    {
        $this->file = $file;

        if (!file_exists($this->file)) return;
        if (!$this->isJson()) return;

        $this->config = new Config($this->file);<commit_msg>Update Loader<commit_after><?php

namespace Sober\Themer;

use Noodlehaus\Config;
use Sober\Themer\ConfigNoFile;
use Sober\Themer\Module\Template;
use Sober\Themer\Module\Plugin;

class Loader
{
    // expose template configs for theming
    public $templates = [];

    // protected
    protected $file;
    protected $types = ['template', 'plugin'];
    protected $type;
    protected $config;

    public function __construct()
    {
        $this->getFiles();
    }

    /**
     * Get files
     */
    protected function getFiles()
    {
        foreach ($this->types as $this->type) {
            $this->file = (has_filter('sober/themer/' . $this->type . '/file') ?  apply_filters('sober/themer/' . $this->type . '/file', rtrim($this->type)) : get_stylesheet_directory() . '/' . $this->type . 's.json');
            $this->load();
        }
    }

    /**
     * Load
     */
    protected function load()
    {
        if (!file_exists($this->file)) return;
        if (!$this->isJson()) return;

        $this->config = new Config($this->file);
{'fraction_non_alphanumeric': 0.16821561338289961, 'fraction_numerical': 0.0, 'mean_word_length': 2.343167701863354, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '295325', 'n_tokens_mistral': 680, 'n_tokens_neox': 672, 'n_words': 140}