@@ -267,16 +267,16 @@ |
||
| 267 | 267 | return strlen($data); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - /** |
|
| 271 | - * Seekability accessor. |
|
| 272 | - * |
|
| 273 | - * Despite the fact that any class that implements this interface must also |
|
| 274 | - * define methods such as seek, that is no guarantee that an |
|
| 275 | - * object will necessarily be seekable. This method should tell the user |
|
| 276 | - * whether a stream is, in fact, seekable. |
|
| 277 | - * |
|
| 278 | - * @return boolean True if seekable, false otherwise |
|
| 279 | - */ |
|
| 270 | + /** |
|
| 271 | + * Seekability accessor. |
|
| 272 | + * |
|
| 273 | + * Despite the fact that any class that implements this interface must also |
|
| 274 | + * define methods such as seek, that is no guarantee that an |
|
| 275 | + * object will necessarily be seekable. This method should tell the user |
|
| 276 | + * whether a stream is, in fact, seekable. |
|
| 277 | + * |
|
| 278 | + * @return boolean True if seekable, false otherwise |
|
| 279 | + */ |
|
| 280 | 280 | public function isSeekable() |
| 281 | 281 | { |
| 282 | 282 | return $this->seekable; |
@@ -267,16 +267,16 @@ |
||
| 267 | 267 | return strlen($data); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - /** |
|
| 271 | - * Seekability accessor. |
|
| 272 | - * |
|
| 273 | - * Despite the fact that any class that implements this interface must also |
|
| 274 | - * define methods such as seek, that is no guarantee that an |
|
| 275 | - * object will necessarily be seekable. This method should tell the user |
|
| 276 | - * whether a stream is, in fact, seekable. |
|
| 277 | - * |
|
| 278 | - * @return boolean True if seekable, false otherwise |
|
| 279 | - */ |
|
| 270 | + /** |
|
| 271 | + * Seekability accessor. |
|
| 272 | + * |
|
| 273 | + * Despite the fact that any class that implements this interface must also |
|
| 274 | + * define methods such as seek, that is no guarantee that an |
|
| 275 | + * object will necessarily be seekable. This method should tell the user |
|
| 276 | + * whether a stream is, in fact, seekable. |
|
| 277 | + * |
|
| 278 | + * @return boolean True if seekable, false otherwise |
|
| 279 | + */ |
|
| 280 | 280 | public function isSeekable() |
| 281 | 281 | { |
| 282 | 282 | return $this->seekable; |
@@ -267,16 +267,16 @@ |
||
| 267 | 267 | return strlen($data); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - /** |
|
| 271 | - * Seekability accessor. |
|
| 272 | - * |
|
| 273 | - * Despite the fact that any class that implements this interface must also |
|
| 274 | - * define methods such as seek, that is no guarantee that an |
|
| 275 | - * object will necessarily be seekable. This method should tell the user |
|
| 276 | - * whether a stream is, in fact, seekable. |
|
| 277 | - * |
|
| 278 | - * @return boolean True if seekable, false otherwise |
|
| 279 | - */ |
|
| 270 | + /** |
|
| 271 | + * Seekability accessor. |
|
| 272 | + * |
|
| 273 | + * Despite the fact that any class that implements this interface must also |
|
| 274 | + * define methods such as seek, that is no guarantee that an |
|
| 275 | + * object will necessarily be seekable. This method should tell the user |
|
| 276 | + * whether a stream is, in fact, seekable. |
|
| 277 | + * |
|
| 278 | + * @return boolean True if seekable, false otherwise |
|
| 279 | + */ |
|
| 280 | 280 | public function isSeekable() |
| 281 | 281 | { |
| 282 | 282 | return $this->seekable; |
@@ -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 | } |
@@ -292,20 +292,20 @@ discard block |
||
| 292 | 292 | throw new TasterException("quoteChar and delimiter cannot be determined", TasterException::ERR_QUOTE_AND_DELIM); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * Take a list of likely delimiter characters and find the one that occurs |
|
| 297 | - * the most consistent amount of times within the provided data. |
|
| 298 | - * |
|
| 299 | - * @param string $eol The character(s) used for newlines |
|
| 300 | - * @return string One of four Flavor::QUOTING_* constants |
|
| 301 | - * @see Flavor for possible quote style constants |
|
| 302 | - * @todo Refactor this method--It needs more thorough testing against a wider |
|
| 303 | - * variety of CSV data to be sure it works reliably. And I'm sure there |
|
| 304 | - * are many performance and logic improvements that could be made. This |
|
| 305 | - * is essentially a first draft. |
|
| 306 | - * @todo Can't use replaceQuotedSpecialChars rather than removeQuotedStrings |
|
| 307 | - * because the former requires u to know the delimiter |
|
| 308 | - */ |
|
| 295 | + /** |
|
| 296 | + * Take a list of likely delimiter characters and find the one that occurs |
|
| 297 | + * the most consistent amount of times within the provided data. |
|
| 298 | + * |
|
| 299 | + * @param string $eol The character(s) used for newlines |
|
| 300 | + * @return string One of four Flavor::QUOTING_* constants |
|
| 301 | + * @see Flavor for possible quote style constants |
|
| 302 | + * @todo Refactor this method--It needs more thorough testing against a wider |
|
| 303 | + * variety of CSV data to be sure it works reliably. And I'm sure there |
|
| 304 | + * are many performance and logic improvements that could be made. This |
|
| 305 | + * is essentially a first draft. |
|
| 306 | + * @todo Can't use replaceQuotedSpecialChars rather than removeQuotedStrings |
|
| 307 | + * because the former requires u to know the delimiter |
|
| 308 | + */ |
|
| 309 | 309 | protected function lickDelimiter($eol = "\n") |
| 310 | 310 | { |
| 311 | 311 | $frequencies = []; |
@@ -382,16 +382,16 @@ discard block |
||
| 382 | 382 | * which one has the best distribution, return that one. |
| 383 | 383 | */ |
| 384 | 384 | |
| 385 | - $decision = $dups->get($max); |
|
| 386 | - try { |
|
| 387 | - return $this->guessDelimByDistribution($decision, $eol); |
|
| 388 | - } catch (TasterException $e) { |
|
| 389 | - // if somehow we STILL can't come to a consensus, then fall back to a |
|
| 390 | - // "preferred delimiters" list... |
|
| 391 | - foreach ($this->delims as $key => $val) { |
|
| 385 | + $decision = $dups->get($max); |
|
| 386 | + try { |
|
| 387 | + return $this->guessDelimByDistribution($decision, $eol); |
|
| 388 | + } catch (TasterException $e) { |
|
| 389 | + // if somehow we STILL can't come to a consensus, then fall back to a |
|
| 390 | + // "preferred delimiters" list... |
|
| 391 | + foreach ($this->delims as $key => $val) { |
|
| 392 | 392 | if ($delim = array_search($val, $decision)) return $delim; |
| 393 | - } |
|
| 394 | - } |
|
| 393 | + } |
|
| 394 | + } |
|
| 395 | 395 | } |
| 396 | 396 | return $delims |
| 397 | 397 | ->sort() |
@@ -450,8 +450,8 @@ discard block |
||
| 450 | 450 | })->map(function($dists) { |
| 451 | 451 | return $dists->average(); |
| 452 | 452 | })->sort() |
| 453 | - ->reverse() |
|
| 454 | - ->getKeyAtPosition(0)]; |
|
| 453 | + ->reverse() |
|
| 454 | + ->getKeyAtPosition(0)]; |
|
| 455 | 455 | } catch (Exception $e) { |
| 456 | 456 | throw new TasterException("delimiter cannot be determined by distribution", TasterException::ERR_DELIMITER); |
| 457 | 457 | } |