<commit_before><?php

namespace Omniphx\Forrest\Providers;

use GuzzleHttp\Client;
use Illuminate\Support\ServiceProvider;
use Omniphx\Forrest\Providers\Laravel\LaravelCache;
use Omniphx\Forrest\Providers\Laravel\LaravelEvent;
use Omniphx\Forrest\Providers\Laravel\LaravelInput;
use Omniphx\Forrest\Providers\Laravel\LaravelRedirect;
use Omniphx\Forrest\Providers\Laravel\LaravelSession;

abstract class BaseServiceProvider extends ServiceProvider
{
    /**
     * Indicates if the application is laravel/lumen.
     *
     * @var bool
     */
    protected $is_laravel = true;

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        if (method_exists($this, 'getConfigPath')) {
            $this->publishes([
                __DIR__.'/../../../../config/config.php' => $this->getConfigPath(),
            ]);
        }
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('forrest', function ($app) {

            // Config options
            $settings = config('forrest');
            $storageType = config('forrest.storage.type');
            $authenticationType = config('forrest.authentication');

            // Determine showing HTTP errors
            $http_errors = true;
            if (!$this->is_laravel) {
                $http_errors = false;
            }

            // Dependencies
            $client = new Client(['http_errors' => $http_errors]);
            $input = new LaravelInput();
            $event = new LaravelEvent();
            $redirect = new LaravelRedirect();

            // Determine storage dependency
            if ($storageType == 'cache') {
                $storage = new LaravelCache(app('config'), app('cache'));
            } else {
                $storage = new LaravelSession(app('config'), app('session'));
            }

            // Class namespace
            $forrest = "\\Omniphx\\Forrest\\Authentications\\$authenticationType";

            return new $forrest($client, $event, $input, $redirect, $storage, $settings);
        });
    }

    /**
     * Returns the location of the package config file.
     *
     * @return string file location
     */
    abstract protected function getConfigPath();
}<commit_msg>Cleanup<commit_after><?php

namespace Omniphx\Forrest\Providers;

use GuzzleHttp\Client;
use Illuminate\Support\ServiceProvider;
use Omniphx\Forrest\Providers\Laravel\LaravelCache;
use Omniphx\Forrest\Providers\Laravel\LaravelEvent;
use Omniphx\Forrest\Providers\Laravel\LaravelInput;
use Omniphx\Forrest\Providers\Laravel\LaravelRedirect;
use Omniphx\Forrest\Providers\Laravel\LaravelSession;

abstract class BaseServiceProvider extends ServiceProvider
{
    /**
     * Indicates if the application is laravel/lumen.
     *
     * @var bool
     */
    protected $is_laravel = true;

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Returns the location of the package config file.
     *
     * @return string file location
     */
    abstract protected function getConfigPath();

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        if (method_exists($this, 'getConfigPath')) {
            $this->publishes([
                __DIR__.'/../../../../config/config.php' => $this->getConfigPath(),
            ]);
        }
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('forrest', function ($app) {

            // Config options
            $settings = config('forrest');
            $storageType = config('forrest.storage.type');
            $authenticationType = config('forrest.authentication');

            // Determine showing HTTP errors
            $http_errors = $this->is_laravel ? true : false;

            // Dependencies
            $client = new Client(['http_errors' => $http_errors]);
            $input = new LaravelInput();
            $event = new LaravelEvent();
            $redirect = new LaravelRedirect();

            // Determine storage dependency
            if ($storageType == 'cache') {
                $storage = new LaravelCache(app('config'), app('cache'));
            } else {
                $storage = new LaravelSession(app('config'), app('session'));
            }

            // Class namespace
            $forrest = "\\Omniphx\\Forrest\\Authentications\\$authenticationType";

            return new $forrest($client, $event, $input, $redirect, $storage, $settings);
        });
    }
}
{'fraction_non_alphanumeric': 0.12622950819672132, 'fraction_numerical': 0.0, 'mean_word_length': 2.0430174563591024, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '822521', 'n_tokens_mistral': 1387, 'n_tokens_neox': 1327, 'n_words': 294}