Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: Roman
- * Date: 24.02.2016
- * Time: 18:02
- */
- namespace Slang\Providers;
- class RoutingServiceProvider extends ServiceProvider {
- /**
- * Boot routing service provider.
- */
- public function boot()
- {
- $this->registerRouteValidators();
- $this->registerRouterService();
- }
- public function shutdown()
- {
- //
- }
- /**
- * Register router service in root scope.
- */
- private function registerRouterService()
- {
- $this->app->singleton(\Slang\Routing\Router::class);
- }
- /**
- * Load route validators.
- */
- private function registerRouteValidators()
- {
- /*
- * Set route validators used in route matching.
- */
- \Slang\Routing\Route::setValidators(
- /*
- * Get list of route validators from configuration file
- * and make instances of them.
- */
- array_map(func('new $1()'), config("router.validators"))
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement