Passed
Push — master ( fca16e...a09e23 )
by Alexander
04:10
created
src/components/Console/Input/Args/ArgvInput.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         $len = strlen($name);
137 137
         
138 138
         for ($i = 0; $i < $len; $i++) {
139
-            if (!$this->definition->hasShortcut($name[$i])) {
139
+            if ( ! $this->definition->hasShortcut($name[$i])) {
140 140
                 throw new RuntimeException(sprintf('The "-%s" option does not exist', $name[$i]));
141 141
             }
142 142
             
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * 
250 250
      * @return bool
251 251
      */
252
-    public function hasParameterOption(string|array $values, bool $params = false): bool
252
+    public function hasParameterOption(string | array $values, bool $params = false): bool
253 253
     {
254 254
         $tokens = $this->getTokens();
255 255
         
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      * 
279 279
      * @return mixed
280 280
      */
281
-    public function getParameterOption(string|array $values, $default = false, bool $params = false): mixed
281
+    public function getParameterOption(string | array $values, $default = false, bool $params = false): mixed
282 282
     {
283 283
         $tokens = $this->getTokens();
284 284
         
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     {
325 325
         $self = $this;
326 326
         
327
-        $tokens = array_map(function ($token) use ($self) {
327
+        $tokens = array_map(function($token) use ($self) {
328 328
             if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
329 329
                 return $match[1].$self->escapeToken($match[2]);
330 330
             }
Please login to merge, or discard this patch.
src/bundles/ApplicationBundle/Routing/RouteCompiler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -268,7 +268,7 @@
 block discarded – undo
268 268
      * 
269 269
      * @return string
270 270
      */
271
-    private static function determinePrefix(Route $route,array $tokens): string
271
+    private static function determinePrefix(Route $route, array $tokens): string
272 272
     {
273 273
         if ('text' !== $tokens[0][0]) {
274 274
             return ($route->hasDefault($tokens[0][3]) || '/' === $tokens[0][1]) ? '' : $tokens[0][1];
Please login to merge, or discard this patch.
src/bundles/ApplicationBundle/Console/Application.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -34,61 +34,61 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class Application extends BaseApplication
36 36
 {
37
-	/**
38
-	 * Application config data.
39
-	 * 
40
-	 * @var array $config
41
-	 */
42
-	protected $config = [
43
-		'homepage'   => '',
44
-		'publishAt'  => '02.05.2019',
45
-		'updateAt'   => '13.09.2021',
46
-		'logoText'   => '',
47
-		'logoStyle'  => 'info',
48
-	];
49
-
50
-	/**
51
-	 * The event dispatcher instance.
52
-	 * 
53
-	 * @var \Syscodes\Components\Contracts\Events\Dispatcher $events
54
-	 */
55
-	protected $events;
56
-
57
-	/**
58
-	 * The Lenevor application instance.
59
-	 * 
60
-	 * @var \Syscodes\Components\Contracts\Container|Container $lenevor
61
-	 */
62
-	protected $lenevor;
63
-
64
-	/**
65
-	 * Console constructor. Initialize the console of Lenevor.
66
-	 *
67
-	 * @param  \Syscodes\Components\Contracts\Core\Container  $lenevor
68
-	 * 
69
-	 * @param  string  $version
70
-	 * 
71
-	 * @return void
72
-	 */
73
-	public function __construct(Container $lenevor, Dispatcher $events, string $version)
74
-	{
75
-		parent::__construct(Version::NAME, $version);
76
-
77
-		$this->events  = $events;
78
-		$this->lenevor = $lenevor;
79
-	}
80
-
81
-	/**
82
-	 * Runs the current command discovered on the CLI.
37
+    /**
38
+     * Application config data.
39
+     * 
40
+     * @var array $config
41
+     */
42
+    protected $config = [
43
+        'homepage'   => '',
44
+        'publishAt'  => '02.05.2019',
45
+        'updateAt'   => '13.09.2021',
46
+        'logoText'   => '',
47
+        'logoStyle'  => 'info',
48
+    ];
49
+
50
+    /**
51
+     * The event dispatcher instance.
52
+     * 
53
+     * @var \Syscodes\Components\Contracts\Events\Dispatcher $events
54
+     */
55
+    protected $events;
56
+
57
+    /**
58
+     * The Lenevor application instance.
59
+     * 
60
+     * @var \Syscodes\Components\Contracts\Container|Container $lenevor
61
+     */
62
+    protected $lenevor;
63
+
64
+    /**
65
+     * Console constructor. Initialize the console of Lenevor.
66
+     *
67
+     * @param  \Syscodes\Components\Contracts\Core\Container  $lenevor
68
+     * 
69
+     * @param  string  $version
70
+     * 
71
+     * @return void
72
+     */
73
+    public function __construct(Container $lenevor, Dispatcher $events, string $version)
74
+    {
75
+        parent::__construct(Version::NAME, $version);
76
+
77
+        $this->events  = $events;
78
+        $this->lenevor = $lenevor;
79
+    }
80
+
81
+    /**
82
+     * Runs the current command discovered on the CLI.
83 83
      * 
84 84
      * @param  \Syscodes\Components\Contracts\Console\Input\Input|null  $input  The input interface implemented
85 85
      * @param  \Syscodes\Components\Contracts\Console\Output\Output|null  $output  The output interface implemented
86 86
      * 
87 87
      * @return int
88
-	 */
89
-	public function run(InputInterface $input = null, OutputInterface $output = null)
90
-	{
91
-		$this->setLogo("                     __                                                    
88
+     */
89
+    public function run(InputInterface $input = null, OutputInterface $output = null)
90
+    {
91
+        $this->setLogo("                     __                                                    
92 92
                     / /   ___  ____  ___ _   ______  _____                 
93 93
                    / /   / _ \/ __ \/ _ \ | / / __ \/ ___/                 
94 94
                   / /___/  __/ / / /  __/ |/ / /_/ / /                     
@@ -101,25 +101,25 @@  discard block
 block discarded – undo
101 101
                           /_/   /_/
102 102
 		", 'info');
103 103
 		
104
-		$exit = parent::run($input, $output);
104
+        $exit = parent::run($input, $output);
105 105
 		
106
-		return $exit;
107
-	}
106
+        return $exit;
107
+    }
108 108
 
109
-	/**
110
-	 * Returns the version of the console.
109
+    /**
110
+     * Returns the version of the console.
111 111
      *
112 112
      * @return string
113
-	 */
114
-	public function getConsoleVersion(): string
115
-	{
116
-		return parent::getConsoleVersion().
117
-			sprintf(' (env: <comment>%s</>, debug: <comment>%s</>) [<note>%s</>]',
118
-				env('APP_ENV'), env('APP_DEBUG') ? 'true' : 'false', PHP_OS
119
-			);
120
-	}
121
-
122
-	/**
113
+     */
114
+    public function getConsoleVersion(): string
115
+    {
116
+        return parent::getConsoleVersion().
117
+            sprintf(' (env: <comment>%s</>, debug: <comment>%s</>) [<note>%s</>]',
118
+                env('APP_ENV'), env('APP_DEBUG') ? 'true' : 'false', PHP_OS
119
+            );
120
+    }
121
+
122
+    /**
123 123
      * Gets the logo text for console app.
124 124
      * 
125 125
      * @return string|null
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
         $this->config['logoStyle'] = $style;
169 169
     }
170 170
 
171
-	/**
172
-	 * Gets the Lenevor application instance.
173
-	 * 
174
-	 * @return void
175
-	 */
176
-	public function getLenevor()
177
-	{
178
-		return $this->lenevor;
179
-	}
171
+    /**
172
+     * Gets the Lenevor application instance.
173
+     * 
174
+     * @return void
175
+     */
176
+    public function getLenevor()
177
+    {
178
+        return $this->lenevor;
179
+    }
180 180
 }
181 181
\ No newline at end of file
Please login to merge, or discard this patch.
src/bundles/WebResourceBundle/bootstrap/bootstrap.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@
 block discarded – undo
48 48
 
49 49
 // Register the autoloader
50 50
 if ( ! class_exists(Syscodes\Bundles\WebResourceBundle\Autoloader\Autoload::class, false)) {
51
-	require_once SYS_PATH.'src/bundles/WebResourceBundle/Autoloader/AutoloadConfig.php';
52
-	require_once SYS_PATH.'src/bundles/WebResourceBundle/Autoloader/Autoload.php';
51
+    require_once SYS_PATH.'src/bundles/WebResourceBundle/Autoloader/AutoloadConfig.php';
52
+    require_once SYS_PATH.'src/bundles/WebResourceBundle/Autoloader/Autoload.php';
53 53
 }
54 54
 
55 55
 // Activate the framework class autoloader
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,9 +24,15 @@
 block discarded – undo
24 24
  */
25 25
 
26 26
 // Define the absolute paths for configured directories
27
-if ( ! defined('APP_PATH')) define('APP_PATH', realpath($paths['path.app']).DIRECTORY_SEPARATOR);
28
-if ( ! defined('CON_PATH')) define('CON_PATH', realpath($paths['path.config']).DIRECTORY_SEPARATOR);
29
-if ( ! defined('SYS_PATH')) define('SYS_PATH', realpath($paths['path.sys']).DIRECTORY_SEPARATOR);
27
+if ( ! defined('APP_PATH')) {
28
+    define('APP_PATH', realpath($paths['path.app']).DIRECTORY_SEPARATOR);
29
+}
30
+if ( ! defined('CON_PATH')) {
31
+    define('CON_PATH', realpath($paths['path.config']).DIRECTORY_SEPARATOR);
32
+}
33
+if ( ! defined('SYS_PATH')) {
34
+    define('SYS_PATH', realpath($paths['path.sys']).DIRECTORY_SEPARATOR);
35
+}
30 36
 
31 37
 // Call the file constants
32 38
 require CON_PATH.'constants.php';
Please login to merge, or discard this patch.
src/bundles/WebResourceBundle/Autoloader/AutoloadConfig.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -30,73 +30,73 @@
 block discarded – undo
30 30
  */
31 31
 class AutoloadConfig 
32 32
 {
33
-	/**
34
-	 * Map of class names and locations.
35
-	 * 
36
-	 * @var array $classmap
37
-	 */
38
-	public $classmap = [];
33
+    /**
34
+     * Map of class names and locations.
35
+     * 
36
+     * @var array $classmap
37
+     */
38
+    public $classmap = [];
39 39
 	
40
-	/**
41
-	 * Array of files for autoloading.
42
-	 * 
43
-	 * @var array $files
44
-	 */
45
-	public $files = [];
40
+    /**
41
+     * Array of files for autoloading.
42
+     * 
43
+     * @var array $files
44
+     */
45
+    public $files = [];
46 46
 	
47
-	/**
48
-	 * Array of namespaces for autoloading.
49
-	 * 
50
-	 * @var array $psr4
51
-	 */
52
-	public $psr4 = [];
47
+    /**
48
+     * Array of namespaces for autoloading.
49
+     * 
50
+     * @var array $psr4
51
+     */
52
+    public $psr4 = [];
53 53
 
54
-	/**
55
-	 * ---------------------------------------------------------------------
56
-	 * Class Map
57
-	 * ---------------------------------------------------------------------
58
-	 *
59
-	 * The class map provides a map of class names and their exact location 
60
-	 * on the drive.
61
-	 *  
62
-	 * @var string[] $coreClassmap
63
-	 */
64
-	protected $coreClassmap = __DIR__.DIRECTORY_SEPARATOR.'Register'.DIRECTORY_SEPARATOR.'autoloadClassmap.php';
54
+    /**
55
+     * ---------------------------------------------------------------------
56
+     * Class Map
57
+     * ---------------------------------------------------------------------
58
+     *
59
+     * The class map provides a map of class names and their exact location 
60
+     * on the drive.
61
+     *  
62
+     * @var string[] $coreClassmap
63
+     */
64
+    protected $coreClassmap = __DIR__.DIRECTORY_SEPARATOR.'Register'.DIRECTORY_SEPARATOR.'autoloadClassmap.php';
65 65
 
66
-	/**
67
-	 * ---------------------------------------------------------------------
68
-	 * Include Files
69
-	 * ---------------------------------------------------------------------
70
-	 * 
71
-	 * This maps the locations of any files in your application to 
72
-	 * their location on the file system.
73
-	 * 
74
-	 * @var string[] $coreFiles
75
-	 */
76
-	protected $coreFiles = __DIR__.DIRECTORY_SEPARATOR.'Register'.DIRECTORY_SEPARATOR.'autoloadFiles.php';
66
+    /**
67
+     * ---------------------------------------------------------------------
68
+     * Include Files
69
+     * ---------------------------------------------------------------------
70
+     * 
71
+     * This maps the locations of any files in your application to 
72
+     * their location on the file system.
73
+     * 
74
+     * @var string[] $coreFiles
75
+     */
76
+    protected $coreFiles = __DIR__.DIRECTORY_SEPARATOR.'Register'.DIRECTORY_SEPARATOR.'autoloadFiles.php';
77 77
 
78
-	/**
79
-	 * ---------------------------------------------------------------------
80
-	 * Namespaces
81
-	 * ---------------------------------------------------------------------
82
-	 *
83
-	 * This maps the locations of any namespaces in your application to 
84
-	 * their location on the file system. These are used by the Autoloader 
85
-	 * to locate files the first time they have been instantiated. 
86
-	 * 
87
-	 * @var string[] $corePsr4
88
-	 */
89
-	protected $corePsr4 = __DIR__.DIRECTORY_SEPARATOR.'Register'.DIRECTORY_SEPARATOR.'autoloadPsr4.php';
78
+    /**
79
+     * ---------------------------------------------------------------------
80
+     * Namespaces
81
+     * ---------------------------------------------------------------------
82
+     *
83
+     * This maps the locations of any namespaces in your application to 
84
+     * their location on the file system. These are used by the Autoloader 
85
+     * to locate files the first time they have been instantiated. 
86
+     * 
87
+     * @var string[] $corePsr4
88
+     */
89
+    protected $corePsr4 = __DIR__.DIRECTORY_SEPARATOR.'Register'.DIRECTORY_SEPARATOR.'autoloadPsr4.php';
90 90
 
91
-	/**
92
-	 * Constructor. Create a new Autoload instance.
93
-	 * 
94
-	 * @return void
95
-	 */
96
-	public function __construct()
97
-	{
98
-		$this->psr4     = array_merge(require $this->corePsr4, $this->psr4);
99
-		$this->classmap = array_merge(require $this->coreClassmap, $this->classmap);
100
-		$this->files    = array_merge(require $this->coreFiles, $this->files);
101
-	}
91
+    /**
92
+     * Constructor. Create a new Autoload instance.
93
+     * 
94
+     * @return void
95
+     */
96
+    public function __construct()
97
+    {
98
+        $this->psr4     = array_merge(require $this->corePsr4, $this->psr4);
99
+        $this->classmap = array_merge(require $this->coreClassmap, $this->classmap);
100
+        $this->files    = array_merge(require $this->coreFiles, $this->files);
101
+    }
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
src/bundles/WebResourceBundle/Autoloader/Autoloader.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
         }
106 106
 
107 107
         if ($config->enabledInComposer) {
108
-           $this->enabledComposerNamespaces();
108
+            $this->enabledComposerNamespaces();
109 109
         }
110 110
 
111 111
         return $this;
Please login to merge, or discard this patch.
src/bundles/WebResourceBundle/Autoloader/Autoload.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -27,32 +27,32 @@
 block discarded – undo
27 27
  */
28 28
 final class Autoload extends AutoloadConfig
29 29
 {
30
-	/**
31
-	 * Map of class names and locations.
32
-	 * 
33
-	 * @var array $classmap
34
-	 */
35
-	public $classmap = [];
30
+    /**
31
+     * Map of class names and locations.
32
+     * 
33
+     * @var array $classmap
34
+     */
35
+    public $classmap = [];
36 36
 	
37
-	/**
38
-	 * If true, then auto-enabled will happen across all namespaces
39
-	 * loaded by Composer, as well as the namespaces configured locally.
40
-	 * 
41
-	 * @var bool $enabledInComposer
42
-	 */
43
-	public $enabledInComposer = true;
37
+    /**
38
+     * If true, then auto-enabled will happen across all namespaces
39
+     * loaded by Composer, as well as the namespaces configured locally.
40
+     * 
41
+     * @var bool $enabledInComposer
42
+     */
43
+    public $enabledInComposer = true;
44 44
 	
45
-	/**
46
-	 * Array of files for autoloading.
47
-	 * 
48
-	 * @var array $files
49
-	 */
50
-	public $files = [];
45
+    /**
46
+     * Array of files for autoloading.
47
+     * 
48
+     * @var array $files
49
+     */
50
+    public $files = [];
51 51
 	
52
-	/**
53
-	 * Array of namespaces for autoloading.
54
-	 * 
55
-	 * @var array $psr4
56
-	 */
57
-	public $psr4 = [];
52
+    /**
53
+     * Array of namespaces for autoloading.
54
+     * 
55
+     * @var array $psr4
56
+     */
57
+    public $psr4 = [];
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Routing/Router.php 1 patch
Indentation   +657 added lines, -657 removed lines patch added patch discarded remove patch
@@ -43,691 +43,691 @@
 block discarded – undo
43 43
  */
44 44
 class Router implements Routable
45 45
 {
46
-	use Concerns\RouteMap,
47
-	    Macroable {
48
-		    __call as macroCall;
49
-	    }
50
-
51
-	/**
52
-	 * The registered route value binders.
53
-	 * 
54
-	 * @var array $binders
55
-	 */
56
-	protected $binders = [];
57
-
58
-	/**
59
-	 * The container instance used by the router.
60
-	 * 
61
-	 * @var \Syscodes\Components\Contracts\Container\Container $container
62
-	 */
63
-	protected $container;
64
-
65
-	/**
66
-	 * Variable of group route.
67
-	 *  
68
-	 * @var array $groupStack
69
-	 */
70
-	protected $groupStack = [];
71
-
72
-	/**
73
-	 * Middleware for function of filters
74
-	 *  
75
-	 * @var array $middleware
76
-	 */
77
-	protected $middleware = [];
46
+    use Concerns\RouteMap,
47
+        Macroable {
48
+            __call as macroCall;
49
+        }
50
+
51
+    /**
52
+     * The registered route value binders.
53
+     * 
54
+     * @var array $binders
55
+     */
56
+    protected $binders = [];
57
+
58
+    /**
59
+     * The container instance used by the router.
60
+     * 
61
+     * @var \Syscodes\Components\Contracts\Container\Container $container
62
+     */
63
+    protected $container;
64
+
65
+    /**
66
+     * Variable of group route.
67
+     *  
68
+     * @var array $groupStack
69
+     */
70
+    protected $groupStack = [];
71
+
72
+    /**
73
+     * Middleware for function of filters
74
+     *  
75
+     * @var array $middleware
76
+     */
77
+    protected $middleware = [];
78 78
 	
79
-	/**
80
-	 * All of the middleware groups.
81
-	 * 
82
-	 * @var array $middlewareGroups
83
-	 */
84
-	protected $middlewareGroups = [];
79
+    /**
80
+     * All of the middleware groups.
81
+     * 
82
+     * @var array $middlewareGroups
83
+     */
84
+    protected $middlewareGroups = [];
85 85
 	
86
-	/**
87
-	 * The priority-sorted list of middleware.
88
-	 * 
89
-	 * @var array $middlewarePriority
90
-	 */
91
-	public $middlewarePriority = [];
86
+    /**
87
+     * The priority-sorted list of middleware.
88
+     * 
89
+     * @var array $middlewarePriority
90
+     */
91
+    public $middlewarePriority = [];
92 92
 	
93
-	/**
94
-	 * The globally available parameter patterns.
95
-	 * 
96
-	 * @var array $patterns
97
-	 */
98
-	protected $patterns = [];
99
-
100
-	/**
101
-	 * Resolve the given route.
102
-	 * 
103
-	 * @var \Syscodes\Components\Routing\Resolver\RouteResolver $resolves
104
-	 */
105
-	protected $resolves;
106
-
107
-	/**
108
-	 * The Resource instance.
109
-	 * 
110
-	 * @var \Syscodes\Components\Routing\Resources\ResourceRegister $resources
111
-	 */
112
-	protected $resources;
113
-
114
-	/** 
115
-	 * The route collection instance. 
116
-	 * 
117
-	 * @var \Syscodes\Components\Routing\Collections\RouteCollection $routes
118
-	 */
119
-	protected $routes;
120
-
121
-	/**
122
-	 * Constructor. Create a new Router instance.
123
-	 *
124
-	 * @param  \Syscodes\Components\Contracts\Container\Container|null  $container
125
-	 * 
126
-	 * @return void
127
-	 */
128
-	public function __construct(Container $container = null)
129
-	{
130
-		$this->routes    = new RouteCollection;
131
-		$this->container = $container ?: new Container;
132
-		$this->resolves  = new RouteResolver($this, $this->routes, $this->container);
133
-	}
134
-
135
-	/**
136
-	 * Get the prefix from the group on the stack.
137
-	 *
138
-	 * @return string
139
-	 */
140
-	public function getGroupPrefix(): string
141
-	{
142
-		if ($this->hasGroupStack()) {
143
-			$last = end($this->groupStack);
144
-
145
-			return $last['prefix'] ?? '';
146
-		}
147
-
148
-		return '';
149
-	}
150
-
151
-	/**
152
-	 * Group a series of routes under a single URL segment. This is handy
153
-	 * for grouping items into an admin area, like:
154
-	 *
155
-	 *   Example:
156
-	 *      // Creates route: /admin show the word 'User'
157
-	 *      Route::group(['prefix' => 'admin'], function() {	 
158
-	 *
159
-	 *          Route::get('/user', function() {
160
-	 *	            echo 'Hello world..!';
161
-	 *          });
162
-	 *
163
-	 *      }); /admin/user
164
-	 *
165
-	 * @param  array  $attributes
166
-	 * @param  \Closure|array|string  $callback
167
-	 *
168
-	 * @return void
169
-	 */
170
-	public function group(array $attributes, $routes): void
171
-	{
172
-		foreach (Arr::wrap($routes) as $groupRoutes) {
173
-			$this->updateGroupStack($attributes);
93
+    /**
94
+     * The globally available parameter patterns.
95
+     * 
96
+     * @var array $patterns
97
+     */
98
+    protected $patterns = [];
99
+
100
+    /**
101
+     * Resolve the given route.
102
+     * 
103
+     * @var \Syscodes\Components\Routing\Resolver\RouteResolver $resolves
104
+     */
105
+    protected $resolves;
106
+
107
+    /**
108
+     * The Resource instance.
109
+     * 
110
+     * @var \Syscodes\Components\Routing\Resources\ResourceRegister $resources
111
+     */
112
+    protected $resources;
113
+
114
+    /** 
115
+     * The route collection instance. 
116
+     * 
117
+     * @var \Syscodes\Components\Routing\Collections\RouteCollection $routes
118
+     */
119
+    protected $routes;
120
+
121
+    /**
122
+     * Constructor. Create a new Router instance.
123
+     *
124
+     * @param  \Syscodes\Components\Contracts\Container\Container|null  $container
125
+     * 
126
+     * @return void
127
+     */
128
+    public function __construct(Container $container = null)
129
+    {
130
+        $this->routes    = new RouteCollection;
131
+        $this->container = $container ?: new Container;
132
+        $this->resolves  = new RouteResolver($this, $this->routes, $this->container);
133
+    }
134
+
135
+    /**
136
+     * Get the prefix from the group on the stack.
137
+     *
138
+     * @return string
139
+     */
140
+    public function getGroupPrefix(): string
141
+    {
142
+        if ($this->hasGroupStack()) {
143
+            $last = end($this->groupStack);
144
+
145
+            return $last['prefix'] ?? '';
146
+        }
147
+
148
+        return '';
149
+    }
150
+
151
+    /**
152
+     * Group a series of routes under a single URL segment. This is handy
153
+     * for grouping items into an admin area, like:
154
+     *
155
+     *   Example:
156
+     *      // Creates route: /admin show the word 'User'
157
+     *      Route::group(['prefix' => 'admin'], function() {	 
158
+     *
159
+     *          Route::get('/user', function() {
160
+     *	            echo 'Hello world..!';
161
+     *          });
162
+     *
163
+     *      }); /admin/user
164
+     *
165
+     * @param  array  $attributes
166
+     * @param  \Closure|array|string  $callback
167
+     *
168
+     * @return void
169
+     */
170
+    public function group(array $attributes, $routes): void
171
+    {
172
+        foreach (Arr::wrap($routes) as $groupRoutes) {
173
+            $this->updateGroupStack($attributes);
174 174
 	
175
-			$this->loadRoutes($groupRoutes);
175
+            $this->loadRoutes($groupRoutes);
176 176
 	
177
-			array_pop($this->groupStack);			
178
-		}
179
-	}
180
-
181
-	/**
182
-	 * Update the group stack with the given attributes.
183
-	 * 
184
-	 * @param  array  $attributes
185
-	 * 
186
-	 * @return void
187
-	 */
188
-	protected function updateGroupStack(array $attributes): void
189
-	{
190
-		if ($this->hasGroupStack()) {
191
-			$attributes = $this->mergeLastGroup($attributes);
192
-		}
193
-
194
-		$this->groupStack[] = $attributes;
195
-	}
196
-
197
-	/**
198
-	 * Merge the given group attributes.
199
-	 * 
200
-	 * @param  array  $new
201
-	 * @param  bool  $existsPrefix
202
-	 * 
203
-	 * @return array
204
-	 */
205
-	public function mergeLastGroup($new, bool $existsPrefix = true): array
206
-	{
207
-		return RouteGroup::mergeGroup($new, end($this->groupStack), $existsPrefix);
208
-	}
177
+            array_pop($this->groupStack);			
178
+        }
179
+    }
180
+
181
+    /**
182
+     * Update the group stack with the given attributes.
183
+     * 
184
+     * @param  array  $attributes
185
+     * 
186
+     * @return void
187
+     */
188
+    protected function updateGroupStack(array $attributes): void
189
+    {
190
+        if ($this->hasGroupStack()) {
191
+            $attributes = $this->mergeLastGroup($attributes);
192
+        }
193
+
194
+        $this->groupStack[] = $attributes;
195
+    }
196
+
197
+    /**
198
+     * Merge the given group attributes.
199
+     * 
200
+     * @param  array  $new
201
+     * @param  bool  $existsPrefix
202
+     * 
203
+     * @return array
204
+     */
205
+    public function mergeLastGroup($new, bool $existsPrefix = true): array
206
+    {
207
+        return RouteGroup::mergeGroup($new, end($this->groupStack), $existsPrefix);
208
+    }
209 209
 	
210
-	/**
211
-	 * Load the provided routes.
212
-	 * 
213
-	 * @param  \Closure|string  $callback
214
-	 * 
215
-	 * @return void
216
-	 */
217
-	protected function loadRoutes($callback): void
218
-	{
219
-		if ($callback instanceof Closure) {
220
-			$callback($this);
221
-		} else {
222
-			(new RouteFileRegister($this))->register($callback);
223
-		}
224
-	}
225
-
226
-	/**
227
-	 * Add a route to the underlying route collection. 
228
-	 *
229
-	 * @param  array|string  $method
230
-	 * @param  string  $route
231
-	 * @param  mixed  $action
232
-	 *
233
-	 * @return \Syscodes\Components\Routing\Route
234
-	 */
235
-	public function addRoute($method, $route, $action)
236
-	{
237
-		return $this->routes->add($this->map($method, $route, $action));
238
-	}
210
+    /**
211
+     * Load the provided routes.
212
+     * 
213
+     * @param  \Closure|string  $callback
214
+     * 
215
+     * @return void
216
+     */
217
+    protected function loadRoutes($callback): void
218
+    {
219
+        if ($callback instanceof Closure) {
220
+            $callback($this);
221
+        } else {
222
+            (new RouteFileRegister($this))->register($callback);
223
+        }
224
+    }
225
+
226
+    /**
227
+     * Add a route to the underlying route collection. 
228
+     *
229
+     * @param  array|string  $method
230
+     * @param  string  $route
231
+     * @param  mixed  $action
232
+     *
233
+     * @return \Syscodes\Components\Routing\Route
234
+     */
235
+    public function addRoute($method, $route, $action)
236
+    {
237
+        return $this->routes->add($this->map($method, $route, $action));
238
+    }
239 239
 	
240
-	/**
241
-	 * Register a new fallback route with the router.
242
-	 * 
243
-	 * @param  array|string|callable|null  $action
244
-	 * 
245
-	 * @return \Syscodes\Components\Routing\Route
246
-	 */
247
-	public function fallback($action)
248
-	{
249
-		$placeholder = 'fallbackPlaceholder';
240
+    /**
241
+     * Register a new fallback route with the router.
242
+     * 
243
+     * @param  array|string|callable|null  $action
244
+     * 
245
+     * @return \Syscodes\Components\Routing\Route
246
+     */
247
+    public function fallback($action)
248
+    {
249
+        $placeholder = 'fallbackPlaceholder';
250 250
 		
251
-		return $this->addRoute('GET', "{{$placeholder}}", $action)
252
-		            ->where($placeholder, '.*')
253
-		            ->fallback();
254
-	}
255
-
256
-	/**
257
-	 * Create a redirect from one URI to another.
258
-	 * 
259
-	 * @param  string  $uri
260
-	 * @param  string  $destination
261
-	 * @param  int  $status
262
-	 * 
263
-	 * @return \Syscodes\Components\Routing\Route
264
-	 */
265
-	public function redirect($uri, $destination, $status = 302)
266
-	{
267
-		return $this->any($uri, '\Syscodes\Components\Routing\Controllers\RedirectController')
268
-		            ->defaults('destination', $destination)
269
-		            ->defaults('status', $status);
270
-	}
251
+        return $this->addRoute('GET', "{{$placeholder}}", $action)
252
+                    ->where($placeholder, '.*')
253
+                    ->fallback();
254
+    }
255
+
256
+    /**
257
+     * Create a redirect from one URI to another.
258
+     * 
259
+     * @param  string  $uri
260
+     * @param  string  $destination
261
+     * @param  int  $status
262
+     * 
263
+     * @return \Syscodes\Components\Routing\Route
264
+     */
265
+    public function redirect($uri, $destination, $status = 302)
266
+    {
267
+        return $this->any($uri, '\Syscodes\Components\Routing\Controllers\RedirectController')
268
+                    ->defaults('destination', $destination)
269
+                    ->defaults('status', $status);
270
+    }
271 271
 	
272
-	/**
273
-	 * Create a permanent redirect from one URI to another.
274
-	 * 
275
-	 * @param  string  $uri
276
-	 * @param  string  $destination
277
-	 * 
278
-	 * @return \Syscodes\Components\Routing\Route
279
-	 */
280
-	public function permanentRedirect($uri, $destination)
281
-	{
282
-		return $this->redirect($uri, $destination, 301);
283
-	}
284
-
285
-	/**
286
-	 * Register a new route that returns a view.
287
-	 * 
288
-	 * @param  string  $uri
289
-	 * @param  string  $view
290
-	 * @param  array  $data
291
-	 * @param  int|array  $status
292
-	 * @param  array  $headers
293
-	 * 
294
-	 * @return \Syscodes\Components\Routing\Route
295
-	 */
296
-	public function view($uri, $view, $data = [], $status = 200, array $headers = [])
297
-	{
298
-		return $this->match(['GET', 'HEAD'], $uri, '\Syscodes\Components\Routing\Controllers\ViewController')
299
-		            ->setDefaults([
300
-		                'view' => $view,
301
-		                'data' => $data,
302
-		                'status' => is_array($status) ? 200 : $status,
303
-		                'headers' => is_array($status) ? $status : $headers,
304
-		            ]);
305
-	}
306
-
307
-	/**
308
-	 * Add new route to routes array.
309
-	 *
310
-	 * @param  array|string  $method
311
-	 * @param  string  $route
312
-	 * @param  mixed  $action
313
-	 *
314
-	 * @return \Syscodes\Components\Routing\Route
315
-	 * 
316
-	 * @throws \InvalidArgumentException
317
-	 */
318
-	public function map($method, $route, $action): Route
319
-	{
320
-		if ($this->actionReferencesController($action)) {
321
-			$action = $this->convertToControllerAction($action);
322
-		}
323
-
324
-		$route = $this->newRoute(
325
-		              $method,
326
-		              $this->prefix($route),
327
-		              $action
328
-		         );
329
-
330
-		if ($this->hasGroupStack()) {
331
-			$this->mergeGroupAttributesIntoRoute($route);			
332
-		}
333
-
334
-		$this->addWhereClausesToRoute($route);
272
+    /**
273
+     * Create a permanent redirect from one URI to another.
274
+     * 
275
+     * @param  string  $uri
276
+     * @param  string  $destination
277
+     * 
278
+     * @return \Syscodes\Components\Routing\Route
279
+     */
280
+    public function permanentRedirect($uri, $destination)
281
+    {
282
+        return $this->redirect($uri, $destination, 301);
283
+    }
284
+
285
+    /**
286
+     * Register a new route that returns a view.
287
+     * 
288
+     * @param  string  $uri
289
+     * @param  string  $view
290
+     * @param  array  $data
291
+     * @param  int|array  $status
292
+     * @param  array  $headers
293
+     * 
294
+     * @return \Syscodes\Components\Routing\Route
295
+     */
296
+    public function view($uri, $view, $data = [], $status = 200, array $headers = [])
297
+    {
298
+        return $this->match(['GET', 'HEAD'], $uri, '\Syscodes\Components\Routing\Controllers\ViewController')
299
+                    ->setDefaults([
300
+                        'view' => $view,
301
+                        'data' => $data,
302
+                        'status' => is_array($status) ? 200 : $status,
303
+                        'headers' => is_array($status) ? $status : $headers,
304
+                    ]);
305
+    }
306
+
307
+    /**
308
+     * Add new route to routes array.
309
+     *
310
+     * @param  array|string  $method
311
+     * @param  string  $route
312
+     * @param  mixed  $action
313
+     *
314
+     * @return \Syscodes\Components\Routing\Route
315
+     * 
316
+     * @throws \InvalidArgumentException
317
+     */
318
+    public function map($method, $route, $action): Route
319
+    {
320
+        if ($this->actionReferencesController($action)) {
321
+            $action = $this->convertToControllerAction($action);
322
+        }
323
+
324
+        $route = $this->newRoute(
325
+                        $method,
326
+                        $this->prefix($route),
327
+                        $action
328
+                    );
329
+
330
+        if ($this->hasGroupStack()) {
331
+            $this->mergeGroupAttributesIntoRoute($route);			
332
+        }
333
+
334
+        $this->addWhereClausesToRoute($route);
335 335
 		
336
-		return $route;
337
-	}
336
+        return $route;
337
+    }
338 338
 	
339
-	/**
340
-	 * Determine if the action is routing to a controller.
341
-	 * 
342
-	 * @param  array  $action
343
-	 * 
344
-	 * @return bool
345
-	 */
346
-	protected function actionReferencesController($action): bool
347
-	{
348
-		if ( ! $action instanceof Closure) {
349
-			return is_string($action) || (isset($action['uses']) && is_string($action['uses']));
350
-		}
339
+    /**
340
+     * Determine if the action is routing to a controller.
341
+     * 
342
+     * @param  array  $action
343
+     * 
344
+     * @return bool
345
+     */
346
+    protected function actionReferencesController($action): bool
347
+    {
348
+        if ( ! $action instanceof Closure) {
349
+            return is_string($action) || (isset($action['uses']) && is_string($action['uses']));
350
+        }
351 351
 		
352
-		return false;
353
-	}
352
+        return false;
353
+    }
354 354
 	
355
-	/**
356
-	 * Add a controller based route action to the action array.
357
-	 * 
358
-	 * @param  array|string  $action
359
-	 * 
360
-	 * @return array
361
-	 */
362
-	protected function convertToControllerAction($action): array
363
-	{
364
-		if (is_string($action)) {
365
-			$action = ['uses' => $action];
366
-		}
355
+    /**
356
+     * Add a controller based route action to the action array.
357
+     * 
358
+     * @param  array|string  $action
359
+     * 
360
+     * @return array
361
+     */
362
+    protected function convertToControllerAction($action): array
363
+    {
364
+        if (is_string($action)) {
365
+            $action = ['uses' => $action];
366
+        }
367 367
 		
368
-		if ($this->hasGroupStack()) {
369
-			$action['uses'] = $this->prependGroupController($action['uses']);
370
-			$action['uses'] = $this->prependGroupNamespace($action['uses']);
371
-		}
368
+        if ($this->hasGroupStack()) {
369
+            $action['uses'] = $this->prependGroupController($action['uses']);
370
+            $action['uses'] = $this->prependGroupNamespace($action['uses']);
371
+        }
372 372
 		
373
-		$action['controller'] = $action['uses'];
373
+        $action['controller'] = $action['uses'];
374 374
 		
375
-		return $action;
376
-	}
375
+        return $action;
376
+    }
377 377
 	
378
-	/**
379
-	 * Prepend the last group namespaces onto the use clause.
380
-	 * 
381
-	 * @param  string  $class
382
-	 * 
383
-	 * @return string
384
-	 */
385
-	protected function prependGroupNamespace($class): string
386
-	{
387
-		$group = end($this->groupStack);
378
+    /**
379
+     * Prepend the last group namespaces onto the use clause.
380
+     * 
381
+     * @param  string  $class
382
+     * 
383
+     * @return string
384
+     */
385
+    protected function prependGroupNamespace($class): string
386
+    {
387
+        $group = end($this->groupStack);
388 388
 		
389
-		return isset($group['namespace']) && ! Str::startsWith($class, '\\') && ! Str::startsWith($class, $group['namespace']) 
390
-		            ? $group['namespace'].'\\'.$class 
391
-					: $class;
392
-	}
389
+        return isset($group['namespace']) && ! Str::startsWith($class, '\\') && ! Str::startsWith($class, $group['namespace']) 
390
+                    ? $group['namespace'].'\\'.$class 
391
+                    : $class;
392
+    }
393 393
 	
394
-	/**
395
-	 * Prepend the last group controller onto the use clause.
396
-	 * 
397
-	 * @param  string  $class
398
-	 * 
399
-	 * @return string
400
-	 */
401
-	protected function prependGroupController($class): string
402
-	{
403
-		$group = end($this->groupStack);
394
+    /**
395
+     * Prepend the last group controller onto the use clause.
396
+     * 
397
+     * @param  string  $class
398
+     * 
399
+     * @return string
400
+     */
401
+    protected function prependGroupController($class): string
402
+    {
403
+        $group = end($this->groupStack);
404 404
 		
405
-		if ( ! isset($group['controller'])) {
406
-			return $class;
407
-		}
405
+        if ( ! isset($group['controller'])) {
406
+            return $class;
407
+        }
408 408
 		
409
-		if (class_exists($class)) {
410
-			return $class;
411
-		}
409
+        if (class_exists($class)) {
410
+            return $class;
411
+        }
412 412
 		
413
-		if (Str::contains($class, '@')) {
414
-			return $class;
415
-		}
413
+        if (Str::contains($class, '@')) {
414
+            return $class;
415
+        }
416 416
 		
417
-		return $group['controller'].'@'.$class;
418
-	}
419
-
420
-	/**
421
-	 * Create a new Route object.
422
-	 * 
423
-	 * @param  array|string  $method
424
-	 * @param  string  $uri
425
-	 * @param  mixed  $action
426
-	 * 
427
-	 * @return \Syscodes\Components\Routing\Route
428
-	 */
429
-	public function newRoute($method, $uri, $action): route
430
-	{
431
-		return take(new Route($method, $uri, $action))
432
-		                ->setContainer($this->container);
433
-	}
417
+        return $group['controller'].'@'.$class;
418
+    }
419
+
420
+    /**
421
+     * Create a new Route object.
422
+     * 
423
+     * @param  array|string  $method
424
+     * @param  string  $uri
425
+     * @param  mixed  $action
426
+     * 
427
+     * @return \Syscodes\Components\Routing\Route
428
+     */
429
+    public function newRoute($method, $uri, $action): route
430
+    {
431
+        return take(new Route($method, $uri, $action))
432
+                        ->setContainer($this->container);
433
+    }
434 434
 	
435
-	/**
436
-	 * Determine if the router currently has a group stack.
437
-	 * 
438
-	 * @return bool
439
-	 */
440
-	public function hasGroupStack(): bool
441
-	{
442
-		return ! empty($this->groupStack);
443
-	}
435
+    /**
436
+     * Determine if the router currently has a group stack.
437
+     * 
438
+     * @return bool
439
+     */
440
+    public function hasGroupStack(): bool
441
+    {
442
+        return ! empty($this->groupStack);
443
+    }
444 444
 	
445
-	/**
446
-	 * Merge the group stack with the controller action.
447
-	 * 
448
-	 * @param  \Syscpde\Routing\Route  $route
449
-	 * 
450
-	 * @return void
451
-	 */
452
-	protected function mergeGroupAttributesIntoRoute($route): void
453
-	{
454
-		$action = $this->mergeLastGroup(
455
-			$route->getAction(),
456
-			$existsPrefix = false
457
-		);
445
+    /**
446
+     * Merge the group stack with the controller action.
447
+     * 
448
+     * @param  \Syscpde\Routing\Route  $route
449
+     * 
450
+     * @return void
451
+     */
452
+    protected function mergeGroupAttributesIntoRoute($route): void
453
+    {
454
+        $action = $this->mergeLastGroup(
455
+            $route->getAction(),
456
+            $existsPrefix = false
457
+        );
458 458
 		
459
-		$route->setAction($action);
460
-	}
459
+        $route->setAction($action);
460
+    }
461 461
 	
462
-	/**
463
-	 * Add the necessary where clauses to the route based on its initial registration.
464
-	 * 
465
-	 * @param  \Syscodes\Components\Routing\Route  $route
466
-	 * 
467
-	 * @return \Syscodes\Components\Routing\Route
468
-	 */
469
-	protected function addWhereClausesToRoute($route): Route
470
-	{
471
-		$route->where(array_merge(
472
-			$this->patterns, Arr::get($route->getAction(), 'where', [])
473
-		));
474
-
475
-		return $route;
476
-	}
477
-
478
-	/**
479
-	 * Add a prefix to the route URI.
480
-	 *
481
-	 * @param  string  $uri
482
-	 *
483
-	 * @return string
484
-	 */
485
-	protected function prefix($uri): string
486
-	{
487
-		return trim(trim($this->getGroupPrefix(), '/').'/'.trim($uri, '/'), '/') ?: '/';
488
-	}
489
-
490
-	/**
491
-	 * Set a global where pattern on all routes.
492
-	 * 
493
-	 * @param  string  $name
494
-	 * @param  string  $pattern
495
-	 * 
496
-	 * @return void
497
-	 */
498
-	public function pattern($name, $pattern): void
499
-	{
500
-		$this->patterns[$name] = $pattern;
501
-	}
502
-
503
-	/**
504
-	 * Set a group of global where patterns on all routes.
505
-	 * 
506
-	 * @param  array  $patterns
507
-	 * 
508
-	 * @return void
509
-	 */
510
-	public function patterns($patterns): void
511
-	{
512
-		foreach ($patterns as $key => $pattern) {
513
-			$this->patterns[$key] = $pattern;
514
-		}
515
-	}
516
-
517
-	/**
518
-	 * Get a Resource instance.
519
-	 * 
520
-	 * @return \Syscodes\Components\Routing\ResourceRegister
521
-	 */
522
-	public function getResource()
523
-	{
524
-		if (isset($this->resources)) {
525
-			return $this->resources;
526
-		}
527
-
528
-		return $this->resources = new ResourceRegister($this);
529
-	}
530
-
531
-	/**
532
-	 * Dispatches the given url and call the method that belongs to the route.
533
-	 *
534
-	 * @param  \Syscodes\Components\Http\Request  $request
535
-	 *
536
-	 * @return mixed
537
-	 */
538
-	public function dispatch(Request $request)
539
-	{
540
-		return $this->resolves->resolve($request);
541
-	}
542
-
543
-	/**
544
-	 * Gather the middleware for the given route.
545
-	 * 
546
-	 * @param  \Syscodes\Components\Routing\Route  $route
547
-	 * 
548
-	 * @return array
549
-	 */
550
-	public function gatherRouteMiddleware(Route $route): array
551
-	{
552
-		$middleware = array_map(
553
-		                    fn ($name) => MiddlewareResolver::resolve($name, $this->middleware, $this->middlewareGroups),
554
-		                    $route->gatherMiddleware()
555
-		              );
462
+    /**
463
+     * Add the necessary where clauses to the route based on its initial registration.
464
+     * 
465
+     * @param  \Syscodes\Components\Routing\Route  $route
466
+     * 
467
+     * @return \Syscodes\Components\Routing\Route
468
+     */
469
+    protected function addWhereClausesToRoute($route): Route
470
+    {
471
+        $route->where(array_merge(
472
+            $this->patterns, Arr::get($route->getAction(), 'where', [])
473
+        ));
474
+
475
+        return $route;
476
+    }
477
+
478
+    /**
479
+     * Add a prefix to the route URI.
480
+     *
481
+     * @param  string  $uri
482
+     *
483
+     * @return string
484
+     */
485
+    protected function prefix($uri): string
486
+    {
487
+        return trim(trim($this->getGroupPrefix(), '/').'/'.trim($uri, '/'), '/') ?: '/';
488
+    }
489
+
490
+    /**
491
+     * Set a global where pattern on all routes.
492
+     * 
493
+     * @param  string  $name
494
+     * @param  string  $pattern
495
+     * 
496
+     * @return void
497
+     */
498
+    public function pattern($name, $pattern): void
499
+    {
500
+        $this->patterns[$name] = $pattern;
501
+    }
502
+
503
+    /**
504
+     * Set a group of global where patterns on all routes.
505
+     * 
506
+     * @param  array  $patterns
507
+     * 
508
+     * @return void
509
+     */
510
+    public function patterns($patterns): void
511
+    {
512
+        foreach ($patterns as $key => $pattern) {
513
+            $this->patterns[$key] = $pattern;
514
+        }
515
+    }
516
+
517
+    /**
518
+     * Get a Resource instance.
519
+     * 
520
+     * @return \Syscodes\Components\Routing\ResourceRegister
521
+     */
522
+    public function getResource()
523
+    {
524
+        if (isset($this->resources)) {
525
+            return $this->resources;
526
+        }
527
+
528
+        return $this->resources = new ResourceRegister($this);
529
+    }
530
+
531
+    /**
532
+     * Dispatches the given url and call the method that belongs to the route.
533
+     *
534
+     * @param  \Syscodes\Components\Http\Request  $request
535
+     *
536
+     * @return mixed
537
+     */
538
+    public function dispatch(Request $request)
539
+    {
540
+        return $this->resolves->resolve($request);
541
+    }
542
+
543
+    /**
544
+     * Gather the middleware for the given route.
545
+     * 
546
+     * @param  \Syscodes\Components\Routing\Route  $route
547
+     * 
548
+     * @return array
549
+     */
550
+    public function gatherRouteMiddleware(Route $route): array
551
+    {
552
+        $middleware = array_map(
553
+                            fn ($name) => MiddlewareResolver::resolve($name, $this->middleware, $this->middlewareGroups),
554
+                            $route->gatherMiddleware()
555
+                        );
556 556
 		
557
-		return Arr::flatten($middleware);
558
-	}
559
-
560
-	/**
561
-	 * Get all of the defined middleware
562
-	 * 
563
-	 * @return array
564
-	 */
565
-	public function getMiddleware(): array
566
-	{
567
-		return $this->middleware;
568
-	}
569
-
570
-	/**
571
-	 * Register a short-hand name for a middleware.
572
-	 * 
573
-	 * @param  string  $name
574
-	 * @param  string  $class
575
-	 * 
576
-	 * @return static
577
-	 */
578
-	public function aliasMiddleware($name, $class): static
579
-	{
580
-		$this->middleware[$name] = $class;
581
-
582
-		return $this;
583
-	}
584
-
585
-	/**
586
-	 * Register a group of middleware.
587
-	 * 
588
-	 * @param  string  $name
589
-	 * @param  array  $middleware
590
-	 * 
591
-	 * @return static
592
-	 */
593
-	public function middlewareGroup($name, array $middleware): static
594
-	{
595
-		$this->middlewareGroups[$name] = $middleware;
596
-
597
-		return $this;
598
-	}
599
-
600
-	/**
601
-	 * Check if a route with the given name exists.
602
-	 * 
603
-	 * @param  string  $name
604
-	 * 
605
-	 * @return bool
606
-	 */
607
-	public function has($name): bool
608
-	{
609
-		$names = is_array($name) ? $name : func_get_args();
610
-
611
-		foreach ($names as $value) {
612
-			if ( ! $this->routes->hasNamedRoute($value)) {
613
-				return false;
614
-			}
615
-		}
616
-
617
-		return true;
618
-	}
619
-
620
-	/**
621
-	 * Determine if the current route matches a pattern.
622
-	 * 
623
-	 * @param  mixed  ...$patterns
624
-	 * 
625
-	 * @return bool
626
-	 */
627
-	public function is(...$patterns): bool
628
-	{
629
-		return $this->currentRouteNamed(...$patterns);
630
-	}
631
-
632
-	/**
633
-	 * Determine if the current route matches a pattern.
634
-	 * 
635
-	 * @param  mixed  ...$patterns
636
-	 * 
637
-	 * @return bool
638
-	 */
639
-	public function currentRouteNamed(...$patterns): bool
640
-	{
641
-		return $this->resolves->current() && $this->resolves->current()->named(...$patterns);
642
-	}
643
-
644
-	/**
645
-	 * Register an array of resource controllers.
646
-	 * 
647
-	 * @param  array  $resources
648
-	 * @param  array  $options
649
-	 * 
650
-	 * @return void
651
-	 */
652
-	public function resources(array $resources, array $options = []): void
653
-	{
654
-		foreach ($resources as $name => $controller) {
655
-			$this->resource($name, $controller, $options);
656
-		}
657
-	}
658
-
659
-	/**
660
-	 * Route a resource to a controller.
661
-	 * 
662
-	 * @param  string  $name
663
-	 * @param  string  $controller
664
-	 * @param  array  $options
665
-	 * 
666
-	 * @return \Syscodes\Components\Routing\Resources\AwaitingResourceRegistration
667
-	 */
668
-	public function resource($name, $controller, array $options = []) 
669
-	{
670
-		if ($this->container) {
671
-			$register = $this->container->make(ResourceRegister::class);
672
-		} else {
673
-			$register = new ResourceRegister($this);
674
-		}
675
-
676
-		return new AwaitingResourceRegistration(
677
-			$register, $name, $controller, $options
678
-		);
679
-	}
680
-
681
-	/**
682
-	 * Get the route collection.
683
-	 *
684
-	 * @return array   
685
-	 */
686
-	public function getRoutes()
687
-	{
688
-		return $this->routes;
689
-	}
690
-
691
-	/**
692
-	 * Get or set the verbs used in the resource URIs.
693
-	 * 
694
-	 * @param  array  $verbs
695
-	 * 
696
-	 * @return array|null
697
-	 */
698
-	public function resourceVerbs(array $verbs = [])
699
-	{
700
-		ResourceRegister::verbs($verbs);
701
-	}
557
+        return Arr::flatten($middleware);
558
+    }
559
+
560
+    /**
561
+     * Get all of the defined middleware
562
+     * 
563
+     * @return array
564
+     */
565
+    public function getMiddleware(): array
566
+    {
567
+        return $this->middleware;
568
+    }
569
+
570
+    /**
571
+     * Register a short-hand name for a middleware.
572
+     * 
573
+     * @param  string  $name
574
+     * @param  string  $class
575
+     * 
576
+     * @return static
577
+     */
578
+    public function aliasMiddleware($name, $class): static
579
+    {
580
+        $this->middleware[$name] = $class;
581
+
582
+        return $this;
583
+    }
584
+
585
+    /**
586
+     * Register a group of middleware.
587
+     * 
588
+     * @param  string  $name
589
+     * @param  array  $middleware
590
+     * 
591
+     * @return static
592
+     */
593
+    public function middlewareGroup($name, array $middleware): static
594
+    {
595
+        $this->middlewareGroups[$name] = $middleware;
596
+
597
+        return $this;
598
+    }
599
+
600
+    /**
601
+     * Check if a route with the given name exists.
602
+     * 
603
+     * @param  string  $name
604
+     * 
605
+     * @return bool
606
+     */
607
+    public function has($name): bool
608
+    {
609
+        $names = is_array($name) ? $name : func_get_args();
610
+
611
+        foreach ($names as $value) {
612
+            if ( ! $this->routes->hasNamedRoute($value)) {
613
+                return false;
614
+            }
615
+        }
616
+
617
+        return true;
618
+    }
619
+
620
+    /**
621
+     * Determine if the current route matches a pattern.
622
+     * 
623
+     * @param  mixed  ...$patterns
624
+     * 
625
+     * @return bool
626
+     */
627
+    public function is(...$patterns): bool
628
+    {
629
+        return $this->currentRouteNamed(...$patterns);
630
+    }
631
+
632
+    /**
633
+     * Determine if the current route matches a pattern.
634
+     * 
635
+     * @param  mixed  ...$patterns
636
+     * 
637
+     * @return bool
638
+     */
639
+    public function currentRouteNamed(...$patterns): bool
640
+    {
641
+        return $this->resolves->current() && $this->resolves->current()->named(...$patterns);
642
+    }
643
+
644
+    /**
645
+     * Register an array of resource controllers.
646
+     * 
647
+     * @param  array  $resources
648
+     * @param  array  $options
649
+     * 
650
+     * @return void
651
+     */
652
+    public function resources(array $resources, array $options = []): void
653
+    {
654
+        foreach ($resources as $name => $controller) {
655
+            $this->resource($name, $controller, $options);
656
+        }
657
+    }
658
+
659
+    /**
660
+     * Route a resource to a controller.
661
+     * 
662
+     * @param  string  $name
663
+     * @param  string  $controller
664
+     * @param  array  $options
665
+     * 
666
+     * @return \Syscodes\Components\Routing\Resources\AwaitingResourceRegistration
667
+     */
668
+    public function resource($name, $controller, array $options = []) 
669
+    {
670
+        if ($this->container) {
671
+            $register = $this->container->make(ResourceRegister::class);
672
+        } else {
673
+            $register = new ResourceRegister($this);
674
+        }
675
+
676
+        return new AwaitingResourceRegistration(
677
+            $register, $name, $controller, $options
678
+        );
679
+    }
680
+
681
+    /**
682
+     * Get the route collection.
683
+     *
684
+     * @return array   
685
+     */
686
+    public function getRoutes()
687
+    {
688
+        return $this->routes;
689
+    }
690
+
691
+    /**
692
+     * Get or set the verbs used in the resource URIs.
693
+     * 
694
+     * @param  array  $verbs
695
+     * 
696
+     * @return array|null
697
+     */
698
+    public function resourceVerbs(array $verbs = [])
699
+    {
700
+        ResourceRegister::verbs($verbs);
701
+    }
702 702
 	
703
-	/**
704
-	 * Remove any duplicate middleware from the given array.
705
-	 * 
706
-	 * @param  array  $middleware
707
-	 * 
708
-	 * @return array
709
-	 */
710
-	public static function uniqueMiddleware(array $middleware): array
711
-	{
712
-		return array_unique($middleware, SORT_REGULAR);
713
-	}
714
-
715
-	/**
716
-	 * Magic method.
717
-	 * 
718
-	 * Dynamically handle calls into the router instance.
719
-	 * 
720
-	 * @param  string  $method
721
-	 * @param  array  $parameters
722
-	 * 
723
-	 * @return mixed
724
-	 */
725
-	public function __call($method, $parameters)
726
-	{
727
-		if (static::hasMacro($method)) {
728
-			return $this->macroCall($method, $parameters);
729
-		}
703
+    /**
704
+     * Remove any duplicate middleware from the given array.
705
+     * 
706
+     * @param  array  $middleware
707
+     * 
708
+     * @return array
709
+     */
710
+    public static function uniqueMiddleware(array $middleware): array
711
+    {
712
+        return array_unique($middleware, SORT_REGULAR);
713
+    }
714
+
715
+    /**
716
+     * Magic method.
717
+     * 
718
+     * Dynamically handle calls into the router instance.
719
+     * 
720
+     * @param  string  $method
721
+     * @param  array  $parameters
722
+     * 
723
+     * @return mixed
724
+     */
725
+    public function __call($method, $parameters)
726
+    {
727
+        if (static::hasMacro($method)) {
728
+            return $this->macroCall($method, $parameters);
729
+        }
730 730
 		
731
-		return (new RouteRegister($this))->attribute($method, $parameters[0]);
732
-	}
731
+        return (new RouteRegister($this))->attribute($method, $parameters[0]);
732
+    }
733 733
 }
734 734
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Http/Loaders/Parameters.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -34,160 +34,160 @@
 block discarded – undo
34 34
  */
35 35
 class Parameters implements IteratorAggregate, Countable
36 36
 {
37
-	/**
38
-	 * Array parameters from the Server global.
39
-	 *
40
-	 * @var array $parameters
41
-	 */
42
-	protected $parameters;
43
-
44
-	/**
45
-	 * Parameter Object Constructor.
46
-	 *
47
-	 * @param  array  $parameters
48
-	 *
49
-	 * @return array
50
-	 */
51
-	public function __construct(array $parameters = [])
52
-	{
53
-		$this->parameters = $parameters;
54
-	}
55
-
56
-	/**
57
-	 * Returns the parameters.
58
-	 * 
59
-	 * @param  string|null  $key
60
-	 * 
61
-	 * @return array
62
-	 */
63
-	public function all(string $key = null): array
64
-	{
65
-		if (null === $key) {
66
-			return $this->parameters;
67
-		}
68
-
69
-		if ( ! is_array($value = $this->parameters[$key] ?? [])) {
70
-			throw new BadRequestException(
71
-				sprintf('Unexpected value for parameter "%s", got "%s"', $key, get_debug_type($value))
72
-			);
73
-		}
74
-
75
-		return $value;
76
-	}
77
-
78
-	/**
79
-	 * Returns the parameter keys.
80
-	 * 
81
-	 * @return array
82
-	 */
83
-	public function keys(): array
84
-	{
85
-		return array_keys($this->parameters);
86
-	}
87
-
88
-	/**
89
-	 * Replaces the current parameters.
90
-	 * 
91
-	 * @param  array  $parameters
92
-	 * 
93
-	 * @return void
94
-	 */
95
-	public function replace(array $parameters = []): void
96
-	{
97
-		$this->parameters = $parameters;
98
-	}
99
-
100
-	/**
101
-	 * Adds parameters.
102
-	 * 
103
-	 * @param  array  $parameters
104
-	 * 
105
-	 * @return void
106
-	 */
107
-	public function add(array $parameters = []): void
108
-	{
109
-		$this->parameters = array_replace($this->parameters, $parameters);
110
-	}
111
-
112
-	/**
113
-	 * Get a parameter array item.
114
-	 *
115
-	 * @param  string  $key
116
-	 * @param  mixed  $default  
117
-	 *
118
-	 * @return mixed
119
-	 */
120
-	public function get(string $key, mixed $default = null): mixed
121
-	{
122
-		return $this->has($key) ? $this->parameters[$key] : $default;
123
-	}
124
-
125
-	/**
126
-	 * Check if a parameter array item exists.
127
-	 *
128
-	 * @param  string  $key
129
-	 *
130
-	 * @return bool
131
-	 */
132
-	public function has(string $key): bool
133
-	{
134
-		return Arr::exists($this->parameters, $key);
135
-	}
136
-
137
-	/**
138
-	 * Set a parameter array item.
139
-	 *
140
-	 * @param  string  $key
141
-	 * @param  string  $value 
142
-	 *
143
-	 * @return void
144
-	 */
145
-	public function set(string $key, $value): void
146
-	{
147
-		$this->parameters[$key] = $value;
148
-	}
149
-
150
-	/**
151
-	 * Remove a parameter array item.
152
-	 *
153
-	 * @param  string  $key 
154
-	 *
155
-	 * @return void
156
-	 */
157
-	public function remove(string $key): void
158
-	{
159
-		unset($this->parameters[$key]);
160
-	}
161
-
162
-	/*
37
+    /**
38
+     * Array parameters from the Server global.
39
+     *
40
+     * @var array $parameters
41
+     */
42
+    protected $parameters;
43
+
44
+    /**
45
+     * Parameter Object Constructor.
46
+     *
47
+     * @param  array  $parameters
48
+     *
49
+     * @return array
50
+     */
51
+    public function __construct(array $parameters = [])
52
+    {
53
+        $this->parameters = $parameters;
54
+    }
55
+
56
+    /**
57
+     * Returns the parameters.
58
+     * 
59
+     * @param  string|null  $key
60
+     * 
61
+     * @return array
62
+     */
63
+    public function all(string $key = null): array
64
+    {
65
+        if (null === $key) {
66
+            return $this->parameters;
67
+        }
68
+
69
+        if ( ! is_array($value = $this->parameters[$key] ?? [])) {
70
+            throw new BadRequestException(
71
+                sprintf('Unexpected value for parameter "%s", got "%s"', $key, get_debug_type($value))
72
+            );
73
+        }
74
+
75
+        return $value;
76
+    }
77
+
78
+    /**
79
+     * Returns the parameter keys.
80
+     * 
81
+     * @return array
82
+     */
83
+    public function keys(): array
84
+    {
85
+        return array_keys($this->parameters);
86
+    }
87
+
88
+    /**
89
+     * Replaces the current parameters.
90
+     * 
91
+     * @param  array  $parameters
92
+     * 
93
+     * @return void
94
+     */
95
+    public function replace(array $parameters = []): void
96
+    {
97
+        $this->parameters = $parameters;
98
+    }
99
+
100
+    /**
101
+     * Adds parameters.
102
+     * 
103
+     * @param  array  $parameters
104
+     * 
105
+     * @return void
106
+     */
107
+    public function add(array $parameters = []): void
108
+    {
109
+        $this->parameters = array_replace($this->parameters, $parameters);
110
+    }
111
+
112
+    /**
113
+     * Get a parameter array item.
114
+     *
115
+     * @param  string  $key
116
+     * @param  mixed  $default  
117
+     *
118
+     * @return mixed
119
+     */
120
+    public function get(string $key, mixed $default = null): mixed
121
+    {
122
+        return $this->has($key) ? $this->parameters[$key] : $default;
123
+    }
124
+
125
+    /**
126
+     * Check if a parameter array item exists.
127
+     *
128
+     * @param  string  $key
129
+     *
130
+     * @return bool
131
+     */
132
+    public function has(string $key): bool
133
+    {
134
+        return Arr::exists($this->parameters, $key);
135
+    }
136
+
137
+    /**
138
+     * Set a parameter array item.
139
+     *
140
+     * @param  string  $key
141
+     * @param  string  $value 
142
+     *
143
+     * @return void
144
+     */
145
+    public function set(string $key, $value): void
146
+    {
147
+        $this->parameters[$key] = $value;
148
+    }
149
+
150
+    /**
151
+     * Remove a parameter array item.
152
+     *
153
+     * @param  string  $key 
154
+     *
155
+     * @return void
156
+     */
157
+    public function remove(string $key): void
158
+    {
159
+        unset($this->parameters[$key]);
160
+    }
161
+
162
+    /*
163 163
 	|-----------------------------------------------------------------
164 164
 	| IteratorAggregate Method
165 165
 	|-----------------------------------------------------------------
166 166
 	*/
167 167
 	
168
-	/**
169
-	 * Retrieve an external iterator.
170
-	 * 
171
-	 * @return \ArrayIterator
172
-	 */
173
-	public function getIterator(): Traversable
174
-	{
175
-		return new ArrayIterator($this->parameters);
176
-	}
168
+    /**
169
+     * Retrieve an external iterator.
170
+     * 
171
+     * @return \ArrayIterator
172
+     */
173
+    public function getIterator(): Traversable
174
+    {
175
+        return new ArrayIterator($this->parameters);
176
+    }
177 177
 	
178
-	/*
178
+    /*
179 179
 	|-----------------------------------------------------------------
180 180
 	| Countable Method
181 181
 	|-----------------------------------------------------------------
182 182
 	*/
183 183
 	
184
-	/**
185
-	 * Returns the number of parameters.
186
-	 * 
187
-	 * @return int The number of parameters
188
-	 */
189
-	public function count(): int
190
-	{
191
-		return count($this->parameters);
192
-	}
184
+    /**
185
+     * Returns the number of parameters.
186
+     * 
187
+     * @return int The number of parameters
188
+     */
189
+    public function count(): int
190
+    {
191
+        return count($this->parameters);
192
+    }
193 193
 }
194 194
\ No newline at end of file
Please login to merge, or discard this patch.