Completed
Push — master ( f2b34d...8cc0d9 )
by Simonas
21:17
created

SettingActionEvent::setData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\SettingsBundle\Event;
13
14
use Symfony\Component\EventDispatcher\Event;
15
16
class SettingActionEvent extends Event
17
{
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @var array
25
     */
26
    private $data;
27
28
    /**
29
     * @var
30
     */
31
    private $setting;
32
33
    public function __construct($name, array $data = null, $setting = null)
34
    {
35
        $this->name = $name;
36
        $this->data = $data;
0 ignored issues
show
Documentation Bug introduced by
It seems like $data can be null. However, the property $data 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...
37
        $this->setting = $setting;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getName()
44
    {
45
        return $this->name;
46
    }
47
48
    /**
49
     * @param string $name
50
     */
51
    public function setName($name)
52
    {
53
        $this->name = $name;
54
    }
55
56
    /**
57
     * @return array
58
     */
59
    public function getData()
60
    {
61
        return $this->data;
62
    }
63
64
    /**
65
     * @param array $data
66
     */
67
    public function setData($data)
68
    {
69
        $this->data = $data;
70
    }
71
72
    /**
73
     * @return mixed
74
     */
75
    public function getSetting()
76
    {
77
        return $this->setting;
78
    }
79
80
    /**
81
     * @param mixed $setting
82
     */
83
    public function setSetting($setting)
84
    {
85
        $this->setting = $setting;
86
    }
87
}