| Conditions | 5 |
| Paths | 9 |
| Total Lines | 24 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 5.1647 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 288 | public function handle_event(dbaevent $event, $name) |
|
| 36 | { |
||
| 37 | 288 | $object = $event->get_object(); |
|
| 38 | 288 | $found = empty($this->classes); |
|
| 39 | 288 | foreach ($this->classes as $classname) { |
|
| 40 | 288 | if (is_a($object, $classname)) { |
|
| 41 | 67 | $found = true; |
|
| 42 | 67 | break; |
|
| 43 | } |
||
| 44 | } |
||
| 45 | 288 | if (!$found) { |
|
| 46 | 288 | return; |
|
| 47 | } |
||
| 48 | |||
| 49 | try { |
||
| 50 | 184 | $interface = \midcom::get()->componentloader->get_interface_class($this->component); |
|
| 51 | } catch (\midcom_error $e) { |
||
| 52 | debug_add("Failed to load the component {$this->component}: " . $e->getMessage(), MIDCOM_LOG_INFO); |
||
| 53 | return; |
||
| 54 | } |
||
| 55 | 184 | $operation = $this->operations[$name]; |
|
| 56 | 184 | debug_add("Calling [{$this->component}]_interface->trigger_watch({$operation}, \$object)"); |
|
| 57 | |||
| 58 | 184 | $interface->trigger_watch($operation, $object); |
|
| 59 | 184 | } |
|
| 61 |