| Conditions | 6 |
| Paths | 4 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 6.1417 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 3 | private function extractUrlPaths($cssContent) |
|
| 43 | { |
||
| 44 | 3 | $paths = []; |
|
| 45 | 3 | $masks = []; |
|
| 46 | 3 | $matches = []; |
|
| 47 | |||
| 48 | 3 | preg_match_all( |
|
| 49 | 3 | '~url\(\s*([\'"]?)(/?(\.\./)?.*?)([\'"]?);?\s*\)~is', |
|
| 50 | 3 | $cssContent, |
|
| 51 | 3 | $matches, |
|
| 52 | 3 | PREG_PATTERN_ORDER |
|
| 53 | ); |
||
| 54 | |||
| 55 | 3 | if (false === (is_array($matches) && sizeof($matches) > 1 && is_array($matches[2]))) { |
|
| 56 | return [ |
||
| 57 | 'paths' => $paths, |
||
| 58 | 'masks' => $masks |
||
| 59 | ]; |
||
| 60 | } |
||
| 61 | |||
| 62 | 3 | foreach ($matches[2] as $mkey => $path) { |
|
| 63 | 2 | if (strpos($path, ',') !== false) { |
|
| 64 | continue; |
||
| 65 | } |
||
| 66 | 2 | $paths[] = $path; |
|
| 67 | 2 | $masks[] = $matches[1][$mkey]; |
|
| 68 | } |
||
| 69 | |||
| 70 | return [ |
||
| 71 | 3 | 'paths' => $paths, |
|
| 72 | 3 | 'masks' => $masks |
|
| 73 | ]; |
||
| 74 | } |
||
| 75 | } |