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 | * 简单的事件,用属性的变化来通知用户。复杂的事件,需要用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
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 |