| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 4 | public function process(File $file, Report $report) { |
|
| 31 | 4 | $collection = \Funivan\PhpTokenizer\Collection::createFromString($file->getContent()->get()); |
|
| 32 | 4 | $tokens = $collection->find($this->getFindQuery()); |
|
| 33 | |||
| 34 | 4 | foreach ($tokens as $token) { |
|
| 35 | 2 | $value = $token->getValue(); |
|
| 36 | 2 | $value = preg_replace(self::REGEX, "\n", $value); |
|
| 37 | 2 | $token->setValue($value); |
|
| 38 | |||
| 39 | 2 | $report->addMessage($file, $this, 'Replace invalid line ending', $token->getLine()); |
|
| 40 | } |
||
| 41 | |||
| 42 | |||
| 43 | 4 | $file->getContent()->set($collection->assemble()); |
|
| 44 | 4 | } |
|
| 45 | |||
| 46 | } |