GroupSelectAction   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 39
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getOptions() 0 4 1
A hasOptions() 0 4 1
1
<?php
2
3
/**
4
 * @copyright   Copyright (c) 2015 ublaboo <[email protected]>
5
 * @author      Pavel Janda <[email protected]>
6
 * @package     Ublaboo
7
 */
8
9
namespace Ublaboo\DataGrid\GroupAction;
10
11
/**
12
 * @method void onSelect()
13
 */
14
class GroupSelectAction extends GroupAction
15
{
16
17
	/**
18
	 * @var array
19
	 */
20
	protected $options;
21
22
23
	/**
24
	 * @param string $title
25
	 * @param array  $options
26
	 */
27
	public function __construct($title, $options = null)
28
	{
29
		parent::__construct($title);
30
		$this->options = $options;
0 ignored issues
show
Documentation Bug introduced by
It seems like $options can be null. However, the property $options is declared as array. Maybe change the type of the property to array|null or add a type check?

Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.

To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.

function aContainsB(array $needle = null, array  $haystack) {
    if (!$needle) {
        return false;
    }

    return array_intersect($haystack, $needle) == $haystack;
}

The function can be called with either null or an array for the parameter $needle but will only accept an array as $haystack.

Loading history...
31
	}
32
33
34
	/**
35
	 * Get action options
36
	 * @return array
37
	 */
38
	public function getOptions()
39
	{
40
		return $this->options;
41
	}
42
43
44
	/**
45
	 * Has the action some options?
46
	 * @return boolean
47
	 */
48
	public function hasOptions()
49
	{
50
		return (bool) $this->options;
51
	}
52
}
53