@@ -290,20 +290,20 @@ discard block |
||
290 | 290 | throw new TasterException("quoteChar and delimiter cannot be determined", TasterException::ERR_QUOTE_AND_DELIM); |
291 | 291 | } |
292 | 292 | |
293 | - /** |
|
294 | - * Take a list of likely delimiter characters and find the one that occurs |
|
295 | - * the most consistent amount of times within the provided data. |
|
296 | - * |
|
297 | - * @param string The character(s) used for newlines |
|
298 | - * @return string One of four Flavor::QUOTING_* constants |
|
299 | - * @see \CSVelte\Flavor for possible quote style constants |
|
300 | - * @todo Refactor this method--It needs more thorough testing against a wider |
|
301 | - * variety of CSV data to be sure it works reliably. And I'm sure there |
|
302 | - * are many performance and logic improvements that could be made. This |
|
303 | - * is essentially a first draft. |
|
304 | - * @todo Can't use replaceQuotedSpecialChars rather than removeQuotedStrings |
|
305 | - * because the former requires u to know the delimiter |
|
306 | - */ |
|
293 | + /** |
|
294 | + * Take a list of likely delimiter characters and find the one that occurs |
|
295 | + * the most consistent amount of times within the provided data. |
|
296 | + * |
|
297 | + * @param string The character(s) used for newlines |
|
298 | + * @return string One of four Flavor::QUOTING_* constants |
|
299 | + * @see \CSVelte\Flavor for possible quote style constants |
|
300 | + * @todo Refactor this method--It needs more thorough testing against a wider |
|
301 | + * variety of CSV data to be sure it works reliably. And I'm sure there |
|
302 | + * are many performance and logic improvements that could be made. This |
|
303 | + * is essentially a first draft. |
|
304 | + * @todo Can't use replaceQuotedSpecialChars rather than removeQuotedStrings |
|
305 | + * because the former requires u to know the delimiter |
|
306 | + */ |
|
307 | 307 | protected function lickDelimiter($eol = "\n") |
308 | 308 | { |
309 | 309 | $frequencies = []; |
@@ -380,16 +380,16 @@ discard block |
||
380 | 380 | * which one has the best distribution, return that one. |
381 | 381 | */ |
382 | 382 | |
383 | - $decision = $dups->get($max); |
|
384 | - try { |
|
385 | - return $this->guessDelimByDistribution($decision, $eol); |
|
386 | - } catch (TasterException $e) { |
|
387 | - // if somehow we STILL can't come to a consensus, then fall back to a |
|
388 | - // "preferred delimiters" list... |
|
389 | - foreach ($this->delims as $key => $val) { |
|
383 | + $decision = $dups->get($max); |
|
384 | + try { |
|
385 | + return $this->guessDelimByDistribution($decision, $eol); |
|
386 | + } catch (TasterException $e) { |
|
387 | + // if somehow we STILL can't come to a consensus, then fall back to a |
|
388 | + // "preferred delimiters" list... |
|
389 | + foreach ($this->delims as $key => $val) { |
|
390 | 390 | if ($delim = array_search($val, $decision)) return $delim; |
391 | - } |
|
392 | - } |
|
391 | + } |
|
392 | + } |
|
393 | 393 | } |
394 | 394 | return $delims |
395 | 395 | ->sort() |
@@ -446,8 +446,8 @@ discard block |
||
446 | 446 | })->map(function($dists) { |
447 | 447 | return $dists->average(); |
448 | 448 | })->sort() |
449 | - ->reverse() |
|
450 | - ->getKeyAtPosition(0)]; |
|
449 | + ->reverse() |
|
450 | + ->getKeyAtPosition(0)]; |
|
451 | 451 | } catch (Exception $e) { |
452 | 452 | throw new TasterException("delimiter cannot be determined by distribution", TasterException::ERR_DELIMITER); |
453 | 453 | } |