<commit_before><?php namespace Olssonm\VeryBasicAuth;

use Illuminate\Support\ServiceProvider;

class VeryBasicAuthServiceProvider extends ServiceProvider
{
    /**
     * Perform post-registration booting of services.
     *
     * @return void
     */
    public function boot(\Illuminate\Routing\Router $router)
    {
        $config = __DIR__ . '/config.php';

        // Publishing of configuration
        $this->publishes([
            $config => config_path('very_basic_auth.php'),
        ]);

        // Load default view/s
        $this->loadViewsFrom(__DIR__ . '/resources/views', 'very_basic_auth');

        // Register middleware
        $router->middleware('auth.very_basic', 'Olssonm\VeryBasicAuth\Http\Middleware\VeryBasicAuth');
    }

    /**
     * Register any package services.
     *
     * @return void
     */
    public function register()
    {
        $config = __DIR__ . '/config.php';

        // Check that config-file exists
        if(!file_exists($config)) {
            $this->createConfig();
        }

        // If the user doesn't set their own config, load default
        $this->mergeConfigFrom(
            $config, 'very_basic_auth'
        );
    }

    /**
     * Crates a new config-file with a random password
     * @return str bytes written
     */
    private function createConfig()
    {
        $config = __DIR__ . '/config.php';
        $stub = __DIR__ . '/config.stub';

        $data = file_get_contents($stub);
        $data = str_replace('%password%', str_random(8), $data);
        return file_put_contents($config, $data);
    }
}<commit_msg>Middlareware has become aliasMiddleware. Cleanup.<commit_after><?php namespace Olssonm\VeryBasicAuth;

use Illuminate\Support\ServiceProvider;

class VeryBasicAuthServiceProvider extends ServiceProvider
{

    protected $config;

    protected $stub;

    /**
     * Constructor
     * @param  \Illuminate\Contracts\Foundation\Application  $app
     * @return void
     */
    public function __construct($app) {
        $this->config = __DIR__ . '/config.php';
        $this->stub = __DIR__ . '/config.stub';

        // Check that config-file exists
        if(!file_exists($this->config)) {
            $this->createConfig();
        }

        parent::__construct($app);
    }

    /**
     * Perform post-registration booting of services.
     *
     * @return void
     */
    public function boot(\Illuminate\Routing\Router $router)
    {
        // Publishing of configuration
        $this->publishes([
            $this->config => config_path('very_basic_auth.php'),
        ]);

        // Load default view/s
        $this->loadViewsFrom(__DIR__ . '/resources/views', 'very_basic_auth');

        // Register middleware
        $router->aliasMiddleware('auth.very_basic', \Olssonm\VeryBasicAuth\Http\Middleware\VeryBasicAuth::class);
    }

    /**
     * Register any package services.
     *
     * @return void
     */
    public function register()
    {
        // If the user doesn't set their own config, load default
        $this->mergeConfigFrom(
            $this->config, 'very_basic_auth'
        );
    }

    /**
     * Crates a new config-file with a random password
     * @return str bytes written
     */
    private function createConfig()
    {
        $data = file_get_contents($this->stub);
        $data = str_replace('%password%', str_random(8), $data);
        return file_put_contents($this->config, $data);
    }
}
{'fraction_non_alphanumeric': 0.12525310963262945, 'fraction_numerical': 0.0005785363031530228, 'mean_word_length': 2.2257462686567164, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '3294914', 'n_tokens_mistral': 985, 'n_tokens_neox': 982, 'n_words': 212}