MixedContent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 3
A toArray() 0 8 1
1
<?php
2
3
namespace Spatie\MixedContentScanner;
4
5
use Psr\Http\Message\UriInterface;
6
7
class MixedContent
8
{
9
    /** string */
10
    public $elementName = '';
11
12
    /** @var\Spatie\Crawler\Url */
13
    public $mixedContentUrl = null;
14
15
    /** @var\Spatie\Crawler\Url */
16
    public $foundOnUrl = null;
17
18
    public function __construct(string $elementName, UriInterface $mixedContentUrl, UriInterface $foundOnUrl)
19
    {
20
        $this->elementName = $elementName;
21
22
        if ($mixedContentUrl->getPath() === '') {
23
            $mixedContentUrl = $mixedContentUrl->withPath('/');
24
        }
25
26
        $this->mixedContentUrl = $mixedContentUrl;
27
28
        if ($foundOnUrl->getPath() === '') {
29
            $foundOnUrl = $foundOnUrl->withPath('/');
30
        }
31
32
        $this->foundOnUrl = $foundOnUrl;
33
    }
34
35
    public function toArray(): array
36
    {
37
        return [
38
            'elementName' => $this->elementName,
39
            'mixedContentUrl' => (string) $this->mixedContentUrl,
40
            'foundOnUrl' => (string) $this->foundOnUrl,
41
        ];
42
    }
43
}
44