Completed
Pull Request — master (#27)
by
unknown
01:04
created

MixedContentLinkedCssExtractor::extract()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
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
16
        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...
17
            return new MixedContent($cssUri, new Uri($item), $linkedByUri);
18
        })->toArray();
19
    }
20
}
21