| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 54 | public static function fromSource(Source $source, int $position): self |
||
| 55 | { |
||
| 56 | $line = 1; |
||
| 57 | $column = $position + 1; |
||
| 58 | $matches = []; |
||
| 59 | preg_match_all("/\r\n|[\n\r]/", mb_substr($source->getBody(), 0, $position), $matches, PREG_OFFSET_CAPTURE); |
||
| 60 | |||
| 61 | foreach ($matches[0] as $index => $match) { |
||
| 62 | $line += 1; |
||
| 63 | $column = $position + 1 - ($match[1] + mb_strlen($match[0])); |
||
| 64 | } |
||
| 65 | |||
| 66 | return new static($line, $column); |
||
| 67 | } |
||
| 88 |