ActionSpecification::getIn()   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
 * 有时候,一个有意义的操作需要对多个属性进行读写,可以用方法来实现,描述一个方法,需要说清楚
13
 * 是什么方法?
14
 * 输入参数是什么?
15
 * 方法执行完有没有输出值,如果有,输出值什么?
16
 *
17
 * Class ActionSpecification
18
 */
19
class ActionSpecification extends Specification
20
{
21
    /**
22
     * 输入参数列表
23
     * 可以是0到N个,每个参数都由属性组成.
24
     *
25
     * @var
26
     */
27
    protected $in;
28
29
    /**
30
     * 输出参数列表
31
     * 可以是0到N个,每个参数都由属性组成.
32
     *
33
     * @var
34
     */
35
    protected $out;
36
37
    /**
38
     * @throws \MiotApi\Exception\SpecificationErrorException
39
     */
40
    public function init()
41
    {
42
        parent::init();
43
44
        if ($this->has('in')) {
0 ignored issues
show
Bug introduced by
The method has() does not exist on MiotApi\Contract\Specification\ActionSpecification. 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

44
        if ($this->/** @scrutinizer ignore-call */ has('in')) {
Loading history...
45
            $ins = $this->__get('in');
46
            if (!empty($ins)) {
47
                foreach ($ins as $index => $property) {
48
                    $this->in[] = new PropertySpecification($property);
49
                }
50
            }
51
        }
52
53
        if ($this->has('out')) {
54
            $outs = $this->__get('out');
55
            if (!empty($outs)) {
56
                foreach ($outs as $index => $property) {
57
                    $this->out[] = new PropertySpecification($property);
58
                }
59
            }
60
        }
61
    }
62
63
    /**
64
     * @return mixed
65
     */
66
    public function getIn()
67
    {
68
        return $this->in;
69
    }
70
71
    /**
72
     * @return mixed
73
     */
74
    public function getOut()
75
    {
76
        return $this->out;
77
    }
78
}
79