| Conditions | 7 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | public function findCallback(string $hook, string $fn, string $className, int $priority = 10): array |
||
| 10 | { |
||
| 11 | global $wp_filter; |
||
| 12 | if (!isset($wp_filter[$hook])) { |
||
| 13 | return []; |
||
| 14 | } |
||
| 15 | if (!isset($wp_filter[$hook]->callbacks[$priority])) { |
||
| 16 | return []; |
||
| 17 | } |
||
| 18 | foreach ($wp_filter[$hook]->callbacks[$priority] as $callback) { |
||
| 19 | if (!is_array($callback['function'])) { |
||
| 20 | continue; |
||
| 21 | } |
||
| 22 | $object = Arr::get($callback['function'], 0); |
||
| 23 | $method = Arr::get($callback['function'], 1); |
||
| 24 | if (is_a($object, $className) && $method === $fn) { |
||
| 25 | return $callback; |
||
| 26 | } |
||
| 27 | } |
||
| 28 | return []; |
||
| 29 | } |
||
| 41 |