<commit_before><?php

namespace SebastiaanLuca\Router;

use Illuminate\Contracts\Http\Kernel as AppKernel;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider;
use Illuminate\Routing\Router;
use SebastiaanLuca\Router\Routers\BootstrapRouter;

class RouterServiceProvider extends RouteServiceProvider
{
    /**
     * Get the application's kernel implementation.
     *
     * @return \Illuminate\Foundation\Application|mixed
     */
    protected function getApplicationKernel()
    {
        return app(AppKernel::class);
    }
    
    /**
     * Map user-defined routers.
     */
    protected function registerUserRouters()
    {
        // We can safely assume the Kernel contract is the application's
        // HTTP kernel as it is bound in bootstrap/app.php to the actual
        // implementation. Still need to check if it's the package's
        // custom kernel though as that is an optional setup choice.
        
        $kernel = $this->getApplicationKernel();
        
        if (! $kernel instanceof Kernel) {
            return;
        }
        
        $routers = $kernel->getRouters();
        
        // Just instantiate each router as they handle the mapping itself
        foreach ($routers as $router) {
            $this->app->make($router);
        }
    }
    
    /**
     * Register the service provider.
     */
    public function register()
    {
        // Define our router extension
        $this->app->singleton(ExtendedRouter::class, function ($app) {
            return new ExtendedRouter($app['events'], $app);
        });
        
        // Swap the default router with our extended router
        $this->app->alias(ExtendedRouter::class, 'router');
    }
    
    /**
     * Define your route model bindings, pattern filters, etc using the Bootstrap router.
     *
     * @param \Illuminate\Routing\Router $router
     */
    public function boot(Router $router)
    {
        // Create a router that defines route patterns and whatnot
        $this->app->make(BootstrapRouter::class);
        
        // Map user-defined routers
        $this->registerUserRouters();
    }
}<commit_msg>Update router service provider to reflect Laravel 5.3 changes<commit_after><?php

namespace SebastiaanLuca\Router;

use Illuminate\Contracts\Http\Kernel as AppKernel;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider;
use Illuminate\Routing\Router;
use SebastiaanLuca\Router\Routers\BootstrapRouter;

class RouterServiceProvider extends RouteServiceProvider
{
    /**
     * Get the application's kernel implementation.
     *
     * @return \Illuminate\Foundation\Application|mixed
     */
    protected function getApplicationKernel()
    {
        return app(AppKernel::class);
    }
    
    /**
     * Map user-defined routers.
     */
    protected function registerUserRouters()
    {
        // We can safely assume the Kernel contract is the application's
        // HTTP kernel as it is bound in bootstrap/app.php to the actual
        // implementation. Still need to check if it's the package's
        // custom kernel though as that is an optional setup choice.
        
        $kernel = $this->getApplicationKernel();
        
        if (! $kernel instanceof Kernel) {
            return;
        }
        
        $routers = $kernel->getRouters();
        
        // Just instantiate each router as they handle the mapping itself
        foreach ($routers as $router) {
            $this->app->make($router);
        }
    }
    
    /**
     * Register the service provider.
     */
    public function register()
    {
        // Define our router extension
        $this->app->singleton(ExtendedRouter::class, function ($app) {
            return new ExtendedRouter($app['events'], $app);
        });
        
        // Swap the default router with our extended router
        $this->app->alias(ExtendedRouter::class, 'router');
    }
    
    /**
     * Define your route model bindings, pattern filters, etc using the Bootstrap router.
     */
    public function boot()
    {
        // Create a router that defines route patterns and whatnot
        $this->app->make(BootstrapRouter::class);
        
        // Map user-defined routers
        $this->registerUserRouters();
    }
}
{'fraction_non_alphanumeric': 0.0976123595505618, 'fraction_numerical': 0.00046816479400749064, 'mean_word_length': 2.2151993980436417, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '5976067', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1103, 'n_words': 324}