@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | if (is_object($class)) { |
| 53 | 53 | $class = get_class($class); |
| 54 | 54 | } |
| 55 | - if (! class_exists($class)) { |
|
| 55 | + if (!class_exists($class)) { |
|
| 56 | 56 | throw new InvalidArgumentException(__FUNCTION__ . 'only accepts a Class or Class Name'); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | * @param Class $value |
| 61 | 61 | * @return bool |
| 62 | 62 | */ |
| 63 | - return function ($value) use ($class): bool { |
|
| 63 | + return function($value) use ($class): bool { |
|
| 64 | 64 | if (is_object($value)) { |
| 65 | 65 | $value = get_class($value); |
| 66 | 66 | } |
| 67 | - if (! class_exists($value)) { |
|
| 67 | + if (!class_exists($value)) { |
|
| 68 | 68 | throw new InvalidArgumentException(__FUNCTION__ . 'only accepts a Class or Class Name'); |
| 69 | 69 | } |
| 70 | 70 | return is_a($value, $class, true); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @param Class $class |
| 85 | 85 | * @return bool |
| 86 | 86 | */ |
| 87 | - return function ($class) use ($interface): bool { |
|
| 87 | + return function($class) use ($interface): bool { |
|
| 88 | 88 | return in_array( |
| 89 | 89 | $interface, |
| 90 | 90 | class_implements($class, false) ?: array(), |
@@ -105,18 +105,18 @@ discard block |
||
| 105 | 105 | * @param object $object |
| 106 | 106 | * @return array<string, mixed> |
| 107 | 107 | */ |
| 108 | - return function ($object): array { |
|
| 108 | + return function($object): array { |
|
| 109 | 109 | |
| 110 | 110 | // If not object, return empty array. |
| 111 | - if (! is_object($object)) { |
|
| 111 | + if (!is_object($object)) { |
|
| 112 | 112 | return array(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $objectVars = get_object_vars($object); |
| 116 | 116 | return array_reduce( |
| 117 | 117 | array_keys($objectVars), |
| 118 | - function (array $array, $key) use ($objectVars): array { |
|
| 119 | - $array[ ltrim((string) $key, '_') ] = $objectVars[ $key ]; |
|
| 118 | + function(array $array, $key) use ($objectVars): array { |
|
| 119 | + $array[ltrim((string) $key, '_')] = $objectVars[$key]; |
|
| 120 | 120 | return $array; |
| 121 | 121 | }, |
| 122 | 122 | array() |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | * @param object|class-string $object |
| 139 | 139 | * @return bool |
| 140 | 140 | */ |
| 141 | - return function ($object) use ($trait, $autoload): bool { |
|
| 141 | + return function($object) use ($trait, $autoload): bool { |
|
| 142 | 142 | // Throw type error if not object or class-string. |
| 143 | - if (! is_object($object) && ! class_exists($object, false)) { |
|
| 143 | + if (!is_object($object) && !class_exists($object, false)) { |
|
| 144 | 144 | throw new InvalidArgumentException(__FUNCTION__ . ' only accepts an object or class-string'); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -168,14 +168,14 @@ discard block |
||
| 168 | 168 | $constructorArgs = $constructor->getConstructor() ? $constructor->getConstructor()->getParameters() : array(); |
| 169 | 169 | $constructorArgs = array_reduce( |
| 170 | 170 | $constructorArgs, |
| 171 | - function (array $args, \ReflectionParameter $param) use ($baseProperties): array { |
|
| 171 | + function(array $args, \ReflectionParameter $param) use ($baseProperties): array { |
|
| 172 | 172 | // If the param exists in base properties use that, else use the default value or null. |
| 173 | - $args[ $param->getName() ] = \array_key_exists($param->getName(), $baseProperties) |
|
| 174 | - ? $baseProperties[ $param->getName() ] |
|
| 173 | + $args[$param->getName()] = \array_key_exists($param->getName(), $baseProperties) |
|
| 174 | + ? $baseProperties[$param->getName()] |
|
| 175 | 175 | : ($param->isDefaultValueAvailable() |
| 176 | 176 | ? $param->getDefaultValue() |
| 177 | 177 | : null); |
| 178 | -dump([ ($param->isDefaultValueAvailable() |
|
| 178 | +dump([($param->isDefaultValueAvailable() |
|
| 179 | 179 | ? $param->getDefaultValue() |
| 180 | 180 | : null)]); |
| 181 | 181 | |
@@ -188,14 +188,14 @@ discard block |
||
| 188 | 188 | * @param array<string, mixed> $properties |
| 189 | 189 | * @return Class |
| 190 | 190 | */ |
| 191 | - return function (array $properties = array()) use ($class, $constructorArgs) { |
|
| 191 | + return function(array $properties = array()) use ($class, $constructorArgs) { |
|
| 192 | 192 | // Loop through constructorArgs and replace with any passed properties. |
| 193 | 193 | $constructorArgs = array_reduce( |
| 194 | 194 | array_keys($constructorArgs), |
| 195 | - function (array $args, string $key) use ($constructorArgs, $properties): array { |
|
| 195 | + function(array $args, string $key) use ($constructorArgs, $properties): array { |
|
| 196 | 196 | $args[] = \array_key_exists($key, $properties) |
| 197 | - ? $properties[ $key ] |
|
| 198 | - : $constructorArgs[ $key ]; |
|
| 197 | + ? $properties[$key] |
|
| 198 | + : $constructorArgs[$key]; |
|
| 199 | 199 | return $args; |
| 200 | 200 | }, |
| 201 | 201 | array() |