Completed
Pull Request — master (#27)
by
unknown
06:13
created

MixedContentLinkedCssExtractor::extract()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Spatie\MixedContentScanner;
4
5
use GuzzleHttp\Psr7\Uri;
6
use Psr\Http\Message\UriInterface;
7
8
class MixedContentLinkedCssExtractor
9
{
10
    public static function extract(string $css, UriInterface $cssUri, UriInterface $linkedByUri): array
11
    {
12
        $pattern = '/url\((http:\/\/.*?)\)/m';
13
        $matches = [];
14
        preg_match_all($pattern, $css, $matches);
15
        return collect($matches[1])->map(function ($item, $i) use ($cssUri, $linkedByUri) {
0 ignored issues
show
Unused Code introduced by
The parameter $i is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
            return new MixedContent($cssUri, new Uri($item), $linkedByUri);
17
        })->toArray();
18
    }
19
}
20