| Total Complexity | 7 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class FalsePositiveRemoverTokenModifier implements TokenModifierInterface |
||
| 9 | { |
||
| 10 | private $falsePositivePatterns = []; |
||
| 11 | |||
| 12 | 2 | public function addFalsePositivePattern(string $blockPattern, string $textPattern) |
|
| 13 | { |
||
| 14 | 2 | $this->falsePositivePatterns[] = [ |
|
| 15 | 2 | 'block_pattern' => $blockPattern, |
|
| 16 | 2 | 'text_pattern' => $textPattern, |
|
| 17 | ]; |
||
| 18 | 2 | return $this; |
|
| 19 | } |
||
| 20 | |||
| 21 | 2 | public function modifyAll(TokenCollection $tokenCollection): TokenCollection |
|
| 22 | { |
||
| 23 | 2 | $newTokenCollection = new TokenCollection($tokenCollection->getFilePath()); |
|
| 24 | 2 | foreach ($tokenCollection->getTokens() as $token) { |
|
| 25 | 2 | $this->addTokensToNewCollection($newTokenCollection, $token); |
|
| 26 | } |
||
| 27 | 2 | return $newTokenCollection; |
|
| 28 | } |
||
| 29 | |||
| 30 | 2 | private function addTokensToNewCollection(TokenCollection $newTokenCollection, Token $token): void |
|
| 35 | } |
||
| 36 | } |
||
| 37 | 2 | } |
|
| 39 |