Conditions | 6 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 6 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
40 | 1 | private function getStyleBlocksFromMarkup($content) |
|
41 | { |
||
42 | 1 | $blocks = []; |
|
43 | 1 | $matches = []; |
|
44 | |||
45 | 1 | preg_match_all( |
|
46 | 1 | '~<style[^>]*>(.*?)</style>~is', |
|
47 | $content, |
||
48 | $matches, |
||
49 | 1 | PREG_PATTERN_ORDER |
|
50 | ); |
||
51 | |||
52 | 1 | if (is_array($matches) && sizeof($matches) > 1 && is_array($matches[1])) { |
|
53 | 1 | foreach($matches[1] as $match) { |
|
54 | // filter inline svg styles |
||
55 | 1 | if (false === strpos($match, 'fill:url')) { |
|
56 | 1 | $blocks[] = $match; |
|
57 | } |
||
58 | } |
||
59 | } |
||
60 | |||
61 | 1 | return $blocks; |
|
62 | } |
||
63 | } |