Total Complexity | 9 |
Total Lines | 74 |
Duplicated Lines | 0 % |
Coverage | 89.29% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class Url |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $location; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $providerName; |
||
18 | |||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $options; |
||
23 | |||
24 | /** |
||
25 | * Url constructor. |
||
26 | */ |
||
27 | 5 | public function __construct(string $location, string $providerName, array $options = []) |
|
28 | { |
||
29 | 5 | $this->location = $location; |
|
30 | 5 | $this->providerName = $providerName; |
|
31 | 5 | $this->options = $options; |
|
32 | 5 | } |
|
33 | |||
34 | 1 | public function serialize(): string |
|
40 | ]); |
||
41 | } |
||
42 | |||
43 | 1 | public static function deserialize(string $serialized): Url |
|
44 | { |
||
45 | 1 | $data = unserialize($serialized); |
|
46 | |||
47 | 1 | return new Url( |
|
48 | 1 | $data['location'], |
|
49 | 1 | $data['providerName'], |
|
50 | 1 | $data['options'] |
|
51 | ); |
||
52 | } |
||
53 | |||
54 | 2 | public function getLocation(): string |
|
55 | { |
||
56 | 2 | return $this->location; |
|
57 | } |
||
58 | |||
59 | 2 | public function getProviderName(): string |
|
60 | { |
||
61 | 2 | return $this->providerName; |
|
62 | } |
||
63 | |||
64 | public function getOptions(): array |
||
65 | { |
||
66 | return $this->options; |
||
67 | } |
||
68 | |||
69 | 1 | public function hasOption(string $name): bool |
|
70 | { |
||
71 | 1 | return key_exists($name, $this->options); |
|
72 | } |
||
73 | |||
74 | 1 | public function getOption(string $name) |
|
81 | } |
||
82 | } |
||
83 |