Passed
Branch refactor/164-removeoldcollecti... (61eb5d)
by Luke
02:41
created
src/CSVelte/Table/AbstractRow.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
     public function __construct($fields)
57 57
     {
58 58
         $this->setFields($fields)
59
-             ->rewind();
59
+                ->rewind();
60 60
     }
61 61
 
62 62
     protected function setFields($fields)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@
 block discarded – undo
242 242
             } elseif ($fields instanceof Iterator) {
243 243
                 $fields = iterator_to_array($fields);
244 244
             } else {
245
-                throw new InvalidArgumentException(__CLASS__ . ' requires an array, got: ' . gettype($fields));
245
+                throw new InvalidArgumentException(__CLASS__.' requires an array, got: '.gettype($fields));
246 246
             }
247 247
         }
248 248
         $this->fields = collect(array_values($fields));
Please login to merge, or discard this patch.
src/CSVelte/Reader.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,8 @@
 block discarded – undo
91 91
     public function __construct($input, $flavor = null)
92 92
     {
93 93
         $this->setSource($input)
94
-             ->setFlavor($flavor)
95
-             ->rewind();
94
+                ->setFlavor($flavor)
95
+                ->rewind();
96 96
     }
97 97
 
98 98
     /**
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -329,7 +329,7 @@
 block discarded – undo
329 329
      * @param string $str The string to unescape
330 330
      * @param string $esc The escape character used
331 331
      * @param string $quo The quote character used
332
-     * @return mixed The string with characters unescaped
332
+     * @return string The string with characters unescaped
333 333
      * @todo This actually shouldn't even be necessary. Characters should be read
334 334
      *     in one at a time and a quote that follows another should just be ignored
335 335
      *     deeming this unnecessary.
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -14,11 +14,9 @@
 block discarded – undo
14 14
 namespace CSVelte;
15 15
 
16 16
 use CSVelte\Contract\Streamable;
17
-
18 17
 use CSVelte\Table\Row;
19 18
 use CSVelte\Table\HeaderRow;
20 19
 use CSVelte\Reader\FilteredIterator as FilteredReader;
21
-
22 20
 use CSVelte\Exception\EndOfFileException;
23 21
 
24 22
 use function
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      */
255 255
     public function toArray()
