@@ -41,7 +41,7 @@ |
||
41 | 41 | private function normalizeModel($target, array $model): array |
42 | 42 | { |
43 | 43 | $model = $this->normalizeInput($model); |
44 | - $mapper = function ($model) use ($target) { |
|
44 | + $mapper = function($model) use ($target) { |
|
45 | 45 | return "eloquent.{$target}: {$model}"; |
46 | 46 | }; |
47 | 47 |
@@ -71,7 +71,7 @@ |
||
71 | 71 | }; |
72 | 72 | } |
73 | 73 | |
74 | - return function () { |
|
74 | + return function() { |
|
75 | 75 | }; |
76 | 76 | } |
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -11,8 +11,9 @@ |
||
11 | 11 | { |
12 | 12 | Route::matched(function (RouteMatched $eventObj) { |
13 | 13 | $route = $eventObj->route; |
14 | - if($eventObj->request->method() === 'GET') |
|
15 | - $this->authorizeUrls($route->uri); |
|
14 | + if($eventObj->request->method() === 'GET') { |
|
15 | + $this->authorizeUrls($route->uri); |
|
16 | + } |
|
16 | 17 | $this->authorizeRouteNames($route->getName()); |
17 | 18 | $this->authorizeRouteActions($route->getActionName()); |
18 | 19 | }); |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | { |
10 | 10 | public function authorizeMatchedRoutes() |
11 | 11 | { |
12 | - Route::matched(function (RouteMatched $eventObj) { |
|
12 | + Route::matched(function(RouteMatched $eventObj) { |
|
13 | 13 | $route = $eventObj->route; |
14 | - if($eventObj->request->method() === 'GET') |
|
14 | + if ($eventObj->request->method() === 'GET') |
|
15 | 15 | $this->authorizeUrls($route->uri); |
16 | 16 | $this->authorizeRouteNames($route->getName()); |
17 | 17 | $this->authorizeRouteActions($route->getActionName()); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | private function setGuardFor($method, $key) |
53 | 53 | { |
54 | - $method = 'get'.$method; |
|
54 | + $method = 'get' . $method; |
|
55 | 55 | app('hey_man_route_authorizer')->{$method}($key)(); |
56 | 56 | } |
57 | 57 | } |
58 | 58 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function whenYouVisitUrl(...$url) |
14 | 14 | { |
15 | - $removeSlash = function ($url) { |
|
15 | + $removeSlash = function($url) { |
|
16 | 16 | return ltrim($url, "/"); |
17 | 17 | }; |
18 | 18 | |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function whenYouCallAction(...$action) |
38 | 38 | { |
39 | - $addNamespace = function ($action) { |
|
39 | + $addNamespace = function($action) { |
|
40 | 40 | if ($action = ltrim($action, '\\')) { |
41 | 41 | return $action; |
42 | 42 | } |
43 | 43 | |
44 | - return app()->getNamespace().'\\Http\\Controllers\\'.$action; |
|
44 | + return app()->getNamespace() . '\\Http\\Controllers\\' . $action; |
|
45 | 45 | }; |
46 | 46 | |
47 | 47 | $action = array_map($addNamespace, $this->normalizeInput($action)); |
@@ -31,9 +31,9 @@ |
||
31 | 31 | private function normalizeView(array $views): array |
32 | 32 | { |
33 | 33 | $views = $this->normalizeInput($views); |
34 | - $mapper = function ($view) { |
|
34 | + $mapper = function($view) { |
|
35 | 35 | $this->checkViewExists($view); |
36 | - return 'creating: '.\Illuminate\View\ViewName::normalize($view); |
|
36 | + return 'creating: ' . \Illuminate\View\ViewName::normalize($view); |
|
37 | 37 | }; |
38 | 38 | |
39 | 39 | return array_map($mapper, $views); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | $gate = $this->defineNewGate($gate); |
19 | 19 | |
20 | - $this->predicate = function () use ($gate, $args) { |
|
20 | + $this->predicate = function() use ($gate, $args) { |
|
21 | 21 | return Gate::allows($gate, $args); |
22 | 22 | }; |
23 | 23 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | |
32 | 32 | public function thisMethodShouldAllow($callback, array $parameters = []) |
33 | 33 | { |
34 | - $this->predicate = function () use ($callback, $parameters) { |
|
35 | - return (boolean) app()->call($callback, $parameters); |
|
34 | + $this->predicate = function() use ($callback, $parameters) { |
|
35 | + return (boolean)app()->call($callback, $parameters); |
|
36 | 36 | }; |
37 | 37 | |
38 | 38 | return new Otherwise(); |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | |
41 | 41 | public function thisValueShouldAllow($value) |
42 | 42 | { |
43 | - $this->predicate = function () use ($value) { |
|
44 | - return (boolean) $value; |
|
43 | + $this->predicate = function() use ($value) { |
|
44 | + return (boolean)$value; |
|
45 | 45 | }; |
46 | 46 | return new Otherwise(); |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function youShouldBeGuest() |
50 | 50 | { |
51 | - $this->predicate = function () { |
|
51 | + $this->predicate = function() { |
|
52 | 52 | return auth()->guest(); |
53 | 53 | }; |
54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | public function youShouldBeLoggedIn() |
59 | 59 | { |
60 | - $this->predicate = function () { |
|
60 | + $this->predicate = function() { |
|
61 | 61 | return auth()->check(); |
62 | 62 | }; |
63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function immediately() |
68 | 68 | { |
69 | - $this->predicate = function () { |
|
69 | + $this->predicate = function() { |
|
70 | 70 | return false; |
71 | 71 | }; |
72 | 72 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | public function startListening($response, $exception) |
38 | 38 | { |
39 | - $callbackListener = app(ListenerFactory::class)->make($response, $exception ); |
|
39 | + $callbackListener = app(ListenerFactory::class)->make($response, $exception); |
|
40 | 40 | $this->authorizer->startGuarding($callbackListener); |
41 | 41 | } |
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | */ |
25 | 25 | private function exceptionCallback($e, $cb): \Closure |
26 | 26 | { |
27 | - return function () use ($e, $cb) { |
|
28 | - if (! $cb()) { |
|
27 | + return function() use ($e, $cb) { |
|
28 | + if (!$cb()) { |
|
29 | 29 | throw $e; |
30 | 30 | } |
31 | 31 | }; |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | */ |
39 | 39 | private function responseCallback($resp, $cb): \Closure |
40 | 40 | { |
41 | - return function () use ($resp, $cb) { |
|
42 | - if (! $cb()) { |
|
41 | + return function() use ($resp, $cb) { |
|
42 | + if (!$cb()) { |
|
43 | 43 | list($method, $args) = $resp; |
44 | 44 | respondWith(response()->{$method}(...$args)); |
45 | 45 | } |
@@ -165,7 +165,7 @@ |
||
165 | 165 | $this->response = [__FUNCTION__, func_get_args()]; |
166 | 166 | } |
167 | 167 | |
168 | - public function weThrowNew($exception, $message= '') |
|
168 | + public function weThrowNew($exception, $message = '') |
|
169 | 169 | { |
170 | 170 | $this->exception = new $exception($message); |
171 | 171 | } |