Completed
Push — releases/v0.2.1 ( b63a3e...ff9fbc )
by Luke
02:49
created
src/CSVelte/Collection.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     public function toArray()
195 195
     {
196 196
         $data = [];
197
-        foreach($this->data as $key => $val) {
197
+        foreach ($this->data as $key => $val) {
198 198
             $data[$key] = (is_object($val) && method_exists($val, 'toArray')) ? $val->toArray() : $val;
199 199
         }
200 200
         return $data;
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
             if ($i === $pos) return $key;
370 370
             $i++;
371 371
         }
372
-        throw new OutOfBoundsException("Collection data does not contain a key at given position: " . $pos);
372
+        throw new OutOfBoundsException("Collection data does not contain a key at given position: ".$pos);
373 373
     }
374 374
 
375 375
     /**
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
             return $this->data[$key];
555 555
         } else {
556 556
             if ($throwExc) {
557
-                throw new OutOfBoundsException("Collection data does not contain value for given key: " . $key);
557
+                throw new OutOfBoundsException("Collection data does not contain value for given key: ".$key);
558 558
             }
559 559
         }
560 560
         return $default;
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
     public function pairs($alt = false)
900 900
     {
901 901
         return new self(array_map(
902
-            function ($key, $val) use ($alt) {
902
+            function($key, $val) use ($alt) {
903 903
                 if ($alt) {
904 904
                     return [$key => $val];
905 905
                 } else {
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
         if (false !== ($condRet = $this->if2DMapInternalMethod(__METHOD__))) {
982 982
             return $condRet;
983 983
         }
984
-        $strvals = $this->map(function($val){
984
+        $strvals = $this->map(function($val) {
985 985
             return (string) $val;
986 986
         });
987 987
         $this->assertNumericValues();
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
         $this->assertIsTabular();
1096 1096
         return $this->sort(function($a, $b) use ($key, $cmp) {
1097 1097
             if (!isset($a[$key]) || !isset($b[$key])) {
1098
-                throw new RuntimeException('Cannot order collection by non-existant key: ' . $key);
1098
+                throw new RuntimeException('Cannot order collection by non-existant key: '.$key);
1099 1099
             }
1100 1100
             if (is_null($cmp)) {
1101 1101
                 return strcasecmp($a[$key], $b[$key]);
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
      */
1143 1143
     public function is2D()
1144 1144
     {
1145
-        return !$this->contains(function($val){
1145
+        return !$this->contains(function($val) {
1146 1146
             return !is_array($val);
1147 1147
         });
1148 1148
         return false;
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
     protected function assertNumericValues()
1214 1214
     {
1215
-        if ($this->contains(function($val){
1215
+        if ($this->contains(function($val) {
1216 1216
             return !is_numeric($val);
1217 1217
         })) {
1218 1218
             // can't average non-numeric data
@@ -1228,6 +1228,6 @@  discard block
 block discarded – undo
1228 1228
         if (is_null($data) || is_array($data) || $data instanceof Iterator) {
1229 1229
             return;
1230 1230
         }
1231
-        throw new InvalidArgumentException("Invalid type for collection data: " . gettype($data));
1231
+        throw new InvalidArgumentException("Invalid type for collection data: ".gettype($data));
1232 1232
     }
1233 1233
 }
Please login to merge, or discard this patch.