256 256
     {
257
-        return array_map(function ($row) {
257
+        return array_map(function($row) {
258 258
             return $row->toArray();
259 259
         }, iterator_to_array($this));
260 260
     }
@@ -387,12 +387,12 @@  discard block
 block discarded – undo
387 387
                 if (!isset($i)) {
388 388
                     $i = 0;
389 389
                 }
390
-                $c                 = $line[$i++];
390
+                $c = $line[$i++];
391 391
                 if ($this->escape) {
392 392
                     $this->escape = false;
393 393
                     continue;
394 394
                 }
395
-                $this->escape                     = ($c == $escapeChar);
395
+                $this->escape = ($c == $escapeChar);
396 396
                 if ($c == $quoteChar) {
397 397
                     $this->open = !$this->open;
398 398
                 }
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
      */
429 429
     protected function replaceQuotedSpecialChars($data, $delim, $quo, $eol)
430 430
     {
431
-        return preg_replace_callback('/([' . preg_quote($quo, '/') . '])(.*)\1/imsU', function ($matches) use ($delim, $eol) {
431
+        return preg_replace_callback('/(['.preg_quote($quo, '/').'])(.*)\1/imsU', function($matches) use ($delim, $eol) {
432 432
             $ret = str_replace($eol, self::PLACEHOLDER_NEWLINE, $matches[0]);
433 433
             $ret = str_replace($delim, self::PLACEHOLDER_DELIM, $ret);
434 434
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
     protected function undoReplaceQuotedSpecialChars($data, $delim, $eol)
454 454
     {
455 455
         $replacements = [self::PLACEHOLDER_DELIM => $delim, self::PLACEHOLDER_NEWLINE => $eol];
456
-        if (array_walk($replacements, function ($replacement, $placeholder) use (&$data) {
456
+        if (array_walk($replacements, function($replacement, $placeholder) use (&$data) {
457 457
             $data = str_replace($placeholder, $replacement, $data);
458 458
         })) {
459 459
             return $data;
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
      */
498 498
     protected function unEscape($str, $esc, $quo)
499 499
     {
500
-        return str_replace($esc . $quo, $quo, $str);
500
+        return str_replace($esc.$quo, $quo, $str);
501 501
     }
502 502
 
503 503
     /**
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
         $columns  = explode($f->delimiter, $replaced);
517 517
         $that     = $this;
518 518
 
519
-        return array_map(function ($val) use ($that, $f) {
519
+        return array_map(function($val) use ($that, $f) {
520 520
             $undone = $that->undoReplaceQuotedSpecialChars($val, $f->delimiter, $f->lineTerminator);
521 521
 
522 522
             return $this->unQuote($undone);
Please login to merge, or discard this patch.
src/CSVelte/CSVelte.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         self::assertFileExists($filename);
125 125
         if (!is_readable($filename)) {
126
-            throw new IOException('Permission denied for: ' . $filename, IOException::ERR_FILE_PERMISSION_DENIED);
126
+            throw new IOException('Permission denied for: '.$filename, IOException::ERR_FILE_PERMISSION_DENIED);
127 127
         }
128 128
     }
129 129
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     protected static function assertFileExists($filename)
138 138
     {
139 139
         if (!file_exists($filename)) {
140
-            throw new IOException('File does not exist: ' . $filename, IOException::ERR_FILE_NOT_FOUND);
140
+            throw new IOException('File does not exist: '.$filename, IOException::ERR_FILE_NOT_FOUND);
141 141
         }
142 142
     }
143 143
 }
Please login to merge, or discard this patch.
src/CSVelte/Exception/HeaderException.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,6 @@
 block discarded – undo
19 19
 if (if $file->hasHeader()) {
20 20
     $header = $file->getHeader()
21 21
 }
22
-
23 22
  * you can instead simply call $header->getHeader() and handle this exception if
24 23
  * said file has no header
25 24
  *
Please login to merge, or discard this patch.
src/CSVelte/Traits/IsWritable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 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
     /**
Please login to merge, or discard this patch.
src/CSVelte/Taster.php 5 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -692,7 +692,7 @@
 block discarded – undo
692 692
      *
693 693
      * @param string $data The data to check
694 694
      *
695
-     * @return bool Whether the data is quoted or not
695
+     * @return integer Whether the data is quoted or not
696 696
      */
697 697
     protected function isQuoted($data)
698 698
     {
Please login to merge, or discard this patch.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -14,13 +14,10 @@
 block discarded – undo
14 14
 namespace CSVelte;
15 15
 
16 16
 use CSVelte\Collection\AbstractCollection;
17
-use CSVelte\Collection\Collection;
18
-use CSVelte\Collection\MultiCollection;
19 17
 use CSVelte\Collection\NumericCollection;
20 18
 use CSVelte\Collection\TabularCollection;
21 19
 use CSVelte\Contract\Streamable;
22 20
 use CSVelte\Exception\TasterException;
23
-
24 21
 use DateTime;
25 22
 use Exception;
26 23
 use OutOfBoundsException;
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -514,12 +514,12 @@  discard block
 block discarded – undo
514 514
                 return $this->guessDelimByDistribution($decision, $eol);
515 515
             } catch (TasterException $e) {
516 516
                 // if somehow we STILL can't come to a consensus, then fall back to a
517
-                 // "preferred delimiters" list...
518
-                 foreach ($this->delims as $key => $val) {
519
-                     if ($delim = array_search($val, $decision)) {
520
-                         return $delim;
521
-                     }
522
-                 }
517
+                    // "preferred delimiters" list...
518
+                    foreach ($this->delims as $key => $val) {
519
+                        if ($delim = array_search($val, $decision)) {
520
+                            return $delim;
521
+                        }
522
+                    }
523 523
             }
524 524
         }
525 525
 
@@ -589,8 +589,8 @@  discard block
 block discarded – undo
589 589
             })->map(function ($dists) {
590 590
                 return $dists->average();
591 591
             })->sort()
592
-              ->reverse()
593
-              ->getKeyAtPosition(0)];
592
+                ->reverse()
593
+                ->getKeyAtPosition(0)];
594 594
         } catch (Exception $e) {
595 595
             throw new TasterException('delimiter cannot be determined by distribution', TasterException::ERR_DELIMITER);
596 596
         }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
         $types = new TabularCollection();
233 233
 
234 234
         // callback to build the aforementioned collection
235
-        $buildTypes = function ($line, $line_no) use ($types, $delim, $eol) {
235
+        $buildTypes = function($line, $line_no) use ($types, $delim, $eol) {
236 236
 
237 237
             if ($line_no > 2) return;
238 238
             $line = str_replace(self::PLACEHOLDER_NEWLINE, $eol, $line);
239
-            $getType = function ($field, $colpos) use ($types, $line, $line_no, $delim) {
239
+            $getType = function($field, $colpos) use ($types, $line, $line_no, $delim) {
240 240
                 $field = str_replace(self::PLACEHOLDER_DELIM, $delim, $field);
241 241
                 $fieldMeta = [
242 242
                     "value" => $field,
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 
265 265
         $hasHeader = new NumericCollection();
266 266
         $possibleHeader = collect($types->shift());
267
-        $types->walk(function (AbstractCollection $row) use ($hasHeader, $possibleHeader) {
268
-            $row->walk(function (AbstractCollection $fieldMeta, $col_no) use ($hasHeader, $possibleHeader) {
267
+        $types->walk(function(AbstractCollection $row) use ($hasHeader, $possibleHeader) {
268
+            $row->walk(function(AbstractCollection $fieldMeta, $col_no) use ($hasHeader, $possibleHeader) {
269 269
                 try {
270 270
                     $col = collect($possibleHeader->get($col_no, null, true));
271 271
                     if ($fieldMeta->get('type') == self::TYPE_STRING) {
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
     {
330 330
         $str  = $this->removeQuotedStrings($this->sample);
331 331
         $eols = [
332
-            self::EOL_WINDOWS => "\r\n",  // 0x0D - 0x0A - Windows, DOS OS/2
333
-            self::EOL_UNIX    => "\n",    // 0x0A -      - Unix, OSX
334
-            self::EOL_TRS80   => "\r",    // 0x0D -      - Apple ][, TRS80
332
+            self::EOL_WINDOWS => "\r\n", // 0x0D - 0x0A - Windows, DOS OS/2
333
+            self::EOL_UNIX    => "\n", // 0x0A -      - Unix, OSX
334
+            self::EOL_TRS80   => "\r", // 0x0D -      - Apple ][, TRS80
335 335
         ];
336 336
 
337 337
         $curCount = 0;
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
         $patterns = [];
375 375
         // delim can be anything but line breaks, quotes, alphanumeric, underscore, backslash, or any type of spaces
376 376
         $antidelims = implode(["\r", "\n", "\w", preg_quote('"', '/'), preg_quote("'", '/'), preg_quote(chr(self::SPACE), '/')]);
377
-        $delim      = '(?P<delim>[^' . $antidelims . '])';
377
+        $delim      = '(?P<delim>[^'.$antidelims.'])';
378 378
         $quote      = '(?P<quoteChar>"|\'|`)'; // @todo I think MS Excel uses some strange encoding for fancy open/close quotes
379
-        $patterns[] = '/' . $delim . ' ?' . $quote . '.*?\2\1/ms'; // ,"something", - anything but whitespace or quotes followed by a possible space followed by a quote followed by anything followed by same quote, followed by same anything but whitespace
380
-        $patterns[] = '/(?:^|\n)' . $quote . '.*?\1' . $delim . ' ?/ms'; // 'something', - beginning of line or line break, followed by quote followed by anything followed by quote followed by anything but whitespace or quotes
381
-        $patterns[] = '/' . $delim . ' ?' . $quote . '.*?\2(?:^|\n)/ms'; // ,'something' - anything but whitespace or quote followed by possible space followed by quote followed by anything followed by quote, followed by end of line
382
-        $patterns[] = '/(?:^|\n)' . $quote . '.*?\2(?:$|\n)/ms'; // 'something' - beginning of line followed by quote followed by anything followed by quote followed by same quote followed by end of line
379
+        $patterns[] = '/'.$delim.' ?'.$quote.'.*?\2\1/ms'; // ,"something", - anything but whitespace or quotes followed by a possible space followed by a quote followed by anything followed by same quote, followed by same anything but whitespace
380
+        $patterns[] = '/(?:^|\n)'.$quote.'.*?\1'.$delim.' ?/ms'; // 'something', - beginning of line or line break, followed by quote followed by anything followed by quote followed by anything but whitespace or quotes
381
+        $patterns[] = '/'.$delim.' ?'.$quote.'.*?\2(?:^|\n)/ms'; // ,'something' - anything but whitespace or quote followed by possible space followed by quote followed by anything followed by quote, followed by end of line
382
+        $patterns[] = '/(?:^|\n)'.$quote.'.*?\2(?:$|\n)/ms'; // 'something' - beginning of line followed by quote followed by anything followed by quote followed by same quote followed by end of line
383 383
         foreach ($patterns as $pattern) {
384 384
             // @todo I had to add the error suppression char here because it was
385 385
             //     causing undefined offset errors with certain data sets. strange...
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
             }
389 389
         }
390 390
         if ($matches) {
391
-            $qcad = array_intersect_key($matches, array_flip(['quoteChar','delim']));
391
+            $qcad = array_intersect_key($matches, array_flip(['quoteChar', 'delim']));
392 392
             if (!empty($matches['quoteChar']) && !empty($matches['delim'])) {
393 393
                 try {
394 394
                     return [
@@ -430,15 +430,15 @@  discard block
 block discarded – undo
430 430
         // each frequency (in 10 lines, "tab" occurred 5 times on 7 of those
431 431
         // lines, 6 times on 2 lines, and 7 times on 1 line)
432 432
         collect(explode($eol, $this->removeQuotedStrings($this->sample)))
433
-            ->walk(function ($line, $line_no) use ($frequencies) {
433
+            ->walk(function($line, $line_no) use ($frequencies) {
434 434
                 collect(str_split($line))
435
-                    ->filter(function ($c) {
435
+                    ->filter(function($c) {
436 436
                         return collect($this->delims)->contains($c);
437 437
                     })
438 438
                     ->frequency()
439 439
                     ->sort()
440 440
                     ->reverse()
441
-                    ->walk(function ($count, $char) use ($frequencies, $line_no) {
441
+                    ->walk(function($count, $char) use ($frequencies, $line_no) {
442 442
                         try {
443 443
                             $char_counts = $frequencies->get($char, null, true);
444 444
                         } catch (OutOfBoundsException $e) {
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
             // the above only finds frequencies for characters if they exist in
452 452
             // a given line. This will go back and fill in zeroes where a char
453 453
             // didn't occur at all in a given line (needed to determine mode)
454
-            ->walk(function ($line, $line_no) use ($frequencies) {
455
-                $frequencies->walk(function ($counts, $char) use ($line_no, $frequencies) {
454
+            ->walk(function($line, $line_no) use ($frequencies) {
455
+                $frequencies->walk(function($counts, $char) use ($line_no, $frequencies) {
456 456
                     try {
457 457
                         $char_counts = $frequencies->get($char, null, true);
458 458
                     } catch (OutOfBoundsException $e) {
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
         foreach ($freqs as $char => $freq) {
473 473
             $modes->set($char, collect($freq)->mode());
474 474
         }
475
-        $freqs->walk(function ($f, $chr) use ($modes, $consistencies) {
476
-            collect($f)->walk(function ($num) use ($modes, $chr, $consistencies) {
475
+        $freqs->walk(function($f, $chr) use ($modes, $consistencies) {
476
+            collect($f)->walk(function($num) use ($modes, $chr, $consistencies) {
477 477
                 if ($expected = $modes->get($chr)) {
478 478
                     if ($num == $expected) {
479 479
                         // met the goal, yay!
@@ -565,19 +565,19 @@  discard block
 block discarded – undo
565 565
             // @todo Write a method that does this...
566 566
             $lines = collect(explode($eol, $this->removeQuotedStrings($this->sample)));
567 567
 
568
-            return $delims[collect($delims)->map(function ($delim) use (&$distrib, $lines) {
568
+            return $delims[collect($delims)->map(function($delim) use (&$distrib, $lines) {
569 569
                 $linedist = collect();
570
-                $lines->walk(function ($line, $line_no) use (&$linedist, $delim) {
570
+                $lines->walk(function($line, $line_no) use (&$linedist, $delim) {
571 571
                     if (!strlen($line)) {
572 572
                         return;
573 573
                     }
574 574
                     $sectstot = 10;
575 575
                     $sectlen = (int) (strlen($line) / $sectstot);
576 576
                     $sections = collect(str_split($line, $sectlen))
577
-                        ->map(function ($section) use ($delim) {
577
+                        ->map(function($section) use ($delim) {
578 578
                             return substr_count($section, $delim);
579 579
                         })
580
-                        ->filter(function ($count) {
580
+                        ->filter(function($count) {
581 581
                             return (bool) $count;
582 582
                         });
583 583
                     if (is_numeric($count = $sections->count())) {
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
                 });
587 587
 
588 588
                 return $linedist;
589
-            })->map(function ($dists) {
589
+            })->map(function($dists) {
590 590
                 return $dists->average();
591 591
             })->sort()
592 592
               ->reverse()
@@ -636,9 +636,9 @@  discard block
 block discarded – undo
636 636
 
637 637
         // walk through each line from the data sample to determine which fields
638 638
         // are quoted and which aren't
639
-        $qsFunc = function ($line) use (&$quoting_styles, &$freq, $eol, $delim) {
639
+        $qsFunc = function($line) use (&$quoting_styles, &$freq, $eol, $delim) {
640 640
             $line     = str_replace(self::PLACEHOLDER_NEWLINE, $eol, $line);
641
-            $qnqaFunc = function ($field) use (&$quoting_styles, &$freq, $delim) {
641
+            $qnqaFunc = function($field) use (&$quoting_styles, &$freq, $delim) {
642 642
                 $field = str_replace(self::PLACEHOLDER_DELIM, $delim, $field);
643 643
                 if ($this->isQuoted($field)) {
644 644
                     $field = $this->unQuote($field);
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
         $lines->walk($qsFunc->bindTo($this));
660 660
 
661 661
         $types          = $freq->get('quoted')->unique();
662
-        $quoting_styles = $quoting_styles->filter(function ($val) {
662
+        $quoting_styles = $quoting_styles->filter(function($val) {
663 663
             return (bool) $val;
664 664
         });
665 665
         // if quoting_styles still has QUOTE_ALL or QUOTE_NONE, then return
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
             if ($types->contains(self::DATA_NONNUMERIC)) {
680 680
                 // allow for a SMALL amount of error here
681 681
                 $counts = collect([self::DATA_SPECIAL => 0, self::DATA_NONNUMERIC => 0]);
682
-                $freq->get('quoted')->walk(function ($type) use (&$counts) {
682
+                $freq->get('quoted')->walk(function($type) use (&$counts) {
683 683
                     $counts->increment($type);
684 684
                 });
685 685
                 // @todo is all this even necessary? seems unnecessary to me...
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
      */
773 773
     protected function replaceQuotedSpecialChars($data, $delim)
774 774
     {
775
-        return preg_replace_callback('/([\'"])(.*)\1/imsU', function ($matches) use ($delim) {
775
+        return preg_replace_callback('/([\'"])(.*)\1/imsU', function($matches) use ($delim) {
776 776
             $ret = preg_replace("/([\r\n])/", self::PLACEHOLDER_NEWLINE, $matches[0]);
777 777
             $ret = str_replace($delim, self::PLACEHOLDER_DELIM, $ret);
778 778
 
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
             $day   = '[0-3]?[0-9]';
813 813
             $sep   = '[\/\.\-]?';
814 814
             $time  = '([0-2]?[0-9](:[0-5][0-9]){1,2}(am|pm)?|[01]?[0-9](am|pm))';
815
-            $date  = '(' . $month . $sep . $day . $sep . $year . '|' . $day . $sep . $month . $sep . $year . '|' . $year . $sep . $month . $sep . $day . ')';
815
+            $date  = '('.$month.$sep.$day.$sep.$year.'|'.$day.$sep.$month.$sep.$year.'|'.$year.$sep.$month.$sep.$day.')';
816 816
             $dt    = new DateTime($data);
817 817
             $dt->setTime(0, 0, 0);
818 818
             $now = new DateTime();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -234,7 +234,9 @@
 block discarded – undo
234 234
         // callback to build the aforementioned collection
235 235
         $buildTypes = function ($line, $line_no) use ($types, $delim, $eol) {
236 236
 
237
-            if ($line_no > 2) return;
237
+            if ($line_no > 2) {
238
+                return;
239
+            }
238 240
             $line = str_replace(self::PLACEHOLDER_NEWLINE, $eol, $line);
239 241
             $getType = function ($field, $colpos) use ($types, $line, $line_no, $delim) {
240 242
                 $field = str_replace(self::PLACEHOLDER_DELIM, $delim, $field);
Please login to merge, or discard this patch.
src/CSVelte/Autoloader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
             if (in_array($rp, $paths)) {
71 71
                 return true;
72 72
             }
73
-            $this->paths []= $rp;
73
+            $this->paths [] = $rp;
74 74
 
75 75
             return true;
76 76
         }
77
-        $this->paths []= $path;
77
+        $this->paths [] = $path;
78 78
 
79 79
         return false;
80 80
     }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $fqcp  = str_replace(self::NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, $className);
133 133
         $paths = $this->getPaths();
134 134
         foreach ($paths as $path) {
135
-            $classPath = $path . DIRECTORY_SEPARATOR . $fqcp . '.php';
135
+            $classPath = $path.DIRECTORY_SEPARATOR.$fqcp.'.php';
136 136
             if (file_exists($classPath) && is_readable($classPath)) {
137 137
                 require_once($classPath);
138 138
 
Please login to merge, or discard this patch.
src/CSVelte/Writer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         if (is_array($headers)) {
115 115
             $headers = new ArrayIterator($headers);
116 116
         }
117
-        $this->headers                   = $headers;
117
+        $this->headers = $headers;
118 118
 
119 119
         return $this;
120 120
     }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if (is_array($row)) {
138 138
             $row = new ArrayIterator($row);
139 139
         }
140
-        $row                     = $this->prepareRow($row);
140
+        $row = $this->prepareRow($row);
141 141
         if ($count = $this->output->writeLine($row->join($delim), $eol)) {
142 142
             $this->written++;
143 143
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             $rows = new ArrayIterator($rows);
161 161
         }
162 162
         if (!($rows instanceof Iterator)) {
163
-            throw new InvalidArgumentException('First argument for ' . __METHOD__ . ' must be iterable');
163
+            throw new InvalidArgumentException('First argument for '.__METHOD__.' must be iterable');
164 164
         }
165 165
         $written = 0;
166 166
         if ($rows instanceof Reader) {
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     {
204 204
         $items = [];
205 205
         foreach ($row as $data) {
206
-            $items []= $this->prepareData($data);
206
+            $items [] = $this->prepareData($data);
207 207
         }
208 208
         $row = new Row($items);
209 209
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
         // Normally I would make this a method on the class, but I don't intend
241 241
         // to use it for very long, in fact, once I finish writing the Data class
242 242
         // it is gonezo!
243
-        $hasSpecialChars = function ($s) use ($flvr) {
244
-            $specialChars = preg_quote($flvr->lineTerminator . $flvr->quoteChar . $flvr->delimiter);
243
+        $hasSpecialChars = function($s) use ($flvr) {
244
+            $specialChars = preg_quote($flvr->lineTerminator.$flvr->quoteChar.$flvr->delimiter);
245 245
             $pattern      = "/[{$specialChars}]/m";
246 246
 
247 247
             return preg_match($pattern, $s);
@@ -289,6 +289,6 @@  discard block
 block discarded – undo
289 289
             $escapeQuote = ($flvr->doubleQuote) ? $flvr->quoteChar : $flvr->escapeChar;
290 290
         }
291 291
         // @todo Not sure what else, if anything, I'm supposed to be escaping here..
292
-        return str_replace($flvr->quoteChar, $escapeQuote . $flvr->quoteChar, $str);
292
+        return str_replace($flvr->quoteChar, $escapeQuote.$flvr->quoteChar, $str);
293 293
     }
294 294
 }
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
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function __set($attr, $val)
206 206
     {
207
-        throw new ImmutableException('Cannot change attributes on an immutable object: ' . self::class . '::$' . $attr);
207
+        throw new ImmutableException('Cannot change attributes on an immutable object: '.self::class.'::$'.$attr);
208 208
     }
209 209
 
210 210
     /**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     protected function assertValidAttribute($attr)
271 271
     {
272 272
         if (!property_exists(self::class, $attr)) {
273
-            throw new InvalidArgumentException('Unknown attribute: ' . $attr);
273
+            throw new InvalidArgumentException('Unknown attribute: '.$attr);
274 274
         }
275 275
     }
276 276
 }
Please login to merge, or discard this patch.