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

Instance::requiresCredentials()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 0
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