Configuration   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 63.64%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 77
ccs 7
cts 11
cp 0.6364
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getHost() 0 4 1
A getPort() 0 4 1
A isPersistent() 0 4 1
A getProtocol() 0 4 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