EventSpecification::getArguments()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: sheldon
5
 * Date: 18-6-8
6
 * Time: 下午3:43.
7
 */
8
9
namespace MiotApi\Contract\Specification;
10
11
/**
12
 * 简单的事件,用属性的变化来通知用户。复杂的事件,需要用Event来表达:
13
 * 发生了什么事情?
14
 * 哪些属性发生了变化?
15
 *
16
 * Class EventSpecification
17
 */
18
class EventSpecification extends Specification
19
{
20
    /**
21
     * 参数列表
22
     * 可以是0到N个,每个参数都由属性组成.
23
     *
24
     * @var
25
     */
26
    protected $arguments;
27
28
    /**
29
     * @throws \MiotApi\Exception\SpecificationErrorException
30
     */
31
    public function init()
32
    {
33
        parent::init();
34
35
        if ($this->has('arguments')) {
0 ignored issues
show
Bug introduced by
The method has() does not exist on MiotApi\Contract\Specification\EventSpecification. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        if ($this->/** @scrutinizer ignore-call */ has('arguments')) {
Loading history...
36
            $arguments = $this->__get('arguments');
37
            if (!empty($arguments)) {
38
                foreach ($arguments as $argument) {
39
                    $this->arguments[] = new PropertySpecification($argument);
40
                }
41
            }
42
        }
43
    }
44
45
    /**
46
     * @return mixed
47
     */
48
    public function getArguments()
49
    {
50
        return $this->arguments;
51
    }
52
}
53