@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | |
24 | 24 | //BIND the value to the first parameter with the correct type |
25 | 25 | collect($parameters) |
26 | - ->filter(function (\ReflectionParameter $parameter) { |
|
26 | + ->filter(function(\ReflectionParameter $parameter) { |
|
27 | 27 | return $parameter->hasType(); |
28 | 28 | }) |
29 | - ->filter(function (\ReflectionParameter $parameter) use ($result) { |
|
29 | + ->filter(function(\ReflectionParameter $parameter) use ($result) { |
|
30 | 30 | return (gettype($result) === 'object' ? get_class($result) : gettype($result)) === $parameter->getType()->getName(); |
31 | 31 | }) |
32 | - ->each(function (\ReflectionParameter $parameter) use ($result, &$extraParameter) { |
|
32 | + ->each(function(\ReflectionParameter $parameter) use ($result, &$extraParameter) { |
|
33 | 33 | $extraParameter = [$parameter->getName() => $result]; |
34 | 34 | |
35 | 35 | return false; |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | //IF there's not a parameter with the same name as the value type |
44 | 44 | //CHOOSE the first value that doesn't have a type |
45 | 45 | collect($parameters) |
46 | - ->filter(function (\ReflectionParameter $parameter) { |
|
47 | - return ! $parameter->hasType(); |
|
46 | + ->filter(function(\ReflectionParameter $parameter) { |
|
47 | + return !$parameter->hasType(); |
|
48 | 48 | }) |
49 | - ->each(function (\ReflectionParameter $parameter) use ($result, &$extraParameter) { |
|
49 | + ->each(function(\ReflectionParameter $parameter) use ($result, &$extraParameter) { |
|
50 | 50 | if ($extraParameter === null) { |
51 | 51 | $extraParameter = [$parameter->getName() => $result]; |
52 | 52 | } elseif (strcasecmp(substr(strrchr(get_class($result), '\\'), 1), $parameter->getName()) == 0) { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | return $this->jsonResponse($result, $request); |
32 | 32 | } |
33 | 33 | |
34 | - if (method_exists($this, 'htmlResponse') && ! $request->wantsJson()) { |
|
34 | + if (method_exists($this, 'htmlResponse') && !$request->wantsJson()) { |
|
35 | 35 | return $this->htmlResponse($result, $request); |
36 | 36 | } |
37 | 37 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | protected function failHook(Throwable $exception) |
10 | 10 | { |
11 | - if (! method_exists($this, 'onFail')) { |
|
11 | + if (!method_exists($this, 'onFail')) { |
|
12 | 12 | throw $exception; |
13 | 13 | } |
14 | 14 | $this->resolveAndCall($this, 'onFail', compact('exception')); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | { |
10 | 10 | protected function resolveAuthorization() |
11 | 11 | { |
12 | - if (! $this->passesAuthorization()) { |
|
12 | + if (!$this->passesAuthorization()) { |
|
13 | 13 | $this->failedAuthorization(); |
14 | 14 | } |
15 | 15 |
@@ -29,10 +29,10 @@ |
||
29 | 29 | protected function resolveAttributeDefaults() |
30 | 30 | { |
31 | 31 | $defaults = collect($this->rules()) |
32 | - ->filter(function ($rule, $key) { |
|
32 | + ->filter(function($rule, $key) { |
|
33 | 33 | return $rule instanceof Attribute && $rule->hasDefault(); |
34 | 34 | }) |
35 | - ->map(function (Attribute $attribute) { |
|
35 | + ->map(function(Attribute $attribute) { |
|
36 | 36 | return $attribute->getDefault(); |
37 | 37 | }) |
38 | 38 | ->toArray(); |
@@ -61,14 +61,14 @@ |
||
61 | 61 | $this->failHook($exception); |
62 | 62 | } |
63 | 63 | |
64 | - return tap($value, function ($value) { |
|
64 | + return tap($value, function($value) { |
|
65 | 65 | $this->successHook($value); |
66 | 66 | }); |
67 | 67 | } |
68 | 68 | |
69 | 69 | public function resolveBeforeHook() |
70 | 70 | { |
71 | - $method = 'as' . Str::studly($this->runningAs); |
|
71 | + $method = 'as'.Str::studly($this->runningAs); |
|
72 | 72 | |
73 | 73 | if (method_exists($this, $method)) { |
74 | 74 | return $this->resolveAndCall($this, $method); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | protected function resolveAndCall($instance, $method, $extras = []) |
16 | 16 | { |
17 | - if (! method_exists($instance, $method)) { |
|
17 | + if (!method_exists($instance, $method)) { |
|
18 | 18 | throw new MethodDoesNotExistException("method $method not found on ".get_class($instance)); |
19 | 19 | } |
20 | 20 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $reflector = new ReflectionMethod($instance, $method); |
29 | 29 | |
30 | - $handler = function ($parameter) use ($extras) { |
|
30 | + $handler = function($parameter) use ($extras) { |
|
31 | 31 | return $this->resolveDependency($parameter, $extras); |
32 | 32 | }; |
33 | 33 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | [$key, $value] = $this->findAttributeFromParameter($parameter->name, $extras); |
40 | 40 | $class = $parameter->getClass(); |
41 | 41 | |
42 | - if ($key && (! $class || $value instanceof $class->name)) { |
|
42 | + if ($key && (!$class || $value instanceof $class->name)) { |
|
43 | 43 | return $value; |
44 | 44 | } |
45 | 45 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $instance = app($class); |
58 | 58 | |
59 | 59 | if (method_exists($instance, 'resolveRouteBinding')) { |
60 | - if (! $key) { |
|
60 | + if (!$key) { |
|
61 | 61 | throw (new ValidationException(Validator::make([], [ |
62 | 62 | $parameterName => 'required', |
63 | 63 | ])))->redirectTo($this->getRedirectUrl()); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | protected function resolveRouteBinding($instance, $value) |
77 | 77 | { |
78 | - if (! $model = $instance->resolveRouteBinding($value)) { |
|
78 | + if (!$model = $instance->resolveRouteBinding($value)) { |
|
79 | 79 | throw (new ModelNotFoundException())->setModel(get_class($instance)); |
80 | 80 | } |
81 | 81 |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | protected function resolveAttributeCasting(array $data) |
10 | 10 | { |
11 | 11 | return collect($this->rules()) |
12 | - ->filter(function ($rule) { |
|
12 | + ->filter(function($rule) { |
|
13 | 13 | return $rule instanceof Attribute; |
14 | 14 | }) |
15 | - ->intersectByKeys($data)->map(function (Attribute $attribute, $key) use ($data) { |
|
15 | + ->intersectByKeys($data)->map(function(Attribute $attribute, $key) use ($data) { |
|
16 | 16 | return $this->processCasting($attribute, $data[$key]); |
17 | 17 | })->toArray(); |
18 | 18 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | return $this->castFromString($type, $value); |
33 | 33 | } |
34 | 34 | |
35 | - if (! ($attribute->cast(null) instanceof Attribute)) { |
|
35 | + if (!($attribute->cast(null) instanceof Attribute)) { |
|
36 | 36 | return $attribute->cast($value); |
37 | 37 | } |
38 | 38 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | foreach ($this->includes() as $key => $included) { |
43 | - if (! array_key_exists($key, $rules)) { |
|
43 | + if (!array_key_exists($key, $rules)) { |
|
44 | 44 | $rules[$key] = 'required'; |
45 | 45 | } |
46 | 46 | } |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | $filtered = []; |
76 | 76 | $rules = collect($this->buildRules()); |
77 | 77 | $keys = $rules->keys(); |
78 | - $rules->each(function ($rules, $key) use ($original, $keys, &$filtered) { |
|
78 | + $rules->each(function($rules, $key) use ($original, $keys, &$filtered) { |
|
79 | 79 | //Allow for array or pipe-delimited rule-sets |
80 | 80 | if (is_string($rules)) { |
81 | 81 | $rules = explode('|', $rules); |
82 | 82 | } |
83 | 83 | //In case a rule requires an element to be an array, look for nested rules |
84 | - $nestedRules = $keys->filter(function ($otherKey) use ($key) { |
|
84 | + $nestedRules = $keys->filter(function($otherKey) use ($key) { |
|
85 | 85 | return strpos($otherKey, "$key.") === 0; |
86 | 86 | }); |
87 | 87 | //If the input must be an array, default missing nested rules to a wildcard |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | |
119 | 119 | protected function resolveValidation() |
120 | 120 | { |
121 | - if (! $this->passesValidation()) { |
|
121 | + if (!$this->passesValidation()) { |
|
122 | 122 | $this->failedValidation(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | return $this; |
126 | 126 | } |
127 | 127 | |
128 | - protected function setValidatorInstance($validator){ |
|
128 | + protected function setValidatorInstance($validator) { |
|
129 | 129 | $this->validator = $validator; |
130 | 130 | } |
131 | 131 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | if (method_exists($this, 'afterValidator')) { |
149 | - $validator->after(function ($validator) { |
|
149 | + $validator->after(function($validator) { |
|
150 | 150 | $this->resolveAndCall($this, 'afterValidator', compact('validator')); |
151 | 151 | }); |
152 | 152 | } |