Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
14 / 14
46.15% covered (danger)
46.15%
6 / 13
100.00% covered (success)
100.00%
5 / 5
CRAP
n/a
0 / 0
GorillaClaw\find_actions
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
GorillaClaw\find_filters
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
GorillaClaw\add_actions
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
GorillaClaw\add_filters
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
6 / 6
16.67% covered (danger)
16.67%
1 / 6
100.00% covered (success)
100.00%
1 / 1
8.21
GorillaClaw\_is_callable_object
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
5 / 5
50.00% covered (danger)
50.00%
2 / 4
100.00% covered (success)
100.00%
1 / 1
4.12
1<?php
2
3namespace GorillaClaw;
4
5/**
6 * find_actions
7 *
8 * @param  mixed $hook_name
9 * @param  mixed $callback
10 * @return HookCollection
11 */
12
13function find_actions(string | array $hook_name, mixed $callback = false): HookCollection {
14    return find_filters($hook_name, $callback);
15}
16
17/**
18 * find_filters
19 *
20 * @param  mixed $hook_name
21 * @param  mixed $callback
22 * @return HookCollection
23 */
24
25function find_filters(string | array $hook_name, mixed $callback = false): HookCollection {
26    global $wp_filter;
27    return (new Query($wp_filter))->find($hook_name, $callback);
28}
29
30/**
31 * add_actions
32 *
33 * @param  mixed $hook_name
34 * @param  mixed $callback
35 * @param  mixed $priority
36 * @param  mixed $accepted_args
37 * @return void
38 */
39
40function add_actions(string | array $hook_name, $callback, $priority = 10, $accepted_args = 1): void {
41    add_filters($hook_name, $callback, $priority, $accepted_args);
42}
43
44/**
45 * add_filters
46 *
47 * @param  mixed $hook_names
48 * @param  mixed $callback
49 * @param  mixed $priority
50 * @param  mixed $accepted_args
51 * @return void
52 */
53
54function add_filters(string | array $hook_names, $callback, $priority = 10, $accepted_args = 1): void {
55    if(is_string($hook_names)) {
56        $hook_names = explode(" ", $hook_names);
57    }
58
59    foreach($hook_names as $hook_name) {
60        add_filter($hook_name, $callback, $priority, $accepted_args);
61    }
62}
63
64/**
65 * _is_callable_object
66 *
67 * @param  mixed $callable
68 * @return void
69 */
70
71function _is_callable_object(callable $callable) {
72    if(is_array($callable) && is_object($callable[0])) return true;
73    return false;
74}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

GorillaClaw\_is_callable_object
71function _is_callable_object(callable $callable) {
72    if(is_array($callable) && is_object($callable[0])) return true;
72    if(is_array($callable) && is_object($callable[0])) return true;
72    if(is_array($callable) && is_object($callable[0])) return true;
72    if(is_array($callable) && is_object($callable[0])) return true;
73    return false;
GorillaClaw\add_actions
40function add_actions(string | array $hook_name, $callback, $priority = 10, $accepted_args = 1): void {
41    add_filters($hook_name, $callback, $priority, $accepted_args);
42}
GorillaClaw\add_filters
54function add_filters(string | array $hook_names, $callback, $priority = 10, $accepted_args = 1): void {
55    if(is_string($hook_names)) {
56        $hook_names = explode(" ", $hook_names);
57    }
58
59    foreach($hook_names as $hook_name) {
59    foreach($hook_names as $hook_name) {
59    foreach($hook_names as $hook_name) {
59    foreach($hook_names as $hook_name) {
60        add_filter($hook_name, $callback, $priority, $accepted_args);
59    foreach($hook_names as $hook_name) {
60        add_filter($hook_name, $callback, $priority, $accepted_args);
61    }
62}
GorillaClaw\find_actions
13function find_actions(string | array $hook_name, mixed $callback = false): HookCollection {
14    return find_filters($hook_name, $callback);
15}
GorillaClaw\find_filters
25function find_filters(string | array $hook_name, mixed $callback = false): HookCollection {
26    global $wp_filter;
27    return (new Query($wp_filter))->find($hook_name, $callback);
28}