@@ -514,12 +514,12 @@ discard block |
||
| 514 | 514 | return $this->guessDelimByDistribution($decision, $eol); |
| 515 | 515 | } catch (TasterException $e) { |
| 516 | 516 | // if somehow we STILL can't come to a consensus, then fall back to a |
| 517 | - // "preferred delimiters" list... |
|
| 518 | - foreach ($this->delims as $key => $val) { |
|
| 519 | - if ($delim = array_search($val, $decision)) { |
|
| 520 | - return $delim; |
|
| 521 | - } |
|
| 522 | - } |
|
| 517 | + // "preferred delimiters" list... |
|
| 518 | + foreach ($this->delims as $key => $val) { |
|
| 519 | + if ($delim = array_search($val, $decision)) { |
|
| 520 | + return $delim; |
|
| 521 | + } |
|
| 522 | + } |
|
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | |
@@ -589,8 +589,8 @@ discard block |
||
| 589 | 589 | })->map(function ($dists) { |
| 590 | 590 | return $dists->average(); |
| 591 | 591 | })->sort() |
| 592 | - ->reverse() |
|
| 593 | - ->getKeyAtPosition(0)]; |
|
| 592 | + ->reverse() |
|
| 593 | + ->getKeyAtPosition(0)]; |
|
| 594 | 594 | } catch (Exception $e) { |
| 595 | 595 | throw new TasterException('delimiter cannot be determined by distribution', TasterException::ERR_DELIMITER); |
| 596 | 596 | } |
@@ -234,7 +234,9 @@ |
||
| 234 | 234 | // callback to build the aforementioned collection |
| 235 | 235 | $buildTypes = function ($line, $line_no) use ($types, $delim, $eol) { |
| 236 | 236 | |
| 237 | - if ($line_no > 2) return; |
|
| 237 | + if ($line_no > 2) { |
|
| 238 | + return; |
|
| 239 | + } |
|
| 238 | 240 | $line = str_replace(self::PLACEHOLDER_NEWLINE, $eol, $line); |
| 239 | 241 | $getType = function ($field, $colpos) use ($types, $line, $line_no, $delim) { |
| 240 | 242 | $field = str_replace(self::PLACEHOLDER_DELIM, $delim, $field); |