Passed
Push — 0.7.0 ( d23ad8...f7e7ba )
by Alexander
02:48 queued 11s
created
src/components/Database/Query/Processors/SqlServerProcessor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public function processColumnListing($results)
43 43
     {
44
-        return array_map(function ($result) {
44
+        return array_map(function($result) {
45 45
             return ((object) $result)->column_name;
46 46
         }, $results);
47 47
     }
Please login to merge, or discard this patch.
src/components/Database/Query/Processors/SQLiteProcessor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public function accessColumnListing($results)
43 43
     {
44
-        return array_map(function ($result) {
44
+        return array_map(function($result) {
45 45
             return ((object) $result)->column_name;
46 46
         }, $results);
47 47
     }
Please login to merge, or discard this patch.
src/components/Database/Connectors/PostgresConnector.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -66,13 +66,13 @@
 block discarded – undo
66 66
         return $connection;
67 67
     }
68 68
 
69
-     /**
70
-     * Create a DSN string from a configuration.
71
-     * 
72
-     * @param  array  $config
73
-     * 
74
-     * @return string
75
-     */
69
+        /**
70
+         * Create a DSN string from a configuration.
71
+         * 
72
+         * @param  array  $config
73
+         * 
74
+         * @return string
75
+         */
76 76
     protected function getDsn(array $config)
77 77
     {
78 78
         extract($config, EXTR_SKIP);
Please login to merge, or discard this patch.
src/components/Routing/RouteFileRegister.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,6 @@
 block discarded – undo
41 41
      * Create a new route file registrar instance.
42 42
      *
43 43
      * @param  \Syscodes\Routing\Router  $router
44
-
45 44
      * @return void
46 45
      */
47 46
     public function __construct(Router $router)
Please login to merge, or discard this patch.
src/components/Routing/RoutingServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function registerRouter()
55 55
     {
56
-        $this->app->singleton('router', function ($app) {
56
+        $this->app->singleton('router', function($app) {
57 57
             return new Router($app);
58 58
         });
59 59
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     protected function registerUrlGenerator()
79 79
     {
80
-        $this->app->singleton('url', function ($app) {
80
+        $this->app->singleton('url', function($app) {
81 81
             
82 82
             $routes = $app['router']->getRoutes();
83 83
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     protected function registerRedirector()
95 95
     {
96
-        $this->app->singleton('redirect', function ($app) {
96
+        $this->app->singleton('redirect', function($app) {
97 97
             return new Redirector($app['url']);
98 98
         });
99 99
     }
Please login to merge, or discard this patch.
src/components/Routing/Route.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 	* @var array $patterns 
100 100
 	*/
101 101
 	public $patterns = [
102
-		'~/~'                    =>  '\/',               // Slash
103
-		'~{an:[^\/{}]+}~'        => '([0-9a-zA-Z]++)',   // Placeholder accepts alphabetic and numeric chars
104
-		'~{n:[^\/{}]+}~'         => '([0-9]++)',         // Placeholder accepts only numeric
105
-		'~{a:[^\/{}]+}~'         => '([a-zA-Z]++)',      // Placeholder accepts only alphabetic chars
102
+		'~/~'                    =>  '\/', // Slash
103
+		'~{an:[^\/{}]+}~'        => '([0-9a-zA-Z]++)', // Placeholder accepts alphabetic and numeric chars
104
+		'~{n:[^\/{}]+}~'         => '([0-9]++)', // Placeholder accepts only numeric
105
+		'~{a:[^\/{}]+}~'         => '([a-zA-Z]++)', // Placeholder accepts only alphabetic chars
106 106
 		'~{w:[^\/{}]+}~'         => '([0-9a-zA-Z-_]++)', // Placeholder accepts alphanumeric and underscore
107
-		'~{\*:[^\/{}]+}~'        => '(.++)',             // Placeholder match rest of url
108
-		'~(\\\/)?{\?:[^\/{}]+}~' => '\/?([^\/]*)',		 // Optional placeholder
107
+		'~{\*:[^\/{}]+}~'        => '(.++)', // Placeholder match rest of url
108
+		'~(\\\/)?{\?:[^\/{}]+}~' => '\/?([^\/]*)', // Optional placeholder
109 109
 		'~{[^\/{}]+}~'           => '([^\/]++)'			 // Normal placeholder
110 110
 	];
111 111
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	{
609 609
 		preg_match_all('~[^\/\{(.*?)\}]~', $this->domain().$this->uri, $matches);
610 610
 
611
-		return array_map(function ($match) {
611
+		return array_map(function($match) {
612 612
 			return trim($match, '?');
613 613
 		}, $matches[0]);
614 614
 	}
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 */
649 649
 	public function parametersWithouNulls()
650 650
 	{
651
-		return array_filter($this->parameters(), function ($parameter) {
651
+		return array_filter($this->parameters(), function($parameter) {
652 652
 			return ! is_null($parameter);
653 653
 		});
654 654
 	}
Please login to merge, or discard this patch.
Indentation   +645 added lines, -645 removed lines patch added patch discarded remove patch
@@ -40,663 +40,663 @@
 block discarded – undo
40 40
  */
41 41
 class Route 
42 42
 {
43
-	use Concerns\RouteCondition,
44
-	    Concerns\RouteDependencyResolver;
43
+    use Concerns\RouteCondition,
44
+        Concerns\RouteDependencyResolver;
45 45
 	
46
-	/**
47
-	 * Action that the route will use when called.
48
-	 *
49
-	 * @var \Closure|string|array $action
50
-	 */
51
-	public $action;
52
-
53
-	/**
54
-	 * The container instance used by the route.
55
-	 * 
56
-	 * @var \Syscodes\Container\Container $container
57
-	 */
58
-	protected $container;
59
-
60
-	/**
61
-	 * The controller instance.
62
-	 * 
63
-	 * @var string $controller
64
-	 */
65
-	public $controller;
66
-
67
-	/**
68
-	 * The default values for the route.
69
-	 * 
70
-	 * @var array $defaults
71
-	 */
72
-	public $defaults = [];
73
-
74
-	/**
75
-	 * Variable of HTTP method.
76
-	 *  
77
-	 * @var array|string $method
78
-	 */
79
-	public $method;
80
-
81
-	/**
82
-	 * The array of matched parameters.
83
-	 * 
84
-	 * @var array $parameters
85
-	 */
86
-	public $parameters = [];
87
-
88
-	/**
89
-	 * The parameter names for the route.
90
-	 * 
91
-	 * @var string|null $parameterNames
92
-	 */
93
-	public $parameterNames;
94
-
95
-	/**
96
-	* Patterns that should be replaced.
97
-	*
98
-	* @var array $patterns 
99
-	*/
100
-	public $patterns = [
101
-		'~/~'                    =>  '\/',               // Slash
102
-		'~{an:[^\/{}]+}~'        => '([0-9a-zA-Z]++)',   // Placeholder accepts alphabetic and numeric chars
103
-		'~{n:[^\/{}]+}~'         => '([0-9]++)',         // Placeholder accepts only numeric
104
-		'~{a:[^\/{}]+}~'         => '([a-zA-Z]++)',      // Placeholder accepts only alphabetic chars
105
-		'~{w:[^\/{}]+}~'         => '([0-9a-zA-Z-_]++)', // Placeholder accepts alphanumeric and underscore
106
-		'~{\*:[^\/{}]+}~'        => '(.++)',             // Placeholder match rest of url
107
-		'~(\\\/)?{\?:[^\/{}]+}~' => '\/?([^\/]*)',		 // Optional placeholder
108
-		'~{[^\/{}]+}~'           => '([^\/]++)'			 // Normal placeholder
109
-	];
110
-
111
-	/**
112
-	 * The URI pattern the route responds to.
113
-	 *
114
-	 * @var array $uri
115
-	 */
116
-	public $uri = [];
117
-
118
-	/**
119
-	 * Contains the arguments of the current route.
120
-	 *
121
-	 * @var array $where
122
-	 */
123
-	public $wheres = [];
124
-
125
-	/**
126
-	 * Constructor. Initialize route.
127
-	 *
128
-	 * @param  array|string|null  $method  (null by default)
129
-	 * @param  string|null  $uri  (null by default)
130
-	 * @param  \Closure|string|null  $action  (null by default)
131
-	 *
132
-	 * @return void
133
-	 */
134
-	public function __construct($method = null, $uri = null, $action = null)
135
-	{
136
-		$this->uri = $uri;
137
-
138
-		// Set the method
139
-		$this->parseMethod($method);
140
-
141
-		// Set the action
142
-		$this->parseAction($action);
143
-
144
-		if (is_null($prefix = Arr::get($this->action, 'prefix'))) {
145
-			$this->prefix($prefix);
146
-		}
147
-	}
148
-
149
-	// Getters
150
-
151
-	/**
152
-	 * Get the action of the current route.
153
-	 *
154
-	 * @return \Closure|string
155
-	 */
156
-	public function getAction()
157
-	{
158
-		return $this->action;
159
-	}
160
-
161
-	/**
162
-	 * Get the arguments of the current route.
163
-	 *
164
-	 * @return string
165
-	 */
166
-	public function getArguments()
167
-	{
168
-		return $this->wheres;
169
-	}
170
-
171
-	/**
172
-	 * Get the controller instance for the route.
173
-	 * 
174
-	 * @return mixed
175
-	 */
176
-	public function getController()
177
-	{
178
-		if ( ! $this->controller) {
179
-			$class = $this->parseControllerCallback()[0];
46
+    /**
47
+     * Action that the route will use when called.
48
+     *
49
+     * @var \Closure|string|array $action
50
+     */
51
+    public $action;
52
+
53
+    /**
54
+     * The container instance used by the route.
55
+     * 
56
+     * @var \Syscodes\Container\Container $container
57
+     */
58
+    protected $container;
59
+
60
+    /**
61
+     * The controller instance.
62
+     * 
63
+     * @var string $controller
64
+     */
65
+    public $controller;
66
+
67
+    /**
68
+     * The default values for the route.
69
+     * 
70
+     * @var array $defaults
71
+     */
72
+    public $defaults = [];
73
+
74
+    /**
75
+     * Variable of HTTP method.
76
+     *  
77
+     * @var array|string $method
78
+     */
79
+    public $method;
80
+
81
+    /**
82
+     * The array of matched parameters.
83
+     * 
84
+     * @var array $parameters
85
+     */
86
+    public $parameters = [];
87
+
88
+    /**
89
+     * The parameter names for the route.
90
+     * 
91
+     * @var string|null $parameterNames
92
+     */
93
+    public $parameterNames;
94
+
95
+    /**
96
+     * Patterns that should be replaced.
97
+     *
98
+     * @var array $patterns 
99
+     */
100
+    public $patterns = [
101
+        '~/~'                    =>  '\/',               // Slash
102
+        '~{an:[^\/{}]+}~'        => '([0-9a-zA-Z]++)',   // Placeholder accepts alphabetic and numeric chars
103
+        '~{n:[^\/{}]+}~'         => '([0-9]++)',         // Placeholder accepts only numeric
104
+        '~{a:[^\/{}]+}~'         => '([a-zA-Z]++)',      // Placeholder accepts only alphabetic chars
105
+        '~{w:[^\/{}]+}~'         => '([0-9a-zA-Z-_]++)', // Placeholder accepts alphanumeric and underscore
106
+        '~{\*:[^\/{}]+}~'        => '(.++)',             // Placeholder match rest of url
107
+        '~(\\\/)?{\?:[^\/{}]+}~' => '\/?([^\/]*)',		 // Optional placeholder
108
+        '~{[^\/{}]+}~'           => '([^\/]++)'			 // Normal placeholder
109
+    ];
110
+
111
+    /**
112
+     * The URI pattern the route responds to.
113
+     *
114
+     * @var array $uri
115
+     */
116
+    public $uri = [];
117
+
118
+    /**
119
+     * Contains the arguments of the current route.
120
+     *
121
+     * @var array $where
122
+     */
123
+    public $wheres = [];
124
+
125
+    /**
126
+     * Constructor. Initialize route.
127
+     *
128
+     * @param  array|string|null  $method  (null by default)
129
+     * @param  string|null  $uri  (null by default)
130
+     * @param  \Closure|string|null  $action  (null by default)
131
+     *
132
+     * @return void
133
+     */
134
+    public function __construct($method = null, $uri = null, $action = null)
135
+    {
136
+        $this->uri = $uri;
137
+
138
+        // Set the method
139
+        $this->parseMethod($method);
140
+
141
+        // Set the action
142
+        $this->parseAction($action);
143
+
144
+        if (is_null($prefix = Arr::get($this->action, 'prefix'))) {
145
+            $this->prefix($prefix);
146
+        }
147
+    }
148
+
149
+    // Getters
150
+
151
+    /**
152
+     * Get the action of the current route.
153
+     *
154
+     * @return \Closure|string
155
+     */
156
+    public function getAction()
157
+    {
158
+        return $this->action;
159
+    }
160
+
161
+    /**
162
+     * Get the arguments of the current route.
163
+     *
164
+     * @return string
165
+     */
166
+    public function getArguments()
167
+    {
168
+        return $this->wheres;
169
+    }
170
+
171
+    /**
172
+     * Get the controller instance for the route.
173
+     * 
174
+     * @return mixed
175
+     */
176
+    public function getController()
177
+    {
178
+        if ( ! $this->controller) {
179
+            $class = $this->parseControllerCallback()[0];
180 180
  
181
-			$this->controller = $this->container->make(ltrim($class, '\\'));
182
-		}
183
-
184
-		return $this->controller;
185
-	}
186
-
187
-	/**
188
-	 * Get the controller method used for the route.
189
-	 * 
190
-	 * @return string
191
-	 */
192
-	public function getControllerMethod()
193
-	{
194
-		return $this->parseControllerCallback()[1];
195
-	}
196
-
197
-	/**
198
-	 * Get the request method of the current route.
199
-	 *
200
-	 * @return array
201
-	 */
202
-	public function getMethod()
203
-	{
204
-		return $this->method;
205
-	}
206
-
207
-	/**
208
-	 * Get the url of the current route.
209
-	 *
210
-	 * @return string
211
-	 */
212
-	public function getName()
213
-	{
214
-		return $this->action['as'] ?? null;
215
-	}
216
-
217
-	/**
218
-	 * Get the url of the current route.
219
-	 *
220
-	 * @return string
221
-	 */
222
-	public function getRoute()
223
-	{
224
-		return $this->uri;
225
-	}
226
-
227
-	/**
228
-	 * Get or set the domain for the route.
229
-	 * 
230
-	 * @param  string|null  $domain  (null by default)
231
-	 * 
232
-	 * @return $this
233
-	 */
234
-	public function domain($domain = null)
235
-	{
236
-		if (is_null($domain)) {
237
-			return $this->getDomain();
238
-		}
239
-
240
-		$this->action['domain'] = $this->parseRoute($domain);
241
-
242
-		return $this;
243
-	}
244
-
245
-	/**
246
-	 * Get the domain defined for the route.
247
-	 * 
248
-	 * @return string|null
249
-	 */
250
-	public function getDomain()
251
-	{
252
-		return isset($this->action['domain'])
253
-				? str_replace(['http://', 'https://'], '', $this->action['domain'])
254
-				: null;
255
-	}
256
-
257
-	/**
258
-	 * Parse the controller.
259
-	 * 
260
-	 * @return array
261
-	 */
262
-	public function parseControllerCallback()
263
-	{
264
-		return Str::parseCallback($this->action['uses']);
265
-	}
181
+            $this->controller = $this->container->make(ltrim($class, '\\'));
182
+        }
183
+
184
+        return $this->controller;
185
+    }
186
+
187
+    /**
188
+     * Get the controller method used for the route.
189
+     * 
190
+     * @return string
191
+     */
192
+    public function getControllerMethod()
193
+    {
194
+        return $this->parseControllerCallback()[1];
195
+    }
196
+
197
+    /**
198
+     * Get the request method of the current route.
199
+     *
200
+     * @return array
201
+     */
202
+    public function getMethod()
203
+    {
204
+        return $this->method;
205
+    }
206
+
207
+    /**
208
+     * Get the url of the current route.
209
+     *
210
+     * @return string
211
+     */
212
+    public function getName()
213
+    {
214
+        return $this->action['as'] ?? null;
215
+    }
216
+
217
+    /**
218
+     * Get the url of the current route.
219
+     *
220
+     * @return string
221
+     */
222
+    public function getRoute()
223
+    {
224
+        return $this->uri;
225
+    }
226
+
227
+    /**
228
+     * Get or set the domain for the route.
229
+     * 
230
+     * @param  string|null  $domain  (null by default)
231
+     * 
232
+     * @return $this
233
+     */
234
+    public function domain($domain = null)
235
+    {
236
+        if (is_null($domain)) {
237
+            return $this->getDomain();
238
+        }
239
+
240
+        $this->action['domain'] = $this->parseRoute($domain);
241
+
242
+        return $this;
243
+    }
244
+
245
+    /**
246
+     * Get the domain defined for the route.
247
+     * 
248
+     * @return string|null
249
+     */
250
+    public function getDomain()
251
+    {
252
+        return isset($this->action['domain'])
253
+                ? str_replace(['http://', 'https://'], '', $this->action['domain'])
254
+                : null;
255
+    }
256
+
257
+    /**
258
+     * Parse the controller.
259
+     * 
260
+     * @return array
261
+     */
262
+    public function parseControllerCallback()
263
+    {
264
+        return Str::parseCallback($this->action['uses']);
265
+    }
266 266
 	
267
-	/**
268
-	 * Checks whether the route's action is a controller.
269
-	 * 
270
-	 * @return bool
271
-	 */
272
-	public function isControllerAction()
273
-	{
274
-		return is_string($this->action['uses']);
275
-	}
276
-
277
-	/**
278
-	 * Get the dispatcher for the route's controller.
279
-	 * 
280
-	 * @return \Syscodes\Controller\ControllerDispatcher
281
-	 */
282
-	private function controllerDispatcher()
283
-	{
284
-		return new ControllerDispatcher($this->container);
285
-	}
286
-
287
-	// Setters
267
+    /**
268
+     * Checks whether the route's action is a controller.
269
+     * 
270
+     * @return bool
271
+     */
272
+    public function isControllerAction()
273
+    {
274
+        return is_string($this->action['uses']);
275
+    }
276
+
277
+    /**
278
+     * Get the dispatcher for the route's controller.
279
+     * 
280
+     * @return \Syscodes\Controller\ControllerDispatcher
281
+     */
282
+    private function controllerDispatcher()
283
+    {
284
+        return new ControllerDispatcher($this->container);
285
+    }
286
+
287
+    // Setters
288 288
 	
289
-	/**
290
-	 * Run the route action and return the response.
291
-	 * 
292
-	 * @return mixed
293
-	 */
294
-	public function runResolver()
295
-	{
296
-		$this->container = $this->container ?: new Container;
297
-
298
-		try {
299
-			if ($this->isControllerAction()) {
300
-				return $this->runResolverController();
301
-			}
302
-
303
-			return $this->runResolverCallable();
304
-		} catch (HttpResponseException $e) {
305
-			return $e->getResponse();
306
-		}
307
-	}
308
-
309
-	/**
310
-	 * Run the route action and return the response.
311
-	 *  
312
-	 * @return mixed
313
-	 */
314
-	protected function runResolverCallable()
315
-	{
316
-		$callable = $this->action['uses'];
317
-
318
-		return $callable(...array_values($this->resolveMethodDependencies(
319
-			$this->parametersWithouNulls(), new ReflectionFunction($this->action['uses'])
320
-		)));
321
-	}
322
-
323
-	/**
324
-	 * Run the route action and return the response.
325
-	 * 
326
-	 * @return mixed
327
-	 */
328
-	protected function runResolverController()
329
-	{
330
-		return $this->controllerDispatcher()->dispatch($this, $this->getController(), $this->getControllerMethod());
331
-	}
332
-
333
-	/**
334
-	 * Set the action.
335
-	 *
336
-	 * @param  \Closure|string  $action
337
-	 *
338
-	 * @return $this
339
-	 *
340
-	 * @throws \InvalidArgumentException
341
-	 */
342
-	public function parseAction($action)
343
-	{
344
-		if ( ! (is_object($action) && ($action instanceof Closure)) && ($action === null || $action === '')) {
345
-			throw new InvalidArgumentException(__('route.actionClosureOrFunction'));
346
-		}
347
-
348
-		$this->action = RouteAction::parse($this->uri, $action);
349
-
350
-		return $this;
351
-	}
352
-
353
-	/**
354
-	 * Set the method of the current route.
355
-	 *
356
-	 * @param  array  $method
357
-	 *
358
-	 * @return string $this
359
-	 * 
360
-	 * @throws \InvalidArgumentException
361
-	 */
362
-	public function parseMethod($method)
363
-	{
364
-		if ($method === null || ! is_array($method) || empty($method)) {
365
-			throw new InvalidArgumentException(__('route.methodNotProvided'));
289
+    /**
290
+     * Run the route action and return the response.
291
+     * 
292
+     * @return mixed
293
+     */
294
+    public function runResolver()
295
+    {
296
+        $this->container = $this->container ?: new Container;
297
+
298
+        try {
299
+            if ($this->isControllerAction()) {
300
+                return $this->runResolverController();
301
+            }
302
+
303
+            return $this->runResolverCallable();
304
+        } catch (HttpResponseException $e) {
305
+            return $e->getResponse();
306
+        }
307
+    }
308
+
309
+    /**
310
+     * Run the route action and return the response.
311
+     *  
312
+     * @return mixed
313
+     */
314
+    protected function runResolverCallable()
315
+    {
316
+        $callable = $this->action['uses'];
317
+
318
+        return $callable(...array_values($this->resolveMethodDependencies(
319
+            $this->parametersWithouNulls(), new ReflectionFunction($this->action['uses'])
320
+        )));
321
+    }
322
+
323
+    /**
324
+     * Run the route action and return the response.
325
+     * 
326
+     * @return mixed
327
+     */
328
+    protected function runResolverController()
329
+    {
330
+        return $this->controllerDispatcher()->dispatch($this, $this->getController(), $this->getControllerMethod());
331
+    }
332
+
333
+    /**
334
+     * Set the action.
335
+     *
336
+     * @param  \Closure|string  $action
337
+     *
338
+     * @return $this
339
+     *
340
+     * @throws \InvalidArgumentException
341
+     */
342
+    public function parseAction($action)
343
+    {
344
+        if ( ! (is_object($action) && ($action instanceof Closure)) && ($action === null || $action === '')) {
345
+            throw new InvalidArgumentException(__('route.actionClosureOrFunction'));
346
+        }
347
+
348
+        $this->action = RouteAction::parse($this->uri, $action);
349
+
350
+        return $this;
351
+    }
352
+
353
+    /**
354
+     * Set the method of the current route.
355
+     *
356
+     * @param  array  $method
357
+     *
358
+     * @return string $this
359
+     * 
360
+     * @throws \InvalidArgumentException
361
+     */
362
+    public function parseMethod($method)
363
+    {
364
+        if ($method === null || ! is_array($method) || empty($method)) {
365
+            throw new InvalidArgumentException(__('route.methodNotProvided'));
366 366
 			
367
-		}
368
-
369
-		foreach ($method as $httpMethod) {
370
-			if ( ! in_array($httpMethod, ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD', 'ANY'])) {
371
-				throw new InvalidArgumentException(__('route.methodNotAllowed'));				
372
-			}
373
-		}
374
-
375
-	    $this->method = $method;
376
-
377
-	    return $this;
378
-	}
379
-
380
-	/**
381
-	 * Set the route.
382
-	 *
383
-	 * @param  string  $uri
384
-	 *
385
-	 * @return string
386
-	 *
387
-	 * @throws  \InvalidArgumentException
388
-	 */
389
-	public function parseRoute($uri)
390
-	{
391
-		if ($uri === null) {
392
-			throw new InvalidArgumentException(__('route.uriNotProvided'));
393
-		}	
394
-
395
-		$this->uri = $this->parseRoutePath($uri);
396
-
397
-		return $this;
398
-	}
399
-
400
-	/**
401
-	 * Replace word patterns with regex in route uri.
402
-	 * 
403
-	 * @param  string  $uri
404
-	 * 
405
-	 * @return string
406
-	 */
407
-	protected function parseRoutePath($uri)
408
-	{
409
-		$uri = trim($uri, '\/?');
410
-		$uri = trim($uri, '\/');
367
+        }
368
+
369
+        foreach ($method as $httpMethod) {
370
+            if ( ! in_array($httpMethod, ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD', 'ANY'])) {
371
+                throw new InvalidArgumentException(__('route.methodNotAllowed'));				
372
+            }
373
+        }
374
+
375
+        $this->method = $method;
376
+
377
+        return $this;
378
+    }
379
+
380
+    /**
381
+     * Set the route.
382
+     *
383
+     * @param  string  $uri
384
+     *
385
+     * @return string
386
+     *
387
+     * @throws  \InvalidArgumentException
388
+     */
389
+    public function parseRoute($uri)
390
+    {
391
+        if ($uri === null) {
392
+            throw new InvalidArgumentException(__('route.uriNotProvided'));
393
+        }	
394
+
395
+        $this->uri = $this->parseRoutePath($uri);
396
+
397
+        return $this;
398
+    }
399
+
400
+    /**
401
+     * Replace word patterns with regex in route uri.
402
+     * 
403
+     * @param  string  $uri
404
+     * 
405
+     * @return string
406
+     */
407
+    protected function parseRoutePath($uri)
408
+    {
409
+        $uri = trim($uri, '\/?');
410
+        $uri = trim($uri, '\/');
411 411
 		
412
-		preg_match_all('/\{([\w\:]+?)\??\}/', $uri, $matches);
412
+        preg_match_all('/\{([\w\:]+?)\??\}/', $uri, $matches);
413 413
 		
414
-		foreach ($matches[1] as $match) {
415
-			if (strpos($match, ':') === false) {
416
-				continue;
417
-			}
414
+        foreach ($matches[1] as $match) {
415
+            if (strpos($match, ':') === false) {
416
+                continue;
417
+            }
418 418
 			
419
-			$pattern  = array_keys($this->patterns);
420
-			$replace  = array_values($this->patterns);
421
-			$segments = explode(':', trim($match, '{}?'));
419
+            $pattern  = array_keys($this->patterns);
420
+            $replace  = array_values($this->patterns);
421
+            $segments = explode(':', trim($match, '{}?'));
422 422
 			
423
-			$uri = strpos($match, ':') !== false
424
-					? preg_replace($pattern, $replace, $uri)
425
-					: str_replace($match, '{'.$segments[0].'}', $uri);
426
-		}
423
+            $uri = strpos($match, ':') !== false
424
+                    ? preg_replace($pattern, $replace, $uri)
425
+                    : str_replace($match, '{'.$segments[0].'}', $uri);
426
+        }
427 427
 		
428
-		return $uri;
429
-	}
430
-
431
-	/**
432
-	 * Add a prefix to the route URI.
433
-	 * 
434
-	 * @param  string  $prefix
435
-	 * 
436
-	 * @return $this
437
-	 */
438
-	public function prefix($prefix)
439
-	{
440
-		if ( ! empty($newPrefix = trim(rtrim($prefix, '/').'/'.ltrim($this->action['prefix'] ?? '', '/'), '/'))) {
441
-			$this->action['prefix'] = $newPrefix;
442
-		}
428
+        return $uri;
429
+    }
430
+
431
+    /**
432
+     * Add a prefix to the route URI.
433
+     * 
434
+     * @param  string  $prefix
435
+     * 
436
+     * @return $this
437
+     */
438
+    public function prefix($prefix)
439
+    {
440
+        if ( ! empty($newPrefix = trim(rtrim($prefix, '/').'/'.ltrim($this->action['prefix'] ?? '', '/'), '/'))) {
441
+            $this->action['prefix'] = $newPrefix;
442
+        }
443 443
 		
444
-		$uri = rtrim($prefix, '/').'/'.ltrim($this->uri, '/');
444
+        $uri = rtrim($prefix, '/').'/'.ltrim($this->uri, '/');
445 445
 		
446
-		return $this->parseRoute($uri !== '/' ? trim($uri, '/') : $uri);
447
-	}
448
-
449
-	/**
450
-	 * Set the action array for the route.
451
-	 * 
452
-	 * @param  array  $action
453
-	 * 
454
-	 * @return $this
455
-	 */
456
-	public function setAction(array $action)
457
-	{
458
-		$this->action = $action;
459
-
460
-		if (isset($this->action['domain'])) {
461
-			$this->domain($this->action['domain']);
462
-		}
446
+        return $this->parseRoute($uri !== '/' ? trim($uri, '/') : $uri);
447
+    }
448
+
449
+    /**
450
+     * Set the action array for the route.
451
+     * 
452
+     * @param  array  $action
453
+     * 
454
+     * @return $this
455
+     */
456
+    public function setAction(array $action)
457
+    {
458
+        $this->action = $action;
459
+
460
+        if (isset($this->action['domain'])) {
461
+            $this->domain($this->action['domain']);
462
+        }
463 463
 		
464
-		return $this;
465
-	}
466
-
467
-	/**
468
-	 * Set the name.
469
-	 *
470
-	 * @param  string  $name
471
-	 *
472
-	 * @return string
473
-	 */
474
-	public function name($name)
475
-	{
476
-		$this->action['as'] = isset($this->action['as']) ? $this->action['as'].$name : $name;
477
-
478
-		return $this;
479
-	}
480
-
481
-	/**
482
-	 * Determine whether the route's name matches the given patterns.
483
-	 * 
484
-	 * @param  mixed  ...$patterns
485
-	 * 
486
-	 * @return bool
487
-	 */
488
-	public function named(...$patterns)
489
-	{
490
-		if (is_null($routeName = $this->getName())) {
491
-			return false;
492
-		}
493
-
494
-		foreach ($patterns as $pattern) {
495
-			if (Str::is($pattern, $routeName)) {
496
-				return true;
497
-			}
498
-		}
499
-
500
-		return false;
501
-	}
502
-
503
-	/**
504
-	 * Set a default value for the route.
505
-	 * 
506
-	 * @param  string  $key
507
-	 * @param  mixed   $value
508
-	 * 
509
-	 * @return $this
510
-	 */
511
-	public function defaults($key, $value)
512
-	{
513
-		$this->defaults[$key] = $value;
514
-
515
-		return $this;
516
-	}
517
-
518
-	/**
519
-	 * Set a default values for the route.
520
-	 * 
521
-	 * @param  string  $defaults
522
-	 * 
523
-	 * @return $this
524
-	 */
525
-	public function setDefaults(array $defaults)
526
-	{
527
-		$this->defaults = $defaults;
528
-
529
-		return $this;
530
-	}
531
-
532
-	/**
533
-	 * Set the where.
534
-	 *
535
-	 * @param  array|string  $name
536
-	 * @param  string|null  $expression  (null by default)
537
-	 *
538
-	 * @return $this
539
-	 */
540
-	public function where($name, string $expression = null)
541
-	{
542
-		$wheres = is_array($name) ? $name : [$name => $expression];
464
+        return $this;
465
+    }
466
+
467
+    /**
468
+     * Set the name.
469
+     *
470
+     * @param  string  $name
471
+     *
472
+     * @return string
473
+     */
474
+    public function name($name)
475
+    {
476
+        $this->action['as'] = isset($this->action['as']) ? $this->action['as'].$name : $name;
477
+
478
+        return $this;
479
+    }
480
+
481
+    /**
482
+     * Determine whether the route's name matches the given patterns.
483
+     * 
484
+     * @param  mixed  ...$patterns
485
+     * 
486
+     * @return bool
487
+     */
488
+    public function named(...$patterns)
489
+    {
490
+        if (is_null($routeName = $this->getName())) {
491
+            return false;
492
+        }
493
+
494
+        foreach ($patterns as $pattern) {
495
+            if (Str::is($pattern, $routeName)) {
496
+                return true;
497
+            }
498
+        }
499
+
500
+        return false;
501
+    }
502
+
503
+    /**
504
+     * Set a default value for the route.
505
+     * 
506
+     * @param  string  $key
507
+     * @param  mixed   $value
508
+     * 
509
+     * @return $this
510
+     */
511
+    public function defaults($key, $value)
512
+    {
513
+        $this->defaults[$key] = $value;
514
+
515
+        return $this;
516
+    }
517
+
518
+    /**
519
+     * Set a default values for the route.
520
+     * 
521
+     * @param  string  $defaults
522
+     * 
523
+     * @return $this
524
+     */
525
+    public function setDefaults(array $defaults)
526
+    {
527
+        $this->defaults = $defaults;
528
+
529
+        return $this;
530
+    }
531
+
532
+    /**
533
+     * Set the where.
534
+     *
535
+     * @param  array|string  $name
536
+     * @param  string|null  $expression  (null by default)
537
+     *
538
+     * @return $this
539
+     */
540
+    public function where($name, string $expression = null)
541
+    {
542
+        $wheres = is_array($name) ? $name : [$name => $expression];
543 543
 		
544
-		foreach ($wheres as $name => $expression) {
545
-			$this->wheres[$name] = $expression;
546
-		}
547
-
548
-		return $this;
549
-	}
550
-
551
-	/**
552
-	 * Bind the route to a given request for execution.
553
-	 * 
554
-	 * @param  \Syscodes\Http\Request  $request
555
-	 * 
556
-	 * @return $this
557
-	 */
558
-	public function bind(Request $request)
559
-	{
560
-		$this->parameters = (new RouteParamBinding($this))->parameters($request);
561
-
562
-		return $this;
563
-	}
564
-
565
-	/**
566
-	 * Get all of the parameter names for the route.
567
-	 * 
568
-	 * @return array
569
-	 */
570
-	public function parameterNames()
571
-	{
572
-		if (isset($this->parameterNames)) {
573
-			return $this->parameterNames;
574
-		}
575
-
576
-		return $this->parameterNames = $this->compileParamNames();
577
-	}
578
-
579
-	/**
580
-	 * Get the parameter names for the route.
581
-	 * 
582
-	 * @return array
583
-	 */
584
-	protected function compileParamNames()
585
-	{
586
-		preg_match_all('~[^\/\{(.*?)\}]~', $this->domain().$this->uri, $matches);
587
-
588
-		return array_map(function ($match) {
589
-			return trim($match, '?');
590
-		}, $matches[0]);
591
-	}
592
-
593
-	/**
594
-	 * Get a given parameter from the route.
595
-	 * 
596
-	 * @param  string  $name
597
-	 * @param  mixed  $default  (null by default)
598
-	 * 
599
-	 * @return array
600
-	 */
601
-	public function parameter($name, $default = null)
602
-	{
603
-		return Arr::get($this->parameters(), $name, $default);
604
-	}
605
-
606
-	/**
607
-	 * Set a parameter to the given value.
608
-	 * 
609
-	 * @param  string  $name
610
-	 * @param  mixed  $value
611
-	 * 
612
-	 * @return array
613
-	 */
614
-	public function setParameter($name, $value)
615
-	{
616
-		$this->parameters();
617
-
618
-		$this->parameters[$name] = $value;
619
-	}
620
-
621
-	/**
622
-	 * Get the key / value list of parameters without null values.
623
-	 * 
624
-	 * @return array
625
-	 */
626
-	public function parametersWithouNulls()
627
-	{
628
-		return array_filter($this->parameters(), function ($parameter) {
629
-			return ! is_null($parameter);
630
-		});
631
-	}
632
-
633
-	/**
634
-	 * Get the key / value list of parameters for the route.
635
-	 * 
636
-	 * @return array
637
-	 */
638
-	public function parameters()
639
-	{
640
-		if (isset($this->parameters)) {
641
-			return $this->parameters;
642
-		}
643
-
644
-		throw new LogicException('The route is not bound.');
645
-	}
646
-
647
-	/**
648
-	 * Determine if the route only responds to HTTP requests.
649
-	 * 
650
-	 * @return bool
651
-	 */
652
-	public function httpOnly()
653
-	{
654
-		return in_array('http', $this->action, true);
655
-	}
656
-
657
-	/**
658
-	 * Determine if the route only responds to HTTPS requests.
659
-	 * 
660
-	 * @return bool
661
-	 */
662
-	public function httpsOnly()
663
-	{
664
-		return $this->secure();
665
-	}
666
-
667
-	/**
668
-	 * Determine if the route only responds to HTTPS requests.
669
-	 * 
670
-	 * @return bool
671
-	 */
672
-	public function secure()
673
-	{
674
-		return in_array('https', $this->action, true);
675
-	}
676
-
677
-	/**
678
-	 * Set the container instance on the route.
679
-	 * 
680
-	 * @param  \Syscodes\Container\Container  $container
681
-	 * 
682
-	 * @return $this
683
-	 */
684
-	public function setContainer(Container $container)
685
-	{
686
-		$this->container = $container;
687
-
688
-		return $this;
689
-	}
690
-
691
-	/**
692
-	 * Dynamically access route parameters.
693
-	 * 
694
-	 * @param  string  $key
695
-	 * 
696
-	 * @return mixed
697
-	 */
698
-	public function __get($key)
699
-	{
700
-		return $this->parameter($key);
701
-	}
544
+        foreach ($wheres as $name => $expression) {
545
+            $this->wheres[$name] = $expression;
546
+        }
547
+
548
+        return $this;
549
+    }
550
+
551
+    /**
552
+     * Bind the route to a given request for execution.
553
+     * 
554
+     * @param  \Syscodes\Http\Request  $request
555
+     * 
556
+     * @return $this
557
+     */
558
+    public function bind(Request $request)
559
+    {
560
+        $this->parameters = (new RouteParamBinding($this))->parameters($request);
561
+
562
+        return $this;
563
+    }
564
+
565
+    /**
566
+     * Get all of the parameter names for the route.
567
+     * 
568
+     * @return array
569
+     */
570
+    public function parameterNames()
571
+    {
572
+        if (isset($this->parameterNames)) {
573
+            return $this->parameterNames;
574
+        }
575
+
576
+        return $this->parameterNames = $this->compileParamNames();
577
+    }
578
+
579
+    /**
580
+     * Get the parameter names for the route.
581
+     * 
582
+     * @return array
583
+     */
584
+    protected function compileParamNames()
585
+    {
586
+        preg_match_all('~[^\/\{(.*?)\}]~', $this->domain().$this->uri, $matches);
587
+
588
+        return array_map(function ($match) {
589
+            return trim($match, '?');
590
+        }, $matches[0]);
591
+    }
592
+
593
+    /**
594
+     * Get a given parameter from the route.
595
+     * 
596
+     * @param  string  $name
597
+     * @param  mixed  $default  (null by default)
598
+     * 
599
+     * @return array
600
+     */
601
+    public function parameter($name, $default = null)
602
+    {
603
+        return Arr::get($this->parameters(), $name, $default);
604
+    }
605
+
606
+    /**
607
+     * Set a parameter to the given value.
608
+     * 
609
+     * @param  string  $name
610
+     * @param  mixed  $value
611
+     * 
612
+     * @return array
613
+     */
614
+    public function setParameter($name, $value)
615
+    {
616
+        $this->parameters();
617
+
618
+        $this->parameters[$name] = $value;
619
+    }
620
+
621
+    /**
622
+     * Get the key / value list of parameters without null values.
623
+     * 
624
+     * @return array
625
+     */
626
+    public function parametersWithouNulls()
627
+    {
628
+        return array_filter($this->parameters(), function ($parameter) {
629
+            return ! is_null($parameter);
630
+        });
631
+    }
632
+
633
+    /**
634
+     * Get the key / value list of parameters for the route.
635
+     * 
636
+     * @return array
637
+     */
638
+    public function parameters()
639
+    {
640
+        if (isset($this->parameters)) {
641
+            return $this->parameters;
642
+        }
643
+
644
+        throw new LogicException('The route is not bound.');
645
+    }
646
+
647
+    /**
648
+     * Determine if the route only responds to HTTP requests.
649
+     * 
650
+     * @return bool
651
+     */
652
+    public function httpOnly()
653
+    {
654
+        return in_array('http', $this->action, true);
655
+    }
656
+
657
+    /**
658
+     * Determine if the route only responds to HTTPS requests.
659
+     * 
660
+     * @return bool
661
+     */
662
+    public function httpsOnly()
663
+    {
664
+        return $this->secure();
665
+    }
666
+
667
+    /**
668
+     * Determine if the route only responds to HTTPS requests.
669
+     * 
670
+     * @return bool
671
+     */
672
+    public function secure()
673
+    {
674
+        return in_array('https', $this->action, true);
675
+    }
676
+
677
+    /**
678
+     * Set the container instance on the route.
679
+     * 
680
+     * @param  \Syscodes\Container\Container  $container
681
+     * 
682
+     * @return $this
683
+     */
684
+    public function setContainer(Container $container)
685
+    {
686
+        $this->container = $container;
687
+
688
+        return $this;
689
+    }
690
+
691
+    /**
692
+     * Dynamically access route parameters.
693
+     * 
694
+     * @param  string  $key
695
+     * 
696
+     * @return mixed
697
+     */
698
+    public function __get($key)
699
+    {
700
+        return $this->parameter($key);
701
+    }
702 702
 }
703 703
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Routing/Concerns/RouteMap.php 1 patch
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -30,139 +30,139 @@
 block discarded – undo
30 30
  */
31 31
 trait RouteMap
32 32
 {
33
-	/**
34
-	 * All of the verbs supported by the router.
35
-	 * 
36
-	 * @var array $verbs
37
-	 */
38
-	public static $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'];
33
+    /**
34
+     * All of the verbs supported by the router.
35
+     * 
36
+     * @var array $verbs
37
+     */
38
+    public static $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'];
39 39
 
40
-	/**
41
-	 * Add a route to the underlying route collection.
42
-	 *
43
-	 * @param  string  $method
44
-	 * @param  string  $route
45
-	 * @param  mixed  $action
46
-	 *
47
-	 * @return \Syscodes\Routing\Route
48
-	 */
49
-	abstract public function addRoute($method, $route, $action);
40
+    /**
41
+     * Add a route to the underlying route collection.
42
+     *
43
+     * @param  string  $method
44
+     * @param  string  $route
45
+     * @param  mixed  $action
46
+     *
47
+     * @return \Syscodes\Routing\Route
48
+     */
49
+    abstract public function addRoute($method, $route, $action);
50 50
 
51
-	/**
52
-	 * Add a route for all posible methods.
53
-	 *
54
-	 * @param  string  $route
55
-	 * @param  string|callable  $action
56
-	 *
57
-	 * @return void
58
-	 */
59
-	public function any($route, $action = null) 
60
-	{		
61
-		return $this->addRoute(self::$verbs, $route, $action);
62
-	}
51
+    /**
52
+     * Add a route for all posible methods.
53
+     *
54
+     * @param  string  $route
55
+     * @param  string|callable  $action
56
+     *
57
+     * @return void
58
+     */
59
+    public function any($route, $action = null) 
60
+    {		
61
+        return $this->addRoute(self::$verbs, $route, $action);
62
+    }
63 63
 	
64
-	/**
65
-	 * Add a route with delete method.
66
-	 *
67
-	 * @param  string  $route
68
-	 * @param  string|callable  $action
69
-	 *
70
-	 * @return void
71
-	 */
72
-	public function delete($route, $action = null) 
73
-	{
74
-		return $this->addRoute('DELETE', $route, $action);
75
-	}
64
+    /**
65
+     * Add a route with delete method.
66
+     *
67
+     * @param  string  $route
68
+     * @param  string|callable  $action
69
+     *
70
+     * @return void
71
+     */
72
+    public function delete($route, $action = null) 
73
+    {
74
+        return $this->addRoute('DELETE', $route, $action);
75
+    }
76 76
 
77
-	/**
78
-	 * Add a route with get method.
79
-	 *
80
-	 * @param  string  $route
81
-	 * @param  string|callable  $action
82
-	 *
83
-	 * @return void
84
-	 */
85
-	public function get($route, $action = null) 
86
-	{
87
-		return $this->addRoute(['GET', 'HEAD'], $route, $action);
88
-	}
77
+    /**
78
+     * Add a route with get method.
79
+     *
80
+     * @param  string  $route
81
+     * @param  string|callable  $action
82
+     *
83
+     * @return void
84
+     */
85
+    public function get($route, $action = null) 
86
+    {
87
+        return $this->addRoute(['GET', 'HEAD'], $route, $action);
88
+    }
89 89
 
90
-	/**
91
-	 * Add a route with head method.
92
-	 *
93
-	 * @param  string  $route
94
-	 * @param  string|callable  $action
95
-	 *
96
-	 * @return void
97
-	 */
98
-	public function head($route, $action = null)
99
-	{
100
-		return $this->addRoute('HEAD', $route, $action);
101
-	}
90
+    /**
91
+     * Add a route with head method.
92
+     *
93
+     * @param  string  $route
94
+     * @param  string|callable  $action
95
+     *
96
+     * @return void
97
+     */
98
+    public function head($route, $action = null)
99
+    {
100
+        return $this->addRoute('HEAD', $route, $action);
101
+    }
102 102
 
103
-	/**
104
-	 * Register a new route with the given methods.
105
-	 * 
106
-	 * @param  array|string  $methods
107
-	 * @param  string  $route
108
-	 * @param  string|null|callable  $action
109
-	 * 
110
-	 * @return void
111
-	 */
112
-	public function match($methods, $route, $action = null)
113
-	{
114
-		return $this->addRoute(array_map('strtoupper', (array) $methods), $route, $action);
115
-	}
103
+    /**
104
+     * Register a new route with the given methods.
105
+     * 
106
+     * @param  array|string  $methods
107
+     * @param  string  $route
108
+     * @param  string|null|callable  $action
109
+     * 
110
+     * @return void
111
+     */
112
+    public function match($methods, $route, $action = null)
113
+    {
114
+        return $this->addRoute(array_map('strtoupper', (array) $methods), $route, $action);
115
+    }
116 116
 
117
-	/**
118
-	 * Add a route with options method.
119
-	 *
120
-	 * @param  string  $route
121
-	 * @param  string|callable  $action
122
-	 *
123
-	 * @return void
124
-	 */
125
-	public function options($route, $action = null) 
126
-	{
127
-		return $this->addRoute('OPTIONS', $route, $action);
128
-	}
117
+    /**
118
+     * Add a route with options method.
119
+     *
120
+     * @param  string  $route
121
+     * @param  string|callable  $action
122
+     *
123
+     * @return void
124
+     */
125
+    public function options($route, $action = null) 
126
+    {
127
+        return $this->addRoute('OPTIONS', $route, $action);
128
+    }
129 129
 
130
-	/**
131
-	 * Add a route with patch method.
132
-	 *
133
-	 * @param  string  $route
134
-	 * @param  string|callable  $action
135
-	 *
136
-	 * @return void
137
-	 */
138
-	public function patch($route, $action = null)
139
-	{
140
-		return $this->addRoute('PATCH', $route, $action);
141
-	}
130
+    /**
131
+     * Add a route with patch method.
132
+     *
133
+     * @param  string  $route
134
+     * @param  string|callable  $action
135
+     *
136
+     * @return void
137
+     */
138
+    public function patch($route, $action = null)
139
+    {
140
+        return $this->addRoute('PATCH', $route, $action);
141
+    }
142 142
 
143
-	/**
144
-	 * Add a route with post method.
145
-	 *
146
-	 * @param  string  $route
147
-	 * @param  string|callable  $action
148
-	 *
149
-	 * @return void
150
-	 */
151
-	public function post($route, $action = null) 
152
-	{
153
-		return $this->addRoute('POST', $route, $action);
154
-	}
143
+    /**
144
+     * Add a route with post method.
145
+     *
146
+     * @param  string  $route
147
+     * @param  string|callable  $action
148
+     *
149
+     * @return void
150
+     */
151
+    public function post($route, $action = null) 
152
+    {
153
+        return $this->addRoute('POST', $route, $action);
154
+    }
155 155
 
156
-	/**
157
-	 * Add a route with put method.
158
-	 *
159
-	 * @param  string  $route
160
-	 * @param  string|callable  $action
161
-	 *
162
-	 * @return void
163
-	 */
164
-	public function put($route, $action = null) 
165
-	{
166
-		return $this->addRoute('PUT', $route, $action);
167
-	}  
156
+    /**
157
+     * Add a route with put method.
158
+     *
159
+     * @param  string  $route
160
+     * @param  string|callable  $action
161
+     *
162
+     * @return void
163
+     */
164
+    public function put($route, $action = null) 
165
+    {
166
+        return $this->addRoute('PUT', $route, $action);
167
+    }  
168 168
 }
169 169
\ No newline at end of file
Please login to merge, or discard this patch.
src/components/Routing/Concerns/RouteDependencyResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
      */
118 118
     protected function getInParameters($class, array $parameters)
119 119
     {
120
-        return ! is_null(Arr::first($parameters, function ($value) use ($class) {
120
+        return ! is_null(Arr::first($parameters, function($value) use ($class) {
121 121
             return $value instanceof $class;
122 122
         }));
123 123
     }
Please login to merge, or discard this patch.
src/components/Routing/Concerns/RouteResolver.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 	{		
86 86
 		return (new Pipeline($this->container))
87 87
 				->send($request)
88
-				->then(function ($request) use ($route) {
88
+				->then(function($request) use ($route) {
89 89
 					return $this->callResponse(
90 90
 						$request, $route->runResolver()
91 91
 					); 
Please login to merge, or discard this patch.
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -37,96 +37,96 @@
 block discarded – undo
37 37
  */
38 38
 trait RouteResolver
39 39
 {
40
-	/**
41
-	 * The currently dispatched route instance.
42
-	 * 
43
-	 * @var \Syscodes\Routing\Route|null
44
-	 */
45
-	protected $current;
40
+    /**
41
+     * The currently dispatched route instance.
42
+     * 
43
+     * @var \Syscodes\Routing\Route|null
44
+     */
45
+    protected $current;
46 46
 
47
-	/**
48
-	 * Resolve the given route and call the method that belongs to the route.
49
-	 *
50
-	 * @param  \Syscodes\Http\Request  $request
51
-	 * @param  \Syscodes\Routing\RouteCollection  $route 
52
-	 *
53
-	 * @return \Syscodes\Http\Response
54
-	 */
55
-	public function resolve($request, Routecollection $route)
56
-	{
57
-		return $this->dispatchToRoute($request, $route);
58
-	}
47
+    /**
48
+     * Resolve the given route and call the method that belongs to the route.
49
+     *
50
+     * @param  \Syscodes\Http\Request  $request
51
+     * @param  \Syscodes\Routing\RouteCollection  $route 
52
+     *
53
+     * @return \Syscodes\Http\Response
54
+     */
55
+    public function resolve($request, Routecollection $route)
56
+    {
57
+        return $this->dispatchToRoute($request, $route);
58
+    }
59 59
 
60
-	/**
61
-	 * Dispatch the request to a route and return the response.
62
-	 * 
63
-	 * @param  \Syscodes\Http\Request  $request
64
-	 * @param  \Syscodes\Routing\RouteCollection  $route 
65
-	 *
66
-	 * @return \Syscodes\Http\Response
67
-	 */
68
-	protected function dispatchToRoute($request, $route)
69
-	{
70
-		return $this->runRoute($request, 
71
-			$this->findRoute($request, $route)
72
-		);
73
-	}
60
+    /**
61
+     * Dispatch the request to a route and return the response.
62
+     * 
63
+     * @param  \Syscodes\Http\Request  $request
64
+     * @param  \Syscodes\Routing\RouteCollection  $route 
65
+     *
66
+     * @return \Syscodes\Http\Response
67
+     */
68
+    protected function dispatchToRoute($request, $route)
69
+    {
70
+        return $this->runRoute($request, 
71
+            $this->findRoute($request, $route)
72
+        );
73
+    }
74 74
 
75
-	/**
76
-	 * Return the response for the given route.
77
-	 * 
78
-	 * @param  \Syscodes\Http\Request  $request
79
-	 * @param  \Syscodes\Routing\Route  $route
80
-	 * 
81
-	 * @return \Syscodes\Http\Response 
82
-	 */
83
-	protected function runRoute($request, $route)
84
-	{		
85
-		return (new Pipeline($this->container))
86
-				->send($request)
87
-				->then(function ($request) use ($route) {
88
-					return $this->callResponse(
89
-						$request, $route->runResolver()
90
-					); 
91
-				});
92
-	}
75
+    /**
76
+     * Return the response for the given route.
77
+     * 
78
+     * @param  \Syscodes\Http\Request  $request
79
+     * @param  \Syscodes\Routing\Route  $route
80
+     * 
81
+     * @return \Syscodes\Http\Response 
82
+     */
83
+    protected function runRoute($request, $route)
84
+    {		
85
+        return (new Pipeline($this->container))
86
+                ->send($request)
87
+                ->then(function ($request) use ($route) {
88
+                    return $this->callResponse(
89
+                        $request, $route->runResolver()
90
+                    ); 
91
+                });
92
+    }
93 93
 
94
-	/**
95
-	 * Create a response instance from the given value.
96
-	 * 
97
-	 * @param  \Syscodes\Http\Request  $request
98
-	 * @param  mixed  $response
99
-	 * 
100
-	 * @return \Syscodes\Http\Response
101
-	 */
102
-	protected function callResponse($request, $response)
103
-	{
104
-		if ( ! $response instanceof Response && 
105
-		      ($response instanceof Jsonserializable || 
106
-			   is_array($response))) {
107
-			$response = new JsonResponse($response);
108
-		} elseif ( ! $response instanceof Response) {
109
-			$response = new Response($response, 200, ['Content-Type' => 'text/html']);
110
-		}
94
+    /**
95
+     * Create a response instance from the given value.
96
+     * 
97
+     * @param  \Syscodes\Http\Request  $request
98
+     * @param  mixed  $response
99
+     * 
100
+     * @return \Syscodes\Http\Response
101
+     */
102
+    protected function callResponse($request, $response)
103
+    {
104
+        if ( ! $response instanceof Response && 
105
+              ($response instanceof Jsonserializable || 
106
+               is_array($response))) {
107
+            $response = new JsonResponse($response);
108
+        } elseif ( ! $response instanceof Response) {
109
+            $response = new Response($response, 200, ['Content-Type' => 'text/html']);
110
+        }
111 111
 
112
-		return $response->prepare($request);
113
-	}
112
+        return $response->prepare($request);
113
+    }
114 114
 
115
-	/**
116
-	 * Find the route matching a given request.
117
-	 * 
118
-	 * @param  \Syscodes\Http\Request  $request
119
-	 * @param  \Syscodes\Routing\RouteCollection  $route
120
-	 * 
121
-	 * @return \Syscodes\Routing\Route
122
-	 */
123
-	protected function findRoute($request, $route)
124
-	{
125
-		// Get all register routes with the same request method
126
-		$this->current = $route = $route->match($request);
115
+    /**
116
+     * Find the route matching a given request.
117
+     * 
118
+     * @param  \Syscodes\Http\Request  $request
119
+     * @param  \Syscodes\Routing\RouteCollection  $route
120
+     * 
121
+     * @return \Syscodes\Routing\Route
122
+     */
123
+    protected function findRoute($request, $route)
124
+    {
125
+        // Get all register routes with the same request method
126
+        $this->current = $route = $route->match($request);
127 127
 
128
-		$this->container->instance(Route::class, $route);
128
+        $this->container->instance(Route::class, $route);
129 129
 
130
-		return $route;
131
-	}
130
+        return $route;
131
+    }
132 132
 }
133 133
\ No newline at end of file
Please login to merge, or discard this patch.