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