| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function normalizeControllerMethod($widget) |
||
| 13 | { |
||
| 14 | // We decide to call data method on widget object by default. |
||
| 15 | $controllerMethod = [$widget, 'data']; |
||
| 16 | $ctrlClass = get_class($widget); |
||
| 17 | |||
| 18 | // If the user has explicitly declared controller class path on widget |
||
| 19 | // then we decide to call data method on that instead. |
||
| 20 | if ($widget->controller) { |
||
| 21 | $ctrlClass = $widget->controller; |
||
| 22 | $controllerMethod = ($ctrlClass) . '@data'; |
||
| 23 | } |
||
| 24 | |||
| 25 | $this->checkControllerExists($ctrlClass); |
||
| 26 | $this->checkDataMethodExists($ctrlClass); |
||
| 27 | |||
| 28 | $widget->controller = $controllerMethod; |
||
| 29 | } |
||
| 30 | |||
| 51 |