Completed
Push — master ( b2dfe1...1412d2 )
by Sam
02:32
created

StatisticsPopularChannelsMessage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 4
1
<?php
2
3
namespace Jalle19\StatusManager\Message;
4
5
use Jalle19\StatusManager\Exception\MalformedRequestException;
6
7
/**
8
 * Class StatisticsPopularChannelsMessage
9
 * @package   Jalle19\StatusManager\Message
10
 * @copyright Copyright &copy; Sam Stenvall 2016-
11
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
12
 */
13
class StatisticsPopularChannelsMessage extends AbstractMessage
14
{
15
16
	/**
17
	 * @var string
18
	 */
19
	private $_instanceName;
20
21
	/**
22
	 * @var int
23
	 */
24
	private $_limit;
25
26
27
	/**
28
	 * @inheritdoc
29
	 */
30
	public function __construct($type, $parameters)
31
	{
32
		parent::__construct($type, $parameters);
33
34
		/* @var \stdClass $parameters */
35
		if (!isset($parameters->instanceName) || empty($parameters->instanceName))
36
			throw new MalformedRequestException('Missing mandatory "instanceName" parameter');
37
38
		$this->_instanceName = $parameters->instanceName;
39
40
		if (isset($parameters->limit))
41
			$this->_limit = $parameters->limit;
42
	}
43
44
}
45