Completed
Push — master ( bdef63...dc6294 )
by Sam
02:18
created

Instance   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 4
c 4
b 1
f 0
lcom 1
cbo 1
dl 0
loc 60
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getName() 0 4 1
A setCredentials() 0 4 1
A getInstance() 0 4 1
1
<?php
2
3
namespace Jalle19\StatusManager;
4
5
use jalle19\tvheadend\Tvheadend;
6
7
/**
8
 * Class Instance
9
 * @package   Jalle19\StatusManager
10
 * @copyright Copyright &copy; Sam Stenvall 2015-
11
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
12
 */
13
class Instance
14
{
15
16
	/**
17
	 * @var string the name of the instance
18
	 */
19
	private $_name;
20
21
	/**
22
	 * @var Tvheadend the actual tvheadend instance
23
	 */
24
	private $_instance;
25
26
27
	/**
28
	 * Instance constructor.
29
	 *
30
	 * @param string $name
31
	 * @param string $address
32
	 * @param int    $port
33
	 */
34
	public function __construct($name, $address, $port)
35
	{
36
		$this->_name = $name;
37
38
		// Create the actual instance
39
		$this->_instance = new Tvheadend($address, $port);
40
	}
41
42
43
	/**
44
	 * @return string
45
	 */
46
	public function getName()
47
	{
48
		return $this->_name;
49
	}
50
51
52
	/**
53
	 * Sets the credentials to use
54
	 *
55
	 * @param $username
56
	 * @param $password
57
	 */
58
	public function setCredentials($username, $password)
59
	{
60
		$this->_instance->setCredentials($username, $password);
61
	}
62
63
64
	/**
65
	 * @return Tvheadend
66
	 */
67
	public function getInstance()
68
	{
69
		return $this->_instance;
70
	}
71
72
}
73