Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2.032 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 3 | public function getContent(): string |
|
37 | { |
||
38 | 3 | $result = preg_replace_callback('/(url\([\'"]?)(?!["\'a-z]+:|[\'"]?\/{2})(.+[^\'"])([\'"]?\))/i', function ($m){ |
|
39 | 3 | $urlConverter = new UrlConverter(); |
|
40 | 3 | return $m[1] . $urlConverter->relativeToAbsolute($this->url, $m[2]) . $m[3]; |
|
41 | 3 | }, $this->content); |
|
42 | |||
43 | 3 | if ($result === null) { |
|
44 | $this->logger->notice(sprintf('Regex return null value. Returned empty string: %s', $this->url)); |
||
45 | return ''; |
||
46 | } |
||
47 | 3 | $this->logger->info(sprintf('ReplaceRelativeUrls: %s', $this->url)); |
|
48 | 3 | return $result; |
|
49 | } |
||
55 |