Conditions | 4 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
30 | 1 | public function scrape($content) |
|
31 | { |
||
32 | 1 | $paths = []; |
|
33 | 1 | $masks = []; |
|
34 | 1 | $matches = []; |
|
35 | 1 | preg_match_all( |
|
36 | 1 | '/data-src-[^=]*\s?=\s?([\'"])(.*?)([\'"])/i', |
|
37 | $content, |
||
38 | $matches |
||
39 | ); |
||
40 | 1 | if (is_array($matches) && sizeof($matches) > 1 && is_array($matches[2])) { |
|
41 | 1 | $paths = $matches[2]; |
|
42 | 1 | $masks = $matches[1]; |
|
43 | } |
||
44 | 1 | return $this->assetFactory->createAssetsFromPaths($paths, $masks); |
|
45 | } |
||
46 | } |