<commit_before><?php
namespace TypiCMS\Providers;

use App;
use Config;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use Request;
use TypiCMS\Commands\CacheKeyPrefix;
use TypiCMS\Commands\Database;
use TypiCMS\Commands\Install;
use TypiCMS\Modules\Users\Repositories\SentryUser;

class StartProvider extends ServiceProvider
{

    public function boot()
    {
        $this->commands('command.install');
        $this->commands('command.cachekeyprefix');
        $this->commands('command.database');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        /*
        |--------------------------------------------------------------------------
        | Set app locale on public side.
        |--------------------------------------------------------------------------
        */
        if (Request::segment(1) != 'admin') {

            $firstSegment = Request::segment(1);
            if (in_array($firstSegment, Config::get('app.locales'))) {
                Config::set('app.locale', $firstSegment);
            }
            // Not very reliable, need to be refactored
            setlocale(LC_ALL, App::getLocale() . '_' . ucfirst(App::getLocale()));

        }

        /*
        |--------------------------------------------------------------------------
        | Sidebar view creator.
        |--------------------------------------------------------------------------
        */
        $this->app->view->creator('admin._sidebar', 'TypiCMS\SideBarViewCreator');

        /*
        |--------------------------------------------------------------------------
        | Bind commands.
        |--------------------------------------------------------------------------
        */
        $this->app->bind('command.install', function (Application $app) {
            return new Install(
                new SentryUser($app['sentry']),
                new Filesystem
            );
        });
        $this->app->bind('command.cachekeyprefix', function () {
            return new CacheKeyPrefix(new Filesystem);
        });
        $this->app->bind('command.database', function () {
            return new Database(new Filesystem);
        });

        /*
        |--------------------------------------------------------------------------
        | Get custom routes for public side modules.
        |--------------------------------------------------------------------------
        */
        $this->app->singleton('TypiCMS.routes', function (Application $app) {
            return $app->make('TypiCMS\Modules\Menulinks\Repositories\MenulinkInterface')->getForRoutes();
        });

        /*
        |--------------------------------------------------------------------------
        | Register modules.
        |--------------------------------------------------------------------------
        */
        $this->app->register('TypiCMS\Modules\News\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Places\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Events\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Projects\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Categories\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Tags\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Partners\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Contacts\Providers\ModuleProvider');

        $this->app->register('TypiCMS\Modules\Translations\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Blocks\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Settings\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\History\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Users\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Groups\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Files\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Galleries\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Dashboard\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Menus\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Sitemap\Providers\ModuleProvider');
        // Pages and menulinks need to be at last for routing to work.
        $this->app->register('TypiCMS\Modules\Menulinks\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Pages\Providers\ModuleProvider');
    }
}
<commit_msg>setlocale<commit_after><?php
namespace TypiCMS\Providers;

use App;
use Config;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use Request;
use TypiCMS\Commands\CacheKeyPrefix;
use TypiCMS\Commands\Database;
use TypiCMS\Commands\Install;
use TypiCMS\Modules\Users\Repositories\SentryUser;

class StartProvider extends ServiceProvider
{

    public function boot()
    {
        $this->commands('command.install');
        $this->commands('command.cachekeyprefix');
        $this->commands('command.database');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        /*
        |--------------------------------------------------------------------------
        | Set app locale on public side.
        |--------------------------------------------------------------------------
        */
        if (Request::segment(1) != 'admin') {

            $firstSegment = Request::segment(1);
            if (in_array($firstSegment, Config::get('app.locales'))) {
                Config::set('app.locale', $firstSegment);
            }
            // Not very reliable, need to be refactored
            setlocale(LC_ALL, App::getLocale() . '_' . strtoupper(App::getLocale()) . '.utf8');

        }

        /*
        |--------------------------------------------------------------------------
        | Sidebar view creator.
        |--------------------------------------------------------------------------
        */
        $this->app->view->creator('admin._sidebar', 'TypiCMS\SideBarViewCreator');

        /*
        |--------------------------------------------------------------------------
        | Bind commands.
        |--------------------------------------------------------------------------
        */
        $this->app->bind('command.install', function (Application $app) {
            return new Install(
                new SentryUser($app['sentry']),
                new Filesystem
            );
        });
        $this->app->bind('command.cachekeyprefix', function () {
            return new CacheKeyPrefix(new Filesystem);
        });
        $this->app->bind('command.database', function () {
            return new Database(new Filesystem);
        });

        /*
        |--------------------------------------------------------------------------
        | Get custom routes for public side modules.
        |--------------------------------------------------------------------------
        */
        $this->app->singleton('TypiCMS.routes', function (Application $app) {
            return $app->make('TypiCMS\Modules\Menulinks\Repositories\MenulinkInterface')->getForRoutes();
        });

        /*
        |--------------------------------------------------------------------------
        | Register modules.
        |--------------------------------------------------------------------------
        */
        $this->app->register('TypiCMS\Modules\News\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Places\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Events\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Projects\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Categories\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Tags\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Partners\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Contacts\Providers\ModuleProvider');

        $this->app->register('TypiCMS\Modules\Translations\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Blocks\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Settings\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\History\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Users\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Groups\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Files\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Galleries\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Dashboard\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Menus\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Sitemap\Providers\ModuleProvider');
        // Pages and menulinks need to be at last for routing to work.
        $this->app->register('TypiCMS\Modules\Menulinks\Providers\ModuleProvider');
        $this->app->register('TypiCMS\Modules\Pages\Providers\ModuleProvider');
    }
}

{'fraction_non_alphanumeric': 0.28024678448185714, 'fraction_numerical': 0.0005228484785109275, 'mean_word_length': 1.570276807309863, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 119, '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': '4318180', 'n_tokens_mistral': 2372, 'n_tokens_neox': 2326, 'n_words': 293}