Completed
Branch master (252fb7)
by Sam
02:31
created

PopularChannelsRequest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 54
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 4
A getInstanceName() 0 4 1
A getLimit() 0 4 1
1
<?php
2
3
namespace Jalle19\StatusManager\Message\Request;
4
5
use Jalle19\StatusManager\Exception\MalformedRequestException;
6
use Jalle19\StatusManager\Message\AbstractMessage;
7
8
/**
9
 * Class PopularChannelsRequest
10
 * @package   Jalle19\StatusManager\Message\Request
11
 * @copyright Copyright &copy; Sam Stenvall 2016-
12
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
13
 */
14
class PopularChannelsRequest extends AbstractMessage
15
{
16
17
	/**
18
	 * @var string
19
	 */
20
	private $_instanceName;
21
22
	/**
23
	 * @var int
24
	 */
25
	private $_limit;
26
27
28
	/**
29
	 * PopularChannelsRequest constructor.
30
	 *
31
	 * @param string $parameters
32
	 *
33
	 * @throws MalformedRequestException
34
	 */
35
	public function __construct($parameters)
36
	{
37
		parent::__construct(self::TYPE_POPULAR_CHANNELS_REQUEST, $parameters);
38
39
		/* @var \stdClass $parameters */
40
		if (!isset($parameters->instanceName) || empty($parameters->instanceName))
41
			throw new MalformedRequestException('Missing mandatory "instanceName" parameter');
42
43
		$this->_instanceName = $parameters->instanceName;
44
45
		if (isset($parameters->limit))
46
			$this->_limit = $parameters->limit;
47
	}
48
49
50
	/**
51
	 * @return string
52
	 */
53
	public function getInstanceName()
54
	{
55
		return $this->_instanceName;
56
	}
57
58
59
	/**
60
	 * @return int
61
	 */
62
	public function getLimit()
63
	{
64
		return $this->_limit;
65
	}
66
67
}
68