| Conditions | 6 |
| Paths | 10 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 22 | public function parse($text, array $matches) |
|
| 18 | { |
||
| 19 | 22 | $tagName = $this->config['tagName']; |
|
| 20 | 22 | $attrName = $this->config['attrName']; |
|
| 21 | 22 | $replacements = (isset($this->config['replacements'])) ? $this->config['replacements'] : []; |
|
| 22 | 22 | foreach ($matches as $m) |
|
| 23 | { |
||
| 24 | 22 | if ($this->isAllowed($m[0][0])) |
|
| 25 | { |
||
| 26 | 1 | continue; |
|
| 27 | } |
||
| 28 | |||
| 29 | 22 | $tag = $this->parser->addSelfClosingTag($tagName, $m[0][1], strlen($m[0][0])); |
|
| 30 | 22 | foreach ($replacements as list($regexp, $replacement)) |
|
| 31 | { |
||
| 32 | 5 | if (preg_match($regexp, $m[0][0])) |
|
| 33 | { |
||
| 34 | 5 | $tag->setAttribute($attrName, $replacement); |
|
| 35 | 5 | break; |
|
| 36 | } |
||
| 51 | } |