@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function whenYouCallAction(...$action) |
76 | 76 | { |
77 | - $addNamespace = function ($action) { |
|
77 | + $addNamespace = function($action) { |
|
78 | 78 | if ($action = ltrim($action, '\\')) { |
79 | 79 | return $action; |
80 | 80 | } |
81 | 81 | |
82 | - return app()->getNamespace().'\\Http\\Controllers\\'.$action; |
|
82 | + return app()->getNamespace() . '\\Http\\Controllers\\' . $action; |
|
83 | 83 | }; |
84 | 84 | |
85 | 85 | $action = array_map($addNamespace, $this->normalizeInput($action)); |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | */ |
108 | 108 | private function authorizeURL($url, $verb): \Imanghafoori\HeyMan\YouShouldHave |
109 | 109 | { |
110 | - $removeSlash = function ($url) use ($verb) { |
|
111 | - return $verb.ltrim($url, '/'); |
|
110 | + $removeSlash = function($url) use ($verb) { |
|
111 | + return $verb . ltrim($url, '/'); |
|
112 | 112 | }; |
113 | 113 | |
114 | 114 | $url = array_map($removeSlash, $this->normalizeInput($url)); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $gate = $this->defineNewGate($gate); |
35 | 35 | |
36 | - $this->chain->predicate = function (...$payload) use ($gate, $parameters) { |
|
36 | + $this->chain->predicate = function(...$payload) use ($gate, $parameters) { |
|
37 | 37 | return Gate::allows($gate, (array_merge($parameters, ...$payload))); |
38 | 38 | }; |
39 | 39 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | |
48 | 48 | public function thisMethodShouldAllow($callback, array $parameters = []): Otherwise |
49 | 49 | { |
50 | - $this->chain->predicate = function (...$payload) use ($callback, $parameters) { |
|
51 | - return (bool) app()->call($callback, array_merge($parameters, ...$payload)); |
|
50 | + $this->chain->predicate = function(...$payload) use ($callback, $parameters) { |
|
51 | + return (bool)app()->call($callback, array_merge($parameters, ...$payload)); |
|
52 | 52 | }; |
53 | 53 | |
54 | 54 | return app(Otherwise::class); |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | public function thisValueShouldAllow($value): Otherwise |
58 | 58 | { |
59 | - $this->chain->predicate = function () use ($value) { |
|
60 | - return (bool) $value; |
|
59 | + $this->chain->predicate = function() use ($value) { |
|
60 | + return (bool)$value; |
|
61 | 61 | }; |
62 | 62 | |
63 | 63 | return app(Otherwise::class); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | public function youShouldBeGuest($guard = null): Otherwise |
67 | 67 | { |
68 | - $this->chain->predicate = function () use ($guard) { |
|
68 | + $this->chain->predicate = function() use ($guard) { |
|
69 | 69 | return auth($guard)->guest(); |
70 | 70 | }; |
71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | public function sessionShouldHave($key): Otherwise |
76 | 76 | { |
77 | - $this->chain->predicate = function () use ($key) { |
|
77 | + $this->chain->predicate = function() use ($key) { |
|
78 | 78 | return session()->has($key); |
79 | 79 | }; |
80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | public function youShouldBeLoggedIn($guard = null): Otherwise |
85 | 85 | { |
86 | - $this->chain->predicate = function () use ($guard) { |
|
86 | + $this->chain->predicate = function() use ($guard) { |
|
87 | 87 | return auth($guard)->check(); |
88 | 88 | }; |
89 | 89 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | public function youShouldAlways() |
94 | 94 | { |
95 | - $this->chain->predicate = function () { |
|
95 | + $this->chain->predicate = function() { |
|
96 | 96 | return false; |
97 | 97 | }; |
98 | 98 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function yourRequestShouldBeValid($rules) |
103 | 103 | { |
104 | - $this->chain->predicate = function () use ($rules) { |
|
104 | + $this->chain->predicate = function() use ($rules) { |
|
105 | 105 | $validator = Validator::make(request()->all(), $rules); |
106 | 106 | $validator->validate(); |
107 | 107 | }; |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | } elseif ($this->chain->redirect) { |
28 | 28 | return $this->redirectCallback($this->chain->redirect); |
29 | 29 | } else { |
30 | - return function () {}; |
|
30 | + return function() {}; |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | 34 | public function abortCallback($abort) |
35 | 35 | { |
36 | - $responder = function () use ($abort) { |
|
36 | + $responder = function() use ($abort) { |
|
37 | 37 | abort(...$abort); |
38 | 38 | }; |
39 | 39 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function exceptionCallback($e): \Closure |
50 | 50 | { |
51 | - $responder = function () use ($e) { |
|
51 | + $responder = function() use ($e) { |
|
52 | 52 | $exClass = $e['class']; |
53 | 53 | |
54 | 54 | throw new $exClass($e['message']); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function responseCallback($resp): \Closure |
67 | 67 | { |
68 | - $responder = function () use ($resp) { |
|
68 | + $responder = function() use ($resp) { |
|
69 | 69 | $respObj = response(); |
70 | 70 | foreach ($resp as $call) { |
71 | 71 | list($method, $args) = $call; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function redirectCallback($resp): \Closure |
81 | 81 | { |
82 | - $responder = function () use ($resp) { |
|
82 | + $responder = function() use ($resp) { |
|
83 | 83 | $respObj = redirect(); |
84 | 84 | foreach ($resp as $call) { |
85 | 85 | list($method, $args) = $call; |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function authorizeMatchedRoutes() |
12 | 12 | { |
13 | - Route::matched(function (RouteMatched $eventObj) { |
|
13 | + Route::matched(function(RouteMatched $eventObj) { |
|
14 | 14 | $route = $eventObj->route; |
15 | - foreach (['GET', 'POST', 'PUT', 'PATCH', 'DELETE',] as $verb) { |
|
15 | + foreach (['GET', 'POST', 'PUT', 'PATCH', 'DELETE', ] as $verb) { |
|
16 | 16 | if ($eventObj->request->method() === $verb) { |
17 | 17 | |
18 | 18 | |
19 | - $this->authorizeUrls($verb.$route->uri); |
|
19 | + $this->authorizeUrls($verb . $route->uri); |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | $this->authorizeRouteNames($route->getName()); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | private function setGuardFor(string $method, $key) |
63 | 63 | { |
64 | - $method = 'get'.$method; |
|
64 | + $method = 'get' . $method; |
|
65 | 65 | $closures = app(RouterEventManager::class)->{$method}($key); |
66 | 66 | foreach ($closures as $cb) { |
67 | 67 | $cb(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | - return [function () { |
|
80 | + return [function() { |
|
81 | 81 | }]; |
82 | 82 | } |
83 | 83 | |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function wrapCallbacksForIgnore($callbacks): array |
90 | 90 | { |
91 | - return array_map(function ($callback) { |
|
92 | - return function () use ($callback) |
|
91 | + return array_map(function($callback) { |
|
92 | + return function() use ($callback) |
|
93 | 93 | { |
94 | - if (! config('heyman_ignore_route', false)) { |
|
94 | + if (!config('heyman_ignore_route', false)) { |
|
95 | 95 | $callback(); |
96 | 96 | } |
97 | 97 | }; |