| Conditions | 3 | 
| Paths | 3 | 
| Total Lines | 20 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 15 | 
| CRAP Score | 3 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 33 | 1 | public function sniff($data) | |
| 34 |     { | ||
| 35 | // in this case we really only care about newlines so we pass in a comma as the delim | ||
| 36 | 1 | $str = $this->replaceQuotedSpecialChars($data, ','); | |
| 37 | $eols = [ | ||
| 38 | 1 | static::EOL_WINDOWS => "\r\n", // 0x0D - 0x0A - Windows, DOS OS/2 | |
| 39 | 1 | static::EOL_UNIX => "\n", // 0x0A - - Unix, OSX | |
| 40 | 1 | static::EOL_OTHER => "\r", // 0x0D - - Other | |
| 41 | 1 | ]; | |
| 42 | |||
| 43 | 1 | $curCount = 0; | |
| 44 | 1 | $curEol = PHP_EOL; | |
| 45 | 1 |         foreach ($eols as $k => $eol) { | |
| 46 | 1 |             if (($count = substr_count($str, $eol)) > $curCount) { | |
| 47 | 1 | $curCount = $count; | |
| 48 | 1 | $curEol = $eol; | |
| 49 | 1 | } | |
| 50 | 1 | } | |
| 51 | 1 | return $curEol; | |
| 52 | } | ||
| 53 | } |