<commit_before><?php namespace Orchestra\View;

use Illuminate\Support\ServiceProvider;
use Orchestra\View\Theme\Finder;
use Orchestra\View\Theme\ThemeManager;

class ViewServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->registerViewFinder();
        $this->registerTheme();
    }

    /**
     * Register the service provider for view finder.
     *
     * @return void
     */
    protected function registerViewFinder()
    {
        $this->app->bindShared('view.finder', function ($app) {
            $paths = $app['config']['view.paths'];

            return new FileViewFinder($app['files'], $paths);
        });
    }

    /**
     * Register the service provider for theme.
     *
     * @return void
     */
    protected function registerTheme()
    {
        $this->app->bindShared('orchestra.theme', function ($app) {
            return new ThemeManager($app);
        });

        $this->app->bindShared('orchestra.theme.finder', function ($app) {
            return new Finder($app);
        });
    }

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->bootCurrentTheme();
        $this->bootThemeResolver();
    }

    /**
     * Boot current theme selection.
     *
     * @return void
     */
    protected function bootCurrentTheme()
    {
        $app    = $this->app;
        $memory = $app['orchestra.memory']->makeOrFallback();

        // By default, we should consider all request to use "frontend"
        // theme and only convert to use "backend" routing when certain
        // event is fired.
        $app['orchestra.theme']->setTheme($memory->get('site.theme.frontend'));

        $app['events']->listen('orchestra.started: admin', function () use ($app, $memory) {
            $app['orchestra.theme']->setTheme($memory->get('site.theme.backend'));
        });
    }

    /**
     * Boot theme resolver.
     *
     * @return void
     */
    protected function bootThemeResolver()
    {
        $app = $this - app;

        // The theme is only booted when the first view is being composed.
        // This would prevent multiple theme being booted in the same
        // request.
        $app->resolving('view', function () use ($app) {
            $app['orchestra.theme']->resolving();
        });

        $app['events']->listen('composing: *', function () use ($app) {
            $app['orchestra.theme']->boot();
        });
    }
}
<commit_msg>Fixes typo.<commit_after><?php namespace Orchestra\View;

use Illuminate\Support\ServiceProvider;
use Orchestra\View\Theme\Finder;
use Orchestra\View\Theme\ThemeManager;

class ViewServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->registerViewFinder();
        $this->registerTheme();
    }

    /**
     * Register the service provider for view finder.
     *
     * @return void
     */
    protected function registerViewFinder()
    {
        $this->app->bindShared('view.finder', function ($app) {
            $paths = $app['config']['view.paths'];

            return new FileViewFinder($app['files'], $paths);
        });
    }

    /**
     * Register the service provider for theme.
     *
     * @return void
     */
    protected function registerTheme()
    {
        $this->app->bindShared('orchestra.theme', function ($app) {
            return new ThemeManager($app);
        });

        $this->app->bindShared('orchestra.theme.finder', function ($app) {
            return new Finder($app);
        });
    }

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->bootCurrentTheme();
        $this->bootThemeResolver();
    }

    /**
     * Boot current theme selection.
     *
     * @return void
     */
    protected function bootCurrentTheme()
    {
        $app    = $this->app;
        $memory = $app['orchestra.memory']->makeOrFallback();

        // By default, we should consider all request to use "frontend"
        // theme and only convert to use "backend" routing when certain
        // event is fired.
        $app['orchestra.theme']->setTheme($memory->get('site.theme.frontend'));

        $app['events']->listen('orchestra.started: admin', function () use ($app, $memory) {
            $app['orchestra.theme']->setTheme($memory->get('site.theme.backend'));
        });
    }

    /**
     * Boot theme resolver.
     *
     * @return void
     */
    protected function bootThemeResolver()
    {
        $app = $this->app;

        // The theme is only booted when the first view is being composed.
        // This would prevent multiple theme being booted in the same
        // request.
        $app->resolving('view', function () use ($app) {
            $app['orchestra.theme']->resolving();
        });

        $app['events']->listen('composing: *', function () use ($app) {
            $app['orchestra.theme']->boot();
        });
    }
}

{'fraction_non_alphanumeric': 0.14691668277595205, 'fraction_numerical': 0.0, 'mean_word_length': 2.0742721330956626, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 46, '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': '6179771', 'n_tokens_mistral': 1432, 'n_tokens_neox': 1431, 'n_words': 334}