<commit_before><?php

namespace kriskbx\mikado\Providers;

use DirectoryIterator;
use Illuminate\Support\ServiceProvider;
use kriskbx\mikado\Formatters\MetaFormatter;
use kriskbx\mikado\Manager;
use kriskbx\mikado\Mikado;

class MikadoServiceProvider extends ServiceProvider
{
    /**
     * @var string
     */
    protected $configPath;

    /**
     * Perform post-registration booting of services.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes([
            __DIR__ . '/../../config/mikado/model.php' => $this->configPath . '/model.php',
        ]);
    }

    /**
     * Register bindings in the container.
     */
    public function register()
    {
        $this->setConfigPath();

        $mikado = new Mikado();

        foreach (new DirectoryIterator($this->configPath) as $fileInfo) {
            if ($fileInfo->isDot()) {
                continue;
            }

            $manager = new Manager();
            $model = $fileInfo->getBasename();

            $this->addFormatter($manager, $model, 'MetaFormatter');
            $this->addFormatter($manager, $model, 'RemapFormatter');
            $this->addFormatter($manager, $model, 'FilterFormatter');
            $this->addFormatter($manager, $model, 'RequestFormatter');

            $mikado->add($model, $manager);
        }

        $this->app->singleton('kriskbx\mikado\Mikado', function ($app) use ($mikado) {
            return $mikado;
        });
    }

    /**<commit_msg>fixed basename issue on sp<commit_after><?php

namespace kriskbx\mikado\Providers;

use DirectoryIterator;
use Illuminate\Support\ServiceProvider;
use kriskbx\mikado\Formatters\MetaFormatter;
use kriskbx\mikado\Manager;
use kriskbx\mikado\Mikado;

class MikadoServiceProvider extends ServiceProvider
{
    /**
     * @var string
     */
    protected $configPath;

    /**
     * Perform post-registration booting of services.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes([
            __DIR__ . '/../../config/mikado/model.php' => $this->configPath . '/model.php',
        ]);
    }

    /**
     * Register bindings in the container.
     */
    public function register()
    {
        $this->setConfigPath();

        $mikado = new Mikado();

        foreach (new DirectoryIterator($this->configPath) as $fileInfo) {
            if ($fileInfo->isDot()) {
                continue;
            }

            $manager = new Manager();
            $pathParts = pathinfo($fileInfo->getBasename());
            $model = $pathParts['filename'];

            $this->addFormatter($manager, $model, 'MetaFormatter');
            $this->addFormatter($manager, $model, 'RemapFormatter');
            $this->addFormatter($manager, $model, 'FilterFormatter');
            $this->addFormatter($manager, $model, 'RequestFormatter');

            $mikado->add($model, $manager);
        }

        $this->app->singleton('kriskbx\mikado\Mikado', function ($app) use ($mikado) {
            return $mikado;
        });
    }

    /**
{'fraction_non_alphanumeric': 0.14490861618798956, 'fraction_numerical': 0.0, 'mean_word_length': 2.19937369519833, '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': '2125170', 'n_tokens_mistral': 920, 'n_tokens_neox': 885, 'n_words': 170}