ProxyServerAddress::getPort()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace Wolnosciowiec\WebProxy\Entity;
4
5
/**
6
 * Represents a proxy details
7
 * --------------------------
8
 *
9
 * @package Wolnosciowiec\WebProxy\Entity
10
 */
11
class ProxyServerAddress
12
{
13
    /**
14
     * @var string $address
15
     */
16
    private $address;
17
18
    /**
19
     * @var int $port
20
     */
21
    private $port = 80;
22
23
    /**
24
     * @var string http|https
25
     */
26
    private $schema;
27
28
    /**
29
     * @param string $address
30
     * @return ProxyServerAddress
31
     */
32
    public function setAddress(string $address): ProxyServerAddress
33
    {
34
        $this->address = $address;
35
        return $this;
36
    }
37
38
    /**
39
     * @param int $port
40
     * @return ProxyServerAddress
41
     */
42
    public function setPort(int $port): ProxyServerAddress
43
    {
44
        $this->port = $port;
45
        return $this;
46
    }
47
48
    /**
49
     * @param string $schema
50
     * @return ProxyServerAddress
51
     */
52
    public function setSchema(string $schema): ProxyServerAddress
53
    {
54
        $this->schema = $schema;
55
        return $this;
56
    }
57
58
    /**
59
     * @return bool
60
     */
61
    public function isSecure(): bool
62
    {
63
        return $this->getSchema() === 'https';
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getAddress(): string
70
    {
71
        return $this->address;
72
    }
73
74
    /**
75
     * @return int
76
     */
77
    public function getPort(): int
78
    {
79
        return $this->port;
80
    }
81
82
    /**
83
     * @return string
84
     */
85
    public function getSchema(): string
86
    {
87
        return $this->schema;
88
    }
89
90
    /**
91
     * @return string
92
     */
93
    public function getFormatted()
94
    {
95
        return $this->getSchema() . '://' . $this->getAddress() . ':' . $this->getPort();
96
    }
97
}
98