@@ -73,7 +73,7 @@ |
||
| 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 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 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 |
||
| 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() |
@@ -67,7 +67,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -40,7 +40,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -75,7 +75,7 @@ |
||
| 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 | |
@@ -55,7 +55,7 @@ |
||
| 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 | |
@@ -39,7 +39,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -185,7 +185,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 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 |
||
| 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 | } |