| Conditions | 4 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | public function hook($classname, array $hooks) |
||
| 29 | { |
||
| 30 | $controller = glsr($classname); |
||
| 31 | foreach ($hooks as $hook) { |
||
| 32 | if (2 > count($hook)) { |
||
| 33 | continue; |
||
| 34 | } |
||
| 35 | $func = Str::startsWith('filter', $hook[0]) ? 'add_filter' : 'add_action'; |
||
| 36 | $hook = array_pad($hook, 3, 10); // priority |
||
| 37 | $hook = array_pad($hook, 4, 1); // allowed args |
||
| 38 | call_user_func($func, $hook[1], [$controller, $hook[0]], (int) $hook[2], (int) $hook[3]); |
||
| 39 | } |
||
| 47 |