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