Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2.0078 |
Changes | 0 |
1 | <?php |
||
20 | 6 | public function guessDelimiter($line) |
|
21 | { |
||
22 | 6 | $specialCharString = preg_replace('/[a-z0-9éâëïüÿçêîôûéäöüß\n\r "]/iu', '', $line); |
|
23 | |||
24 | 6 | $charStats = count_chars($specialCharString, 1); |
|
25 | |||
26 | 6 | if (empty($charStats)) { |
|
27 | throw new \LogicException('Could not discover CSV-delimiter!'); |
||
28 | } |
||
29 | |||
30 | 6 | arsort($charStats); |
|
31 | 6 | $delimiter = chr(key($charStats)); |
|
32 | |||
33 | 6 | return $delimiter; |
|
34 | } |
||
35 | } |
||
36 |