@@ -10,11 +10,11 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function authorizeMatchedRoutes() |
| 12 | 12 | { |
| 13 | - Route::matched(function (RouteMatched $eventObj) { |
|
| 13 | + Route::matched(function(RouteMatched $eventObj) { |
|
| 14 | 14 | $matchedRoute = [ |
| 15 | 15 | $eventObj->route->getName(), |
| 16 | 16 | $eventObj->route->getActionName(), |
| 17 | - $eventObj->request->method().$eventObj->route->uri, |
|
| 17 | + $eventObj->request->method() . $eventObj->route->uri, |
|
| 18 | 18 | ]; |
| 19 | 19 | |
| 20 | 20 | $closures = app(RouterEventManager::class)->findMatchingCallbacks($matchedRoute); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | private function wrapCallbacksForIgnore(array $callbacks): array |
| 34 | 34 | { |
| 35 | - return array_map(function ($callback) { |
|
| 35 | + return array_map(function($callback) { |
|
| 36 | 36 | return app(HeyManSwitcher::class)->wrapForIgnorance($callback, 'route'); |
| 37 | 37 | }, $callbacks); |
| 38 | 38 | } |
@@ -6,8 +6,8 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function wrapForIgnorance(callable $callback, $key): \Closure |
| 8 | 8 | { |
| 9 | - return function (...$args) use ($callback, $key) { |
|
| 10 | - if (!config('heyman_ignore_'.$key, false)) { |
|
| 9 | + return function(...$args) use ($callback, $key) { |
|
| 10 | + if (!config('heyman_ignore_' . $key, false)) { |
|
| 11 | 11 | $callback(...$args); |
| 12 | 12 | } |
| 13 | 13 | }; |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $views = $this->normalizeInput($views); |
| 30 | 30 | |
| 31 | - array_walk($views, function ($view) { |
|
| 31 | + array_walk($views, function($view) { |
|
| 32 | 32 | $this->checkViewExists($view); |
| 33 | 33 | }); |
| 34 | 34 | |
@@ -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(): Reactions |
| 94 | 94 | { |
| 95 | - $this->chain->predicate = function () { |
|
| 95 | + $this->chain->predicate = function() { |
|
| 96 | 96 | return false; |
| 97 | 97 | }; |
| 98 | 98 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $cb = $this->chain->predicate; |
| 44 | 44 | $this->chain->reset(); |
| 45 | 45 | |
| 46 | - return function (...$f) use ($responder, $cb, $beforeResponse) { |
|
| 46 | + return function(...$f) use ($responder, $cb, $beforeResponse) { |
|
| 47 | 47 | if ($cb($f)) { |
| 48 | 48 | return true; |
| 49 | 49 | } |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | $calls = $this->chain->beforeResponse; |
| 59 | 59 | |
| 60 | 60 | if (!$calls) { |
| 61 | - return function () { |
|
| 61 | + return function() { |
|
| 62 | 62 | }; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - return function () use ($calls) { |
|
| 65 | + return function() use ($calls) { |
|
| 66 | 66 | foreach ($calls as $call) { |
| 67 | 67 | $call(); |
| 68 | 68 | } |
@@ -55,14 +55,14 @@ |
||
| 55 | 55 | |
| 56 | 56 | public function addAfterCall($callback, $parameters) |
| 57 | 57 | { |
| 58 | - $this->beforeResponse[] = function () use ($callback, $parameters) { |
|
| 58 | + $this->beforeResponse[] = function() use ($callback, $parameters) { |
|
| 59 | 59 | app()->call($callback, $parameters); |
| 60 | 60 | }; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function eventFire($event, array $payload, bool $halt) |
| 64 | 64 | { |
| 65 | - $this->beforeResponse[] = function () use ($event, $payload, $halt) { |
|
| 65 | + $this->beforeResponse[] = function() use ($event, $payload, $halt) { |
|
| 66 | 66 | app('events')->dispatch($event, $payload, $halt); |
| 67 | 67 | }; |
| 68 | 68 | } |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public function abort($abort) |
| 32 | 32 | { |
| 33 | - return function () use ($abort) { |
|
| 33 | + return function() use ($abort) { |
|
| 34 | 34 | abort(...$abort[0]); |
| 35 | 35 | }; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function nothing() |
| 39 | 39 | { |
| 40 | - return function () { |
|
| 40 | + return function() { |
|
| 41 | 41 | }; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function exception($e): \Closure |
| 50 | 50 | { |
| 51 | - return function () use ($e) { |
|
| 51 | + return function() use ($e) { |
|
| 52 | 52 | $exClass = $e[0]['class']; |
| 53 | 53 | |
| 54 | 54 | throw new $exClass($e[0]['message']); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function response($resp): \Closure |
| 64 | 64 | { |
| 65 | - return function () use ($resp) { |
|
| 65 | + return function() use ($resp) { |
|
| 66 | 66 | $respObj = response(); |
| 67 | 67 | foreach ($resp as $call) { |
| 68 | 68 | list($method, $args) = $call; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function redirect($resp): \Closure |
| 76 | 76 | { |
| 77 | - return function () use ($resp) { |
|
| 77 | + return function() use ($resp) { |
|
| 78 | 78 | $respObj = redirect(); |
| 79 | 79 | foreach ($resp as $call) { |
| 80 | 80 | list($method, $args) = $call; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function respondFrom($method) |
| 88 | 88 | { |
| 89 | - return function () use ($method) { |
|
| 89 | + return function() use ($method) { |
|
| 90 | 90 | respondWith(app()->call(...$method[0])); |
| 91 | 91 | }; |
| 92 | 92 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function validatorCallback($modifier, $rules, array $messages = [], array $customAttributes = []): \Closure |
| 105 | 105 | { |
| 106 | - $validator = function () use ($modifier, $rules, $messages, $customAttributes) { |
|
| 106 | + $validator = function() use ($modifier, $rules, $messages, $customAttributes) { |
|
| 107 | 107 | if (is_callable($rules)) { |
| 108 | 108 | $rules = $rules(); |
| 109 | 109 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | public function __destruct() |
| 38 | 38 | { |
| 39 | 39 | $data = $this->validationData; |
| 40 | - $modifier = $this->modifier ?: function ($d) { |
|
| 40 | + $modifier = $this->modifier ?: function($d) { |
|
| 41 | 41 | return $d; |
| 42 | 42 | }; |
| 43 | 43 | $this->chain->predicate = app(ResponderFactory::class)->validatorCallback($modifier, ...$data); |