Passed
Pull Request — develop (#60)
by Glynn
04:45 queued 01:07
created
src/objects.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,10 +168,10 @@  discard block
 block discarded – undo
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);
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
      * @param array<string, mixed> $properties
186 186
      * @return Class
187 187
      */
188
-    return function (array $properties = array()) use ($class, $constructorArgs) {
188
+    return function(array $properties = array()) use ($class, $constructorArgs) {
189 189
         // Loop through constructorArgs and replace with any passed properties.
190 190
         $constructorArgs = array_reduce(
191 191
             array_keys($constructorArgs),
192
-            function (array $args, string $key) use ($constructorArgs, $properties): array {
192
+            function(array $args, string $key) use ($constructorArgs, $properties): array {
193 193
                 $args[] = \array_key_exists($key, $properties)
194
-                    ? $properties[ $key ]
195
-                    : $constructorArgs[ $key ];
194
+                    ? $properties[$key]
195
+                    : $constructorArgs[$key];
196 196
                 return $args;
197 197
             },
198 198
             array()
Please login to merge, or discard this patch.