Test Failed
Push — feature/html-code-handler ( 2b7167...3f6bac )
by Arnaud
02:50
created

Url   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 80
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 5 1
A __construct() 0 5 1
A getProviderName() 0 3 1
A unserialize() 0 6 1
A getLocation() 0 3 1
A getOptions() 0 3 1
1
<?php
2
3
namespace LAG\SmokerBundle\Url;
4
5
class Url implements \Serializable
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $location;
11
12
    /**
13
     * @var string
14
     */
15
    protected $providerName;
16
17
    /**
18
     * @var array
19
     */
20
    protected $options;
21
22
    /**
23
     * Url constructor.
24
     *
25
     * @param string $location
26
     * @param string $providerName
27
     * @param array  $options
28
     */
29
    public function __construct(string $location, string $providerName, array $options = [])
30
    {
31
        $this->location = $location;
32
        $this->providerName = $providerName;
33
        $this->options = $options;
34
    }
35
36
    public function serialize(): string
37
    {
38
        return serialize([
39
            'location' => $this->location,
40
            'providerName' => $this->providerName,
41
        ]);
42
    }
43
44
    /**
45
     * Constructs the object.
46
     *
47
     * @see https://php.net/manual/en/serializable.unserialize.php
48
     *
49
     * @param string $serialized <p>
50
     *                           The string representation of the object.
51
     *                           </p>
52
     *
53
     * @since 5.1.0
54
     */
55
    public function unserialize($serialized)
56
    {
57
        $data = unserialize($serialized);
58
59
        $this->location = $data['location'];
60
        $this->providerName = $data['providerName'];
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getLocation(): string
67
    {
68
        return $this->location;
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getProviderName(): string
75
    {
76
        return $this->providerName;
77
    }
78
79
    /**
80
     * @return array
81
     */
82
    public function getOptions(): array
83
    {
84
        return $this->options;
85
    }
86
}
87