InMemoryLocation   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 5
c 4
b 0
f 0
lcom 0
cbo 0
dl 0
loc 68
ccs 0
cts 18
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getHost() 0 4 1
A getPort() 0 4 1
A unserialize() 0 7 1
A serialize() 0 7 1
1
<?php
2
3
namespace AsyncPHP\Remit\Location;
4
5
use AsyncPHP\Remit\Location;
6
7
final class InMemoryLocation implements Location
8
{
9
    /**
10
     * @var string
11
     */
12
    private $host;
13
14
    /**
15
     * @var int
16
     */
17
    private $port;
18
19
    /**
20
     * @param string $host
21
     * @param int $port
22
     */
23
    public function __construct($host, $port)
24
    {
25
        $this->host = $host;
26
        $this->port = $port;
27
    }
28
29
    /**
30
     * @inheritdoc
31
     *
32
     * @return string
33
     */
34
    public function getHost()
35
    {
36
        return $this->host;
37
    }
38
39
    /**
40
     * @inheritdoc
41
     *
42
     * @return int
43
     */
44
    public function getPort()
45
    {
46
        return $this->port;
47
    }
48
49
    /**
50
     * @inheritdoc
51
     *
52
     * @return string
53
     */
54
    public function serialize()
55
    {
56
        return serialize([
57
            "host" => $this->host,
58
            "port" => $this->port,
59
        ]);
60
    }
61
62
    /**
63
     * @inheritdoc
64
     *
65
     * @param string $serialized
66
     */
67
    public function unserialize($serialized)
68
    {
69
        $unserialized = unserialize($serialized);
70
71
        $this->host = $unserialized["host"];
72
        $this->port = $unserialized["port"];
73
    }
74
}
75