Advertisement
roman_gemini

Untitled

Feb 28th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: Roman
  5.  * Date: 24.02.2016
  6.  * Time: 18:02
  7.  */
  8.  
  9. namespace Slang\Providers;
  10.  
  11.  
  12. class RoutingServiceProvider extends ServiceProvider {
  13.  
  14.     /**
  15.      * Boot routing service provider.
  16.      */
  17.     public function boot()
  18.     {
  19.         $this->registerRouteValidators();
  20.         $this->registerRouterService();
  21.     }
  22.  
  23.  
  24.     public function shutdown()
  25.     {
  26.         //
  27.     }
  28.  
  29.  
  30.     /**
  31.      * Register router service in root scope.
  32.      */
  33.     private function registerRouterService()
  34.     {
  35.         $this->app->singleton(\Slang\Routing\Router::class);
  36.     }
  37.  
  38.  
  39.     /**
  40.      * Load route validators.
  41.      */
  42.     private function registerRouteValidators()
  43.     {
  44.         /*
  45.          * Set route validators used in route matching.
  46.          */
  47.         \Slang\Routing\Route::setValidators(
  48.  
  49.             /*
  50.              * Get list of route validators from configuration file
  51.              * and make instances of them.
  52.              */
  53.             array_map(func('new $1()'), config("router.validators"))
  54.  
  55.         );
  56.     }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement