Completed
Push — master ( 748f90...5c1aea )
by Luke
08:07
created
src/CSVelte/IO/Stream.php 2 patches
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -16,14 +16,11 @@
 block discarded – undo
16 16
 use CSVelte\Traits\IsReadable;
17 17
 use CSVelte\Traits\IsWritable;
18 18
 use CSVelte\Traits\IsSeekable;
19
-
20 19
 use CSVelte\Contract\Readable;
21 20
 use CSVelte\Contract\Writable;
22 21
 use CSVelte\Contract\Seekable;
23 22
 
24 23
 use \InvalidArgumentException;
25
-use CSVelte\Exception\NotYetImplementedException;
26
-use CSVelte\Exception\EndOfFileException;
27 24
 use CSVelte\Exception\IOException;
28 25
 
29 26
 /**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             return self::streamize((string) $resource);
145 145
         }
146 146
 
147
-        throw new InvalidArgumentException('Invalid resource type: ' . $type);
147
+        throw new InvalidArgumentException('Invalid resource type: '.$type);
148 148
     }
149 149
 
150 150
     /**
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
                 $stream = @fopen($uri, $mode);
232 232
             } else {
233 233
                 if (!is_array($context)) {
234
-                    throw new InvalidArgumentException("Invalid argument for context. Expected array, got: " . gettype($context));
234
+                    throw new InvalidArgumentException("Invalid argument for context. Expected array, got: ".gettype($context));
235 235
                 }
236 236
                 $context = stream_context_create($context);
237 237
                 $stream = @fopen($uri, $mode, false, $context);
238 238
             }
239 239
             if (false === $stream) {
240
-                throw new IOException("Invalid stream URI: " . $uri, IOException::ERR_INVALID_STREAM_URI);
240
+                throw new IOException("Invalid stream URI: ".$uri, IOException::ERR_INVALID_STREAM_URI);
241 241
             }
242 242
         }
243 243
         if (!is_resource($stream) || get_resource_type($stream) != 'stream') {
244
-            throw new IOException("Expected stream resource, got: " . gettype($stream), IOException::ERR_INVALID_STREAM_RESOURCE);
244
+            throw new IOException("Expected stream resource, got: ".gettype($stream), IOException::ERR_INVALID_STREAM_RESOURCE);
245 245
         }
246 246
         return $stream;
247 247
     }
Please login to merge, or discard this patch.
src/CSVelte/Reader/FilteredIterator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 
74 74
     public function toArray()
75 75
     {
76
-        return array_map(function($row){
76
+        return array_map(function($row) {
77 77
             return $row->toArray();
78 78
         }, iterator_to_array($this));
79 79
     }
Please login to merge, or discard this patch.
src/CSVelte/Flavor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     protected function assertValidAttribute($attr)
193 193
     {
194 194
         if (!property_exists(self::class, $attr))
195
-            throw new InvalidArgumentException("Unknown attribute: " . $attr);
195
+            throw new InvalidArgumentException("Unknown attribute: ".$attr);
196 196
     }
197 197
 
198 198
     /**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      */
242 242
     public function __set($attr, $val)
243 243
     {
244
-        throw new ImmutableException("Cannot change attributes on an immutable object: " . self::class . "::\$" . $attr);
244
+        throw new ImmutableException("Cannot change attributes on an immutable object: ".self::class."::\$".$attr);
245 245
     }
246 246
 
247 247
     public function toArray()
Please login to merge, or discard this patch.
src/CSVelte/Table/AbstractRow.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             } elseif ($fields instanceof Iterator) {
68 68
                 $fields = iterator_to_array($fields);
69 69
             } else {
70
-                throw new InvalidArgumentException(__CLASS__ . " requires an array, got: " . gettype($fields));
70
+                throw new InvalidArgumentException(__CLASS__." requires an array, got: ".gettype($fields));
71 71
             }
72 72
         }
73 73
         $this->fields = array_values($fields);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     protected function assertOffsetExists($offset)
250 250
     {
251 251
         if (!$this->offsetExists($offset)) {
252
-            throw new OutOfBoundsException("Undefined offset: " . $offset);
252
+            throw new OutOfBoundsException("Undefined offset: ".$offset);
253 253
         }
254 254
     }
255 255
 
Please login to merge, or discard this patch.
src/CSVelte/Traits/IsWritable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function writeLine($line, $eol = PHP_EOL)
42 42
     {
43
-        return $this->write($line . $eol);
43
+        return $this->write($line.$eol);
44 44
     }
