Conditions | 4 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
33 | 22 | public function addEvent($event) |
|
34 | { |
||
35 | 22 | if (!$event instanceof EventInterface) { |
|
36 | 15 | if (!is_array($event)) { |
|
37 | $event = [ |
||
38 | 13 | 'class' => $this->eventClass, |
|
39 | 13 | 'key' => $event, |
|
40 | ]; |
||
41 | } |
||
42 | 15 | $event = Yii::createObject($event); |
|
43 | 15 | if (!$event instanceof EventInterface) { |
|
44 | 1 | throw new InvalidConfigException('The event should be an instance of "\izumi\longpoll\EventInterface".'); |
|
45 | } |
||
46 | } |
||
47 | 21 | $this->_events[$event->getKey()] = $event; |
|
48 | |||
49 | 21 | return $event; |
|
50 | } |
||
74 |