Completed
Push — master ( bf6b48...8613c0 )
by Pavel
9s
created

GroupSelectAction::hasOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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
use Nette;
12
13
/**
14
 * @method void onSelect()
15
 */
16
class GroupSelectAction extends GroupAction
17
{
18
	/**
19
	 * @var array
20
	 */
21
	protected $options;
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
	 * Get action options
35
	 * @return array
36
	 */
37
	public function getOptions()
38
	{
39
		return $this->options;
40
	}
41
42
	/**
43
	 * Has the action some options?
44
	 * @return boolean
45
	 */
46
	public function hasOptions()
47
	{
48
		return (bool) $this->options;
49
	}
50
}
51