<commit_before><?php

namespace FluxBB\Core;

use FluxBB\Models\CategoryRepository;
use FluxBB\Models\ConversationRepository;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\ServiceProvider;
use FluxBB\Models\GroupRepository;
use FluxBB\Models\ConfigRepository;

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

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('fluxbb/core', 'fluxbb');

        // Add another namespace for localized mail templates
        $this->app->extend('view', function (Factory $view, $app) {
            $locale = $app['config']['app.locale'];
            $view->addNamespace('fluxbb:mail', __DIR__ . '/../../lang/' . $locale . '/mail/');
            return $view;
        });

        include __DIR__.'/../../start.php';
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->registerBindings();
        $this->registerViewComposers();
        $this->registerEventHandlers();
    }

    /**
     * Register the IoC container bindings.
     *
     * @return void
     */
    protected function registerBindings()
    {
        $this->app->bind('FluxBB\Models\GroupRepositoryInterface', function ($app) {
            return new GroupRepository($app['cache']);
        });

        $this->app->bind('FluxBB\Models\ConfigRepositoryInterface', function ($app) {
            return new ConfigRepository($app['cache.store'], $app['db']->connection('fluxbb'));
        });

        $this->app->bind('FluxBB\Models\CategoryRepositoryInterface', function ($app) {
            return new CategoryRepository($app['db']->connection('fluxbb'));
        });

        $this->app->bind('FluxBB\Models\ConversationRepositoryInterface', function ($app) {
            return new ConversationRepository($app['db']->connection('fluxbb'));
        });
    }

    /**
     * Register any view composers.
     *
     * @return void
     */
    protected function registerViewComposers()
    {
        $this->app->extend('view', function (Factory $view) {
            $view->composer('fluxbb::layout.main', 'FluxBB\View\AlertsComposer');
            return $view;
        });
    }

    /**
     * Register any event handlers.
     *
     * @return void
     */
    protected function registerEventHandlers()
    {
        $events = $this->app['events'];

        $events->listen('user.registered', 'FluxBB\Handlers\SendWelcomeEmail');
        //$events->listen('user.posted', 'FluxBB\Handlers\UpdateUserPostStats');
        //$events->listen('user.posted', 'FluxBB\Handlers\UpdateForumStats');
    }<commit_msg>Re-enable the update of user stats upon posting.<commit_after><?php

namespace FluxBB\Core;

use FluxBB\Models\CategoryRepository;
use FluxBB\Models\ConversationRepository;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\ServiceProvider;
use FluxBB\Models\GroupRepository;
use FluxBB\Models\ConfigRepository;

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

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('fluxbb/core', 'fluxbb');

        // Add another namespace for localized mail templates
        $this->app->extend('view', function (Factory $view, $app) {
            $locale = $app['config']['app.locale'];
            $view->addNamespace('fluxbb:mail', __DIR__ . '/../../lang/' . $locale . '/mail/');
            return $view;
        });

        include __DIR__.'/../../start.php';
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->registerBindings();
        $this->registerViewComposers();
        $this->registerEventHandlers();
    }

    /**
     * Register the IoC container bindings.
     *
     * @return void
     */
    protected function registerBindings()
    {
        $this->app->bind('FluxBB\Models\GroupRepositoryInterface', function ($app) {
            return new GroupRepository($app['cache']);
        });

        $this->app->bind('FluxBB\Models\ConfigRepositoryInterface', function ($app) {
            return new ConfigRepository($app['cache.store'], $app['db']->connection('fluxbb'));
        });

        $this->app->bind('FluxBB\Models\CategoryRepositoryInterface', function ($app) {
            return new CategoryRepository($app['db']->connection('fluxbb'));
        });

        $this->app->bind('FluxBB\Models\ConversationRepositoryInterface', function ($app) {
            return new ConversationRepository($app['db']->connection('fluxbb'));
        });
    }

    /**
     * Register any view composers.
     *
     * @return void
     */
    protected function registerViewComposers()
    {
        $this->app->extend('view', function (Factory $view) {
            $view->composer('fluxbb::layout.main', 'FluxBB\View\AlertsComposer');
            return $view;
        });
    }

    /**
     * Register any event handlers.
     *
     * @return void
     */
    protected function registerEventHandlers()
    {
        $events = $this->app['events'];

        $events->listen('user.registered', 'FluxBB\Handlers\SendWelcomeEmail');
        $events->listen('user.posted', 'FluxBB\Handlers\UpdateUserPostStats');
        //$events->listen('user.posted', 'FluxBB\Handlers\UpdateForumStats');
    }
{'fraction_non_alphanumeric': 0.15225399052797756, 'fraction_numerical': 0.0, 'mean_word_length': 2.4599514563106797, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '237070', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1571, 'n_words': 301}