Configuration::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 5
cts 5
cp 1
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 4
crap 1
1
<?php
2
/**
3
 * Configuration.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        http://www.ipublikuj.eu
7
 * @author         Adam Kadlec http://www.ipublikuj.eu
8
 * @package        iPublikuj:WebSocketsZMQ!
9
 * @subpackage     common
10
 * @since          1.0.0
11
 *
12
 * @date           28.02.17
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\WebSocketsZMQ;
18
19
use Nette;
20
21
/**
22
 * ZeroMQ Pusher & consumer configuration container
23
 *
24
 * @package        iPublikuj:WebSocketsZMQ!
25
 * @subpackage     common
26
 *
27
 * @author         Adam Kadlec <[email protected]>
28
 */
29 1
final class Configuration
30
{
31
	/**
32
	 * Implement nette smart magic
33
	 */
34 1
	use Nette\SmartObject;
35
36
	/**
37
	 * @var string
38
	 */
39
	private $host;
40
41
	/**
42
	 * @var int
43
	 */
44
	private $port;
45
46
	/**
47
	 * @var bool
48
	 */
49
	private $persistent;
50
51
	/**
52
	 * @var string
53
	 */
54
	private $protocol;
55
56
	/**
57
	 * @param string $host
58
	 * @param int $port
59
	 * @param bool $persistent
60
	 * @param string $protocol
61
	 */
62
	public function __construct(
63
		string $host = '127.0.0.1',
64
		int $port = 5555,
65
		bool $persistent = TRUE,
66
		string $protocol = 'tcp'
67
	) {
68 1
		$this->host = $host;
69 1
		$this->port = $port;
70 1
		$this->persistent = $persistent;
71 1
		$this->protocol = $protocol;
72 1
	}
73
74
	/**
75
	 * @return string
76
	 */
77
	public function getHost() : string
78
	{
79
		return $this->host;
80
	}
81
82
	/**
83
	 * @return int
84
	 */
85
	public function getPort() : int
86
	{
87
		return $this->port;
88
	}
89
90
	/**
91
	 * @return bool
92
	 */
93
	public function isPersistent() : bool
94
	{
95
		return $this->persistent;
96
	}
97
98
	/**
99
	 * @return string
100
	 */
101
	public function getProtocol() : string
102
	{
103
		return $this->protocol;
104
	}
105
}
106