Completed
Push — master ( d84682...296916 )
by Lars
02:12
created
src/Arrayy.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
   }
52 52
 
53 53
   /**
54
-   * @return mixed
54
+   * @return string
55 55
    */
56 56
   public function serialize()
57 57
   {
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
   /**
197 197
    * get the current array from the "Arrayy"-object
198 198
    *
199
-   * @return array
199
+   * @return null|callable
200 200
    */
201 201
   public function getArray()
202 202
   {
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
    * @param int  $numberOfPieces
847 847
    * @param bool $keepKeys
848 848
    *
849
-   * @return array
849
+   * @return Arrayy
850 850
    */
851 851
   public function split($numberOfPieces = 2, $keepKeys = false)
852 852
   {
@@ -1244,8 +1244,8 @@  discard block
 block discarded – undo
1244 1244
   /**
1245 1245
    * Sort the current array and optional you can keep the keys.
1246 1246
    *
1247
-   * @param string|int $direction use SORT_ASC or SORT_DESC
1248
-   * @param int|string $strategy
1247
+   * @param integer $direction use SORT_ASC or SORT_DESC
1248
+   * @param integer $strategy
1249 1249
    * @param bool       $keepKeys
1250 1250
    *
1251 1251
    * @return Arrayy
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         ||
29 29
         (is_object($array) && method_exists($array, '__toString'))
30 30
     ) {
31
-      $array = (array)$array;
31
+      $array = (array) $array;
32 32
     }
33 33
 
34 34
     if (!is_array($array)) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
       }
191 191
     }
192 192
 
193
-    return (array)$this->array;
193
+    return (array) $this->array;
194 194
   }
195 195
 
196 196
   /**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     // trim all string in the array
241 241
     array_walk(
242 242
         $array,
243
-        function (&$val) {
243
+        function(&$val) {
244 244
           if (is_string($val)) {
245 245
             $val = trim($val);
246 246
           }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
       }
289 289
     }
290 290
 
291
-    return static::create((array)$return);
291
+    return static::create((array) $return);
292 292
   }
293 293
 
294 294
   /**
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
       $return = array($key);
309 309
     }
310 310
 
311
-    return static::create((array)$return);
311
+    return static::create((array) $return);
312 312
   }
313 313
 
314 314
   /**
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
       return false;
365 365
     }
366 366
 
367
-    return (bool)count(array_filter(array_keys($this->array), 'is_string'));
367
+    return (bool) count(array_filter(array_keys($this->array), 'is_string'));
368 368
   }
369 369
 
370 370
   /**
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
   public function clean()
505 505
   {
506 506
     return $this->filter(
507
-        function ($value) {
508
-          return (bool)$value;
507
+        function($value) {
508
+          return (bool) $value;
509 509
         }
510 510
     );
511 511
   }
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
     }
525 525
 
526 526
     if ($take === null) {
527
-      return static::create((array)$this->array[array_rand($this->array)]);
527
+      return static::create((array) $this->array[array_rand($this->array)]);
528 528
     }
529 529
 
530 530
     shuffle($this->array);
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
       $array = array_splice($this->array, 0, $take, true);
600 600
     }
601 601
 
602
-    return static::create((array)$array);
602
+    return static::create((array) $array);
603 603
   }
604 604
 
605 605
   /**
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
   public function last($take = null)
613 613
   {
614 614
     if ($take === null) {
615
-      $array = static::create((array)array_pop($this->array));
615
+      $array = static::create((array) array_pop($this->array));
616 616
     } else {
617 617
       $array = $this->rest(-$take);
618 618
     }
@@ -785,12 +785,12 @@  discard block
 block discarded – undo
785 785
   public function replaceValues($search, $replacement = '')
786 786
   {
787 787
     $array = $this->each(
788
-        function ($value) use ($search, $replacement) {
788
+        function($value) use ($search, $replacement) {
789 789
           return UTF8::str_replace($search, $replacement, $value);
790 790
         }
791 791
     );
792 792
 
793
-    return static::create((array)$array);
793
+    return static::create((array) $array);
794 794
   }
795 795
 
796 796
   /**
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
    */
1185 1185
   public function sorter($sorter = null, $direction = SORT_ASC, $strategy = SORT_REGULAR)
1186 1186
   {
1187
-    $array = (array)$this->array;
1187
+    $array = (array) $this->array;
1188 1188
     $direction = $this->getDirection($direction);
1189 1189
 
1190 1190
     // Transform all values into their results.
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
 
1194 1194
       $that = $this;
1195 1195
       $results = $arrayy->each(
1196
-          function ($value) use ($sorter, $that) {
1196
+          function($value) use ($sorter, $that) {
1197 1197
             return is_callable($sorter) ? $sorter($value) : $that->get($sorter, null, $value);
1198 1198
           }
1199 1199
       );
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
   {
1294 1294
     $this->array = array_reduce(
1295 1295
         $this->array,
1296
-        function ($resultArray, $value) {
1296
+        function($resultArray, $value) {
1297 1297
           if (in_array($value, $resultArray, true) === false) {
1298 1298
             $resultArray[] = $value;
1299 1299
           }
Please login to merge, or discard this patch.
src/ArrayyAbstract.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
   public function has($key)
30 30
   {
31 31
     // Generate unique string to use as marker.
32
-    $unFound = (string)uniqid('arrayy', true);
32
+    $unFound = (string) uniqid('arrayy', true);
33 33
 
34 34
     return $this->get($key, $unFound) !== $unFound;
35 35
   }
@@ -151,48 +151,48 @@  discard block
 block discarded – undo
151 151
     }
152 152
 
153 153
     $ops = array(
154
-        'eq'          => function ($item, $prop, $value) {
154
+        'eq'          => function($item, $prop, $value) {
155 155
           return $item[$prop] === $value;
156 156
         },
157
-        'gt'          => function ($item, $prop, $value) {
157
+        'gt'          => function($item, $prop, $value) {
158 158
           return $item[$prop] > $value;
159 159
         },
160
-        'gte'         => function ($item, $prop, $value) {
160
+        'gte'         => function($item, $prop, $value) {
161 161
           return $item[$prop] >= $value;
162 162
         },
163
-        'lt'          => function ($item, $prop, $value) {
163
+        'lt'          => function($item, $prop, $value) {
164 164
           return $item[$prop] < $value;
165 165
         },
166
-        'lte'         => function ($item, $prop, $value) {
166
+        'lte'         => function($item, $prop, $value) {
167 167
           return $item[$prop] <= $value;
168 168
         },
169
-        'ne'          => function ($item, $prop, $value) {
169
+        'ne'          => function($item, $prop, $value) {
170 170
           return $item[$prop] !== $value;
171 171
         },
172
-        'contains'    => function ($item, $prop, $value) {
173
-          return in_array($item[$prop], (array)$value, true);
172
+        'contains'    => function($item, $prop, $value) {
173
+          return in_array($item[$prop], (array) $value, true);
174 174
         },
175
-        'notContains' => function ($item, $prop, $value) {
176
-          return !in_array($item[$prop], (array)$value, true);
175
+        'notContains' => function($item, $prop, $value) {
176
+          return !in_array($item[$prop], (array) $value, true);
177 177
         },
178
-        'newer'       => function ($item, $prop, $value) {
178
+        'newer'       => function($item, $prop, $value) {
179 179
           return strtotime($item[$prop]) > strtotime($value);
180 180
         },
181
-        'older'       => function ($item, $prop, $value) {
181
+        'older'       => function($item, $prop, $value) {
182 182
           return strtotime($item[$prop]) < strtotime($value);
183 183
         },
184 184
     );
185 185
 
186 186
     $result = array_values(
187 187
         array_filter(
188
-            (array)$this->array,
189
-            function ($item) use (
188
+            (array) $this->array,
189
+            function($item) use (
190 190
                 $property,
191 191
                 $value,
192 192
                 $ops,
193 193
                 $comparisonOp
194 194
             ) {
195
-              $item = (array)$item;
195
+              $item = (array) $item;
196 196
               $itemArrayy = new Arrayy($item);
197 197
               $item[$property] = $itemArrayy->get($property, array());
198 198
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
    */
232 232
   public function keys()
233 233
   {
234
-    $return = array_keys((array)$this->array);
234
+    $return = array_keys((array) $this->array);
235 235
 
236 236
     return Arrayy::create($return);
237 237
   }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
    */
244 244
   public function values()
245 245
   {
246
-    $return = array_values((array)$this->array);
246
+    $return = array_values((array) $this->array);
247 247
 
248 248
     return Arrayy::create($return);
249 249
   }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
    */
279 279
   public function group($grouper, $saveKeys = false)
280 280
   {
281
-    $array = (array)$this->array;
281
+    $array = (array) $this->array;
282 282
     $result = array();
283 283
 
284 284
     // Iterate over values, group by property/results from closure
Please login to merge, or discard this patch.