@@ -82,7 +82,7 @@ |
||
| 82 | 82 | */ |
| 83 | 83 | public function toArray() |
| 84 | 84 | { |
| 85 | - return array_map(function ($row) { |
|
| 85 | + return array_map(function($row) { |
|
| 86 | 86 | return $row->toArray(); |
| 87 | 87 | }, iterator_to_array($this)); |
| 88 | 88 | } |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | // ok we're opening a new stream resource handle |
| 187 | 187 | $this->setUri($uri) |
| 188 | - ->setMode($mode) |
|
| 189 | - ->setLazy($lazy) |
|
| 190 | - ->setUseIncludePath($use_include_path) |
|
| 191 | - ->setContext($context_options, $context_params); |
|
| 188 | + ->setMode($mode) |
|
| 189 | + ->setLazy($lazy) |
|
| 190 | + ->setUseIncludePath($use_include_path) |
|
| 191 | + ->setContext($context_options, $context_params); |
|
| 192 | 192 | if (!$this->isLazy()) { |
| 193 | 193 | $this->connect(); |
| 194 | 194 | } |
@@ -351,9 +351,9 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | $this->flag = ''; |
| 353 | 353 | $this->setBaseMode($base) |
| 354 | - ->setIsPlus($plus == '+') |
|
| 355 | - ->setIsText($flag == 't') |
|
| 356 | - ->setIsBinary($flag == 'b'); |
|
| 354 | + ->setIsPlus($plus == '+') |
|
| 355 | + ->setIsText($flag == 't') |
|
| 356 | + ->setIsBinary($flag == 'b'); |
|
| 357 | 357 | |
| 358 | 358 | return $this; |
| 359 | 359 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | { |
| 245 | 245 | if (!$this->isConnected()) { |
| 246 | 246 | $e = null; |
| 247 | - $errhandler = function () use (&$e) { |
|
| 247 | + $errhandler = function() use (&$e) { |
|
| 248 | 248 | $e = new IOException(sprintf( |
| 249 | 249 | 'Could not open connection for %s using mode %s', |
| 250 | 250 | $this->getUri(), |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | return $this; |
| 545 | 545 | } |
| 546 | - throw new InvalidArgumentException('Context options must be an array, got: ' . gettype($options)); |
|
| 546 | + throw new InvalidArgumentException('Context options must be an array, got: '.gettype($options)); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /** |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | |
| 568 | 568 | return $this; |
| 569 | 569 | } |
| 570 | - throw new InvalidArgumentException('Context parameters must be an array, got: ' . gettype($params)); |
|
| 570 | + throw new InvalidArgumentException('Context parameters must be an array, got: '.gettype($params)); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | /** |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | if (is_null($lazy)) { |
| 897 | 897 | $lazy = true; |
| 898 | 898 | } |
| 899 | - $this->lazy = (bool) $lazy; |
|
| 899 | + $this->lazy = (bool) $lazy; |
|
| 900 | 900 | |
| 901 | 901 | return $this; |
| 902 | 902 | } |
@@ -165,7 +165,7 @@ |
||
| 165 | 165 | $top = substr($this->buffer, 0, $start); |
| 166 | 166 | $data = substr($this->buffer, $start, $length); |
| 167 | 167 | $bottom = substr($this->buffer, $start + $length); |
| 168 | - $this->buffer = $top . $bottom; |
|
| 168 | + $this->buffer = $top.$bottom; |
|
| 169 | 169 | |
| 170 | 170 | return $data; |
| 171 | 171 | } |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * also optionally throw an OutOfBoundsException if no value is found. |
| 281 | 281 | * |
| 282 | 282 | * @param mixed $index The index of the data you want to get |
| 283 | - * @param mixed $default The default value to return if none available |
|
| 283 | + * @param null|integer $default The default value to return if none available |
|
| 284 | 284 | * @param bool $throw True if you want an exception to be thrown if no data found at $index |
| 285 | 285 | * @throws OutOfBoundsException If $throw is true and $index isn't found |
| 286 | 286 | * @return mixed The data found at $index or failing that, the $default |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | * Returns a new collection with $items added. |
| 546 | 546 | * |
| 547 | 547 | * @param array $items Any number of arguments will be pushed onto the |
| 548 | - * @return mixed The first item in this collection |
|
| 548 | + * @return AbstractCollection The first item in this collection |
|
| 549 | 549 | */ |
| 550 | 550 | public function push(...$items) |
| 551 | 551 | { |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | * |
| 559 | 559 | * Returns a new collection with $items added. |
| 560 | 560 | * |
| 561 | - * @return mixed The first item in this collection |
|
| 561 | + * @return AbstractCollection The first item in this collection |
|
| 562 | 562 | */ |
| 563 | 563 | public function unshift(...$items) |
| 564 | 564 | { |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | /** |
| 698 | 698 | * Returns collection in reverse order. |
| 699 | 699 | * |
| 700 | - * @param null $preserveKeys True if you want to preserve collection's keys |
|
| 700 | + * @param boolean $preserveKeys True if you want to preserve collection's keys |
|
| 701 | 701 | * @return AbstractCollection This collection in reverse order. |
| 702 | 702 | */ |
| 703 | 703 | public function reverse($preserveKeys = null) |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | |
| 16 | 16 | use ArrayAccess; |
| 17 | 17 | use ArrayIterator; |
| 18 | -use BadMethodCallException; |
|
| 19 | 18 | use Countable; |
| 20 | 19 | use InvalidArgumentException; |
| 21 | 20 | use Iterator; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @return mixed |
| 167 | 167 | */ |
| 168 | - public function current () |
|
| 168 | + public function current() |
|
| 169 | 169 | { |
| 170 | 170 | return current($this->data); |
| 171 | 171 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * @return mixed |
| 179 | 179 | */ |
| 180 | - public function key () |
|
| 180 | + public function key() |
|
| 181 | 181 | { |
| 182 | 182 | return key($this->data); |
| 183 | 183 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * |
| 192 | 192 | * @return mixed |
| 193 | 193 | */ |
| 194 | - public function next () |
|
| 194 | + public function next() |
|
| 195 | 195 | { |
| 196 | 196 | $next = next($this->data); |
| 197 | 197 | $key = key($this->data); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * |
| 211 | 211 | * @return mixed |
| 212 | 212 | */ |
| 213 | - public function rewind () |
|
| 213 | + public function rewind() |
|
| 214 | 214 | { |
| 215 | 215 | $this->isValid = true; |
| 216 | 216 | return reset($this->data); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @return bool True if internal pointer isn't past the end |
| 225 | 225 | */ |
| 226 | - public function valid () |
|
| 226 | + public function valid() |
|
| 227 | 227 | { |
| 228 | 228 | return $this->isValid; |
| 229 | 229 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | return $this->data[$index]; |
| 293 | 293 | } |
| 294 | 294 | if ($throw) { |
| 295 | - throw new OutOfBoundsException(__CLASS__ . " could not find value at index " . $index); |
|
| 295 | + throw new OutOfBoundsException(__CLASS__." could not find value at index ".$index); |
|
| 296 | 296 | } |
| 297 | 297 | return $default; |
| 298 | 298 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | unset($this->data[$index]); |
| 333 | 333 | } else { |
| 334 | 334 | if ($throw) { |
| 335 | - throw new OutOfBoundsException('No value found at given index: ' . $index); |
|
| 335 | + throw new OutOfBoundsException('No value found at given index: '.$index); |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | public function pairs() |
| 622 | 622 | { |
| 623 | 623 | return static::factory(array_map( |
| 624 | - function ($key, $val) { |
|
| 624 | + function($key, $val) { |
|
| 625 | 625 | return [$key, $val]; |
| 626 | 626 | }, |
| 627 | 627 | array_keys($this->data), |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | if (method_exists($val, '__toString')) { |
| 769 | - $val = (string)$val; |
|
| 769 | + $val = (string) $val; |
|
| 770 | 770 | } else { |
| 771 | 771 | $val = spl_object_hash($val); |
| 772 | 772 | } |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | protected function assertCorrectInputDataType($data) |
| 816 | 816 | { |
| 817 | 817 | if (!$this->isConsistentDataStructure($data)) { |
| 818 | - throw new InvalidArgumentException(__CLASS__ . ' expected traversable data, got: ' . gettype ($data)); |
|
| 818 | + throw new InvalidArgumentException(__CLASS__.' expected traversable data, got: '.gettype($data)); |
|
| 819 | 819 | } |
| 820 | 820 | } |
| 821 | 821 | |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | } |
| 860 | 860 | } |
| 861 | 861 | // if row contains an array it isn't tabular |
| 862 | - if (array_reduce($row, function($carry, $item){ |
|
| 862 | + if (array_reduce($row, function($carry, $item) { |
|
| 863 | 863 | return is_array($item) && $carry; |
| 864 | 864 | }, true)) { |
| 865 | 865 | return false; |
@@ -19,7 +19,6 @@ |
||
| 19 | 19 | use CSVelte\Contract\Readable; |
| 20 | 20 | use CSVelte\Contract\Writable; |
| 21 | 21 | use CSVelte\Contract\Seekable; |
| 22 | - |
|
| 23 | 22 | use CSVelte\Exception\NotYetImplementedException; |
| 24 | 23 | |
| 25 | 24 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | return static::factory($values); |
| 65 | 65 | } |
| 66 | 66 | if ($throw) { |
| 67 | - throw new OutOfBoundsException(__CLASS__ . " could not find column: " . $column); |
|
| 67 | + throw new OutOfBoundsException(__CLASS__." could not find column: ".$column); |
|
| 68 | 68 | } |
| 69 | 69 | return false; |
| 70 | 70 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | return static::factory($this->data[$index]); |
| 101 | 101 | } |
| 102 | 102 | if ($throw) { |
| 103 | - throw new OutOfBoundsException(__CLASS__ . " could not find row: " . $offset); |
|
| 103 | + throw new OutOfBoundsException(__CLASS__." could not find row: ".$offset); |
|
| 104 | 104 | } |
| 105 | 105 | return false; |
| 106 | 106 | } |
@@ -176,6 +176,6 @@ discard block |
||
| 176 | 176 | return call_user_func_array([$column, $method], $args); |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | - throw new BadMethodCallException("Method does not exist: " . __CLASS__ . "::{$method}()"); |
|
| 179 | + throw new BadMethodCallException("Method does not exist: ".__CLASS__."::{$method}()"); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | \ No newline at end of file |