45 45
 
46 46
     /**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     protected function assertIsWritable()
53 53
     {
54 54
         if (!$this->isWritable()) {
55
-            throw new IOException("Stream not writable: " . $this->getName(), IOException::ERR_NOT_WRITABLE);
55
+            throw new IOException("Stream not writable: ".$this->getName(), IOException::ERR_NOT_WRITABLE);
56 56
         }
57 57
     }
58 58
 
Please login to merge, or discard this patch.
src/CSVelte/Traits/IsReadable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
     protected function assertIsReadable()
76 76
     {
77 77
         if (!$this->isReadable()) {
78
-            throw new IOException("Stream not readable: " . $this->getName(), IOException::ERR_NOT_READABLE);
78
+            throw new IOException("Stream not readable: ".$this->getName(), IOException::ERR_NOT_READABLE);
79 79
         }
80 80
     }
81 81
 
Please login to merge, or discard this patch.
src/CSVelte/Traits/IsSeekable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     protected function assertIsSeekable()
56 56
     {
57 57
         if (!$this->isSeekable()) {
58
-            throw new IOException("Stream not seekable: " . $this->getName(), IOException::ERR_NOT_SEEKABLE);
58
+            throw new IOException("Stream not seekable: ".$this->getName(), IOException::ERR_NOT_SEEKABLE);
59 59
         }
60 60
     }
61 61
 
Please login to merge, or discard this patch.
src/CSVelte/Utils.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         } else {
40 40
             if ($throwException) {
41 41
                 // @todo is this the correct exception to throw?
42
-                throw new \OutOfBoundsException('Unknown array index: ' . $key);
42
+                throw new \OutOfBoundsException('Unknown array index: '.$key);
43 43
             }
44 44
         }
45 45
         return $default;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     public static function average($arr)
58 58
     {
59
-        if (!is_array($arr)) throw new \InvalidArgumentException('"average" function expected array, got ' . gettype($arr));
59
+        if (!is_array($arr)) throw new \InvalidArgumentException('"average" function expected array, got '.gettype($arr));
60 60
         return array_sum($arr) / count($arr);
61 61
     }
62 62
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     public static function mode($arr)
73 73
     {
74
-        if (!is_array($arr)) throw new \InvalidArgumentException('"mode" function expected array, got ' . gettype($arr));
74
+        if (!is_array($arr)) throw new \InvalidArgumentException('"mode" function expected array, got '.gettype($arr));
75 75
         $vals = array();
76 76
         foreach ($arr as $key => $val) {
77 77
             $vals[$val] = self::array_get($vals, $val, 0) + 1;
Please login to merge, or discard this patch.
src/CSVelte/Reader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             do {
186 186
                 if (!isset($lines)) $lines = array();
187 187
                 if (false === ($line = $this->source->readLine($eol))) {
188
-                    throw new EndOfFileException("End of file reached: " . $this->source->getName());
188
+                    throw new EndOfFileException("End of file reached: ".$this->source->getName());
189 189
                 }
190 190
                 array_push($lines, rtrim($line, $eol));
191 191
             } while ($this->inQuotedString(end($lines), $f->quoteChar, $f->escapeChar));
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      */
280 280
     protected function replaceQuotedSpecialChars($data, $delim, $quo, $eol)
281 281
     {
282
-        return preg_replace_callback('/(['. preg_quote($quo, '/') . '])(.*)\1/imsU', function($matches) use ($delim, $eol) {
282
+        return preg_replace_callback('/(['.preg_quote($quo, '/').'])(.*)\1/imsU', function($matches) use ($delim, $eol) {
283 283
             $ret = str_replace($eol, self::PLACEHOLDER_NEWLINE, $matches[0]);
284 284
             $ret = str_replace($delim, self::PLACEHOLDER_DELIM, $ret);
285 285
             return $ret;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
      */
332 332
     protected function unEscape($str, $esc, $quo)
333 333
     {
334
-        return str_replace($esc . $quo, $quo, $str);
334
+        return str_replace($esc.$quo, $quo, $str);
335 335
     }
336 336
 
337 337
     /**
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      */
473 473
     public function toArray()
474 474
     {
475
-        return array_map(function($row){
475
+        return array_map(function($row) {
476 476
             return $row->toArray();
477 477
         }, iterator_to_array($this));
478 478
     }
Please login to merge, or discard this patch.