@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $this->direction = $direction; |
| 22 | 22 | $this->flags = $flags; |
| 23 | 23 | $this->callback = \Closure::fromCallable($callback); |
| 24 | - $this->realCallback = $direction == self::SORT_ASC ? $this->callback : function ($cmpA, $cmpB) { |
|
| 24 | + $this->realCallback = $direction == self::SORT_ASC ? $this->callback : function($cmpA, $cmpB) { |
|
| 25 | 25 | return ($this->callback)($cmpB, $cmpA); |
| 26 | 26 | }; |
| 27 | 27 | parent::__construct($this->getSortedIterator($iterator)); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | { |
| 141 | 141 | $callback = \Closure::fromCallable($callback); |
| 142 | 142 | $input->rewind(); |
| 143 | - iterator_apply($input, function (\Iterator $iterator) use ($callback) { |
|
| 143 | + iterator_apply($input, function(\Iterator $iterator) use ($callback) { |
|
| 144 | 144 | $callback($iterator->current(), $iterator->key(), $iterator, $this); |
| 145 | 145 | return true; |
| 146 | 146 | }, [$input]); |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | // Rewind this temp file and compare it with the specified file. |
| 195 | 195 | $identical = true; |
| 196 | 196 | $tempFile->fseek(0); |
| 197 | - while(!$file->eof()) { |
|
| 198 | - if($file->fread(8192) != $tempFile->fread(8192)) { |
|
| 197 | + while (!$file->eof()) { |
|
| 198 | + if ($file->fread(8192) != $tempFile->fread(8192)) { |
|
| 199 | 199 | $identical = false; |
| 200 | 200 | break; |
| 201 | 201 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $realPath = $path ? $path : './'; |
| 37 | 37 | $realPath = rtrim($realPath, '/') . '/'; |
| 38 | 38 | |
| 39 | - $flags = $flags &~ \FilesystemIterator::CURRENT_AS_PATHNAME; |
|
| 39 | + $flags = $flags & ~ \FilesystemIterator::CURRENT_AS_PATHNAME; |
|
| 40 | 40 | $flags |= \FilesystemIterator::KEY_AS_PATHNAME; |
| 41 | 41 | $iterator = new \RecursiveDirectoryIterator($realPath, $flags); |
| 42 | 42 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | GlobIteratorFileInfo::setPath($iteratorId, $path, $realPath); |
| 58 | 58 | |
| 59 | 59 | // Actual glob filtering. |
| 60 | - $fIterator = new \CallbackFilterIterator($rIterator, function (&$current, &$key, $iterator) use ($iteratorId, $regexPattern) { |
|
| 60 | + $fIterator = new \CallbackFilterIterator($rIterator, function(&$current, &$key, $iterator) use ($iteratorId, $regexPattern) { |
|
| 61 | 61 | GlobIteratorFileInfo::setIteratorId($iteratorId); |
| 62 | 62 | $fileInfo = $current->getFileInfo(GlobIteratorFileInfo::class); |
| 63 | 63 | if ($this->flags & \FilesystemIterator::CURRENT_AS_PATHNAME) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | public static function reduce(\Traversable $iterator, callable $callback, $initial = null) |
| 34 | 34 | { |
| 35 | 35 | $callback = \Closure::fromCallable($callback); |
| 36 | - iterator_apply($iterator, function ($iterator) use (&$initial, $callback) { |
|
| 36 | + iterator_apply($iterator, function($iterator) use (&$initial, $callback) { |
|
| 37 | 37 | $initial = $callback($initial, $iterator->current(), $iterator->key()); |
| 38 | 38 | return true; |
| 39 | 39 | }, [$iterator]); |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public static function sum(\Traversable $iterator) |
| 44 | 44 | { |
| 45 | - return self::reduce($iterator, function ($carry, $value, $key) { |
|
| 45 | + return self::reduce($iterator, function($carry, $value, $key) { |
|
| 46 | 46 | return $carry + $value; |
| 47 | 47 | }, 0); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public static function product(\Traversable $iterator) |
| 51 | 51 | { |
| 52 | - return self::reduce($iterator, function ($carry, $value, $key) { |
|
| 52 | + return self::reduce($iterator, function($carry, $value, $key) { |
|
| 53 | 53 | return $carry * $value; |
| 54 | 54 | }, 1); |
| 55 | 55 | } |
@@ -61,28 +61,28 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public static function min(\Traversable $iterator) |
| 63 | 63 | { |
| 64 | - return self::reduce($iterator, function ($carry, $value, $key) { |
|
| 64 | + return self::reduce($iterator, function($carry, $value, $key) { |
|
| 65 | 65 | return $carry < $value ? $carry : $value; |
| 66 | 66 | }, INF); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public static function max(\Traversable $iterator) |
| 70 | 70 | { |
| 71 | - return self::reduce($iterator, function ($carry, $value, $key) { |
|
| 71 | + return self::reduce($iterator, function($carry, $value, $key) { |
|
| 72 | 72 | return $carry > $value ? $carry : $value; |
| 73 | 73 | }, -INF); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public static function concatenate(\Traversable $iterator) |
| 77 | 77 | { |
| 78 | - return self::reduce($iterator, function ($carry, $value, $key) { |
|
| 78 | + return self::reduce($iterator, function($carry, $value, $key) { |
|
| 79 | 79 | return $carry . $value; |
| 80 | 80 | }, ''); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public static function implode($separator, \Traversable $iterator) |
| 84 | 84 | { |
| 85 | - $result = self::reduce($iterator, function ($carry, $value, $key) use ($separator) { |
|
| 85 | + $result = self::reduce($iterator, function($carry, $value, $key) use ($separator) { |
|
| 86 | 86 | return $carry . $value . $separator; |
| 87 | 87 | }, ''); |
| 88 | 88 | $result = mb_substr($result, 0, -mb_strlen($separator)); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | public function splitCsvFile(\Iterator $input, callable $callback) |
| 104 | 104 | { |
| 105 | 105 | $callback = \Closure::fromCallable($callback); |
| 106 | - $this->process($input, function ($row, $rowNum, $input, $output) use ($callback) { |
|
| 106 | + $this->process($input, function($row, $rowNum, $input, $output) use ($callback) { |
|
| 107 | 107 | if ($fileName = $callback($row)) { |
| 108 | 108 | if (!$output->isFileOpen($fileName)) { |
| 109 | 109 | $output->openFile($fileName)->fputcsv(array_keys($row)); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | $callback = \Closure::fromCallable($callback); |
| 128 | 128 | $input->rewind(); |
| 129 | - iterator_apply($input, function (\Iterator $iterator) use ($callback) { |
|
| 129 | + iterator_apply($input, function(\Iterator $iterator) use ($callback) { |
|
| 130 | 130 | $callback($iterator->current(), $iterator->key(), $iterator, $this); |
| 131 | 131 | return true; |
| 132 | 132 | }, [$input]); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | // The outer iterator is a finite replaceable iterator with a condition |
| 44 | 44 | // on the inner iterator not being empty. |
| 45 | - parent::__construct(new InfiniteIterator(new ReplaceableIterator(), function ($iterator) { |
|
| 45 | + parent::__construct(new InfiniteIterator(new ReplaceableIterator(), function($iterator) { |
|
| 46 | 46 | return !$iterator->current()->valid(); |
| 47 | 47 | })); |
| 48 | 48 | } |