@@ -14,7 +14,7 @@ |
||
14 | 14 | /** |
15 | 15 | * Create a new Factory instance. |
16 | 16 | * |
17 | - * @param mixed|null $defaultPolicy |
|
17 | + * @param \Closure $defaultPolicy |
|
18 | 18 | */ |
19 | 19 | public function __construct($defaultPolicy = null) |
20 | 20 | { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function fromArray(array $rules) |
77 | 77 | { |
78 | - return $this->fromCallback(function ($guard) use ($rules) { |
|
78 | + return $this->fromCallback(function($guard) use ($rules) { |
|
79 | 79 | foreach ($rules as $method => $arguments) { |
80 | 80 | $guard->allow($method, $arguments); |
81 | 81 | } |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | { |
100 | 100 | return array_build( |
101 | 101 | preg_split('#(?<=\))\s*(?=[a-z])#i', $input), // split on spaces between e.g. `where(*) orderBy(*)` |
102 | - function ($index, $rule) { |
|
102 | + function($index, $rule) { |
|
103 | 103 | |
104 | - if (!preg_match('#^(?<method>[a-z]+)\((?<args>[^)]*)\)$#i', $rule, $clause)) { |
|
105 | - throw new InvalidArgumentException('Could not parse rule [' . $rule . ']'); |
|
104 | + if ( ! preg_match('#^(?<method>[a-z]+)\((?<args>[^)]*)\)$#i', $rule, $clause)) { |
|
105 | + throw new InvalidArgumentException('Could not parse rule ['.$rule.']'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | return [ |
@@ -178,7 +178,7 @@ |
||
178 | 178 | /** |
179 | 179 | * Prompt user to confirm. |
180 | 180 | * |
181 | - * @return bool |
|
181 | + * @return string |
|
182 | 182 | */ |
183 | 183 | protected function isConfirmed() |
184 | 184 | { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | { |
118 | 118 | return array_filter( |
119 | 119 | $this->classFinder->findClasses(app_path()), |
120 | - function ($className) { |
|
120 | + function($className) { |
|
121 | 121 | return is_subclass_of($className, AcceptsEloquentJsQueries::class); |
122 | 122 | } |
123 | 123 | ); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | { |
134 | 134 | $metadata = $this->inspector->inspect(new $className); |
135 | 135 | |
136 | - if (!$metadata->endpoint) { |
|
136 | + if ( ! $metadata->endpoint) { |
|
137 | 137 | $metadata->endpoint = $this->findMissingEndpoint($className); |
138 | 138 | } |
139 | 139 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $this->table( |
171 | 171 | ['Model', 'Endpoint'], |
172 | - array_map(function ($metadata) { |
|
172 | + array_map(function($metadata) { |
|
173 | 173 | return [$metadata->name, $metadata->endpoint]; |
174 | 174 | }, $models) |
175 | 175 | ); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function register() |
28 | 28 | { |
29 | - $this->app->singleton('eloquentjs.query', function ($app) { |
|
29 | + $this->app->singleton('eloquentjs.query', function($app) { |
|
30 | 30 | return $app[Interpreter::class]->parse($app['request']); |
31 | 31 | }); |
32 | 32 | |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | |
88 | 88 | $app->when(GenericController::class) |
89 | 89 | ->needs(AcceptsEloquentJsQueries::class) |
90 | - ->give(function ($app) { |
|
90 | + ->give(function($app) { |
|
91 | 91 | if ($resource = $app['eloquentjs.router']->getCurrentResource()) { |
92 | 92 | return $app->make($resource); |
93 | 93 | } |
94 | 94 | }); |
95 | 95 | |
96 | - $router->macro('eloquent', function ($uri, $resource, $options = []) use ($app) { |
|
96 | + $router->macro('eloquent', function($uri, $resource, $options = []) use ($app) { |
|
97 | 97 | $app['eloquentjs.router']->addRoute($uri, $resource, $options); |
98 | 98 | }); |
99 | 99 | } |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function setDefaultPolicy() |
107 | 107 | { |
108 | - $this->app->bind(Factory::class, function () { |
|
108 | + $this->app->bind(Factory::class, function() { |
|
109 | 109 | return new Factory( |
110 | - function (Builder $guard) { |
|
110 | + function(Builder $guard) { |
|
111 | 111 | $guard->allow('select'); |
112 | 112 | $guard->allow('distinct'); |
113 | 113 | $guard->allow('where'); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | */ |
33 | 33 | protected function getMethodCalls(array $calls) |
34 | 34 | { |
35 | - return array_map(function ($call) { |
|
35 | + return array_map(function($call) { |
|
36 | 36 | return new MethodCall($call[0], $call[1]); |
37 | 37 | }, $calls); |
38 | 38 | } |
@@ -117,7 +117,7 @@ |
||
117 | 117 | |
118 | 118 | $alternates = explode('|', $pattern); |
119 | 119 | |
120 | - return !! array_first($alternates, function ($index, $pattern) use ($value) { |
|
120 | + return ! ! array_first($alternates, function($index, $pattern) use ($value) { |
|
121 | 121 | |
122 | 122 | $firstCharacter = substr($pattern, 0, 1); |
123 | 123 | $remainder = substr($pattern, 1); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | public function test(MethodCall $call) |
31 | 31 | { |
32 | - return !! array_first($this->rules, function ($index, $rule) use ($call) { |
|
32 | + return ! ! array_first($this->rules, function($index, $rule) use ($call) { |
|
33 | 33 | return $rule->test($call); |
34 | 34 | }); |
35 | 35 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public function parse($classList, $namespace) |
15 | 15 | { |
16 | 16 | return array_map( |
17 | - function ($className) use ($namespace) { |
|
17 | + function($className) use ($namespace) { |
|
18 | 18 | return $this->getFullyQualifiedClassName($className, $namespace); |
19 | 19 | }, |
20 | 20 | array_map('trim', explode(',', $classList)) |