Yeelight /
miot-api
| 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
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 |