| @@ -4,19 +4,19 @@ | ||
| 4 | 4 | |
| 5 | 5 | defined( 'ABSPATH' ) || exit; |
| 6 | 6 | |
| 7 | 7 | class Loader { |
| 8 | - protected array $actions; | |
| 9 | - protected array $filters; | |
| 8 | + protected array $actions; | |
| 9 | + protected array $filters; | |
| 10 | 10 | |
| 11 | - public function __construct() { | |
| 12 | - $this->actions = array(); | |
| 13 | - $this->filters = array(); | |
| 14 | - } | |
| 11 | + public function __construct() { | |
| 12 | + $this->actions = array(); | |
| 13 | + $this->filters = array(); | |
| 14 | + } | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @param string $hook |
| 18 | - * @param mixed $component | |
| 18 | + * @param $component | |
| 19 | 19 | * @param string $callback |
| 20 | 20 | * @param int $priority |
| 21 | 21 | * @param int $accepted_args |
| 22 | 22 | * |
| @@ -21,15 +21,15 @@ | ||
| 21 | 21 | * @param int $accepted_args |
| 22 | 22 | * |
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | - public function add_action( string $hook, $component, string $callback, int $priority = 10, int $accepted_args = 1 ) { | |
| 26 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); | |
| 27 | - } | |
| 25 | + public function add_action( string $hook, $component, string $callback, int $priority = 10, int $accepted_args = 1 ) { | |
| 26 | + $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); | |
| 27 | + } | |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * @param string $hook |
| 31 | - * @param mixed $component | |
| 31 | + * @param $component | |
| 32 | 32 | * @param string $callback |
| 33 | 33 | * @param int $priority |
| 34 | 34 | * @param int $accepted_args |
| 35 | 35 | * |
| @@ -34,16 +34,16 @@ | ||
| 34 | 34 | * @param int $accepted_args |
| 35 | 35 | * |
| 36 | 36 | * @return void |
| 37 | 37 | */ |
| 38 | - public function add_filter( string $hook, $component, string $callback, int $priority = 10, int $accepted_args = 1 ) { | |
| 39 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); | |
| 40 | - } | |
| 38 | + public function add_filter( string $hook, $component, string $callback, int $priority = 10, int $accepted_args = 1 ) { | |
| 39 | + $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); | |
| 40 | + } | |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @param array $hooks |
| 44 | 44 | * @param string $hook |
| 45 | - * @param mixed $component | |
| 45 | + * @param $component | |
| 46 | 46 | * @param string $callback |
| 47 | 47 | * @param int $priority |
| 48 | 48 | * @param int $accepted_args |
| 49 | 49 | * |
| @@ -48,46 +48,46 @@ | ||
| 48 | 48 | * @param int $accepted_args |
| 49 | 49 | * |
| 50 | 50 | * @return array |
| 51 | 51 | */ |
| 52 | - private function add( | |
| 53 | - array $hooks, | |
| 54 | - string $hook, | |
| 55 | - $component, | |
| 56 | - string $callback, | |
| 57 | - int $priority, | |
| 58 | - int $accepted_args | |
| 59 | - ): array { | |
| 60 | - $hooks[] = array( | |
| 61 | - 'hook' => $hook, | |
| 62 | - 'component' => $component, | |
| 63 | - 'callback' => $callback, | |
| 64 | - 'priority' => $priority, | |
| 65 | - 'accepted_args' => $accepted_args, | |
| 66 | - ); | |
| 52 | + private function add( | |
| 53 | + array $hooks, | |
| 54 | + string $hook, | |
| 55 | + $component, | |
| 56 | + string $callback, | |
| 57 | + int $priority, | |
| 58 | + int $accepted_args | |
| 59 | + ): array { | |
| 60 | + $hooks[] = array( | |
| 61 | + 'hook' => $hook, | |
| 62 | + 'component' => $component, | |
| 63 | + 'callback' => $callback, | |
| 64 | + 'priority' => $priority, | |
| 65 | + 'accepted_args' => $accepted_args, | |
| 66 | + ); | |
| 67 | 67 | |
| 68 | - return $hooks; | |
| 69 | - } | |
| 68 | + return $hooks; | |
| 69 | + } | |
| 70 | 70 | |
| 71 | - /** | |
| 72 | - * @return void | |
| 73 | - */ | |
| 74 | - public function run(): void { | |
| 75 | - foreach ( $this->filters as $hook ) { | |
| 76 | - add_filter( | |
| 77 | - $hook['hook'], | |
| 78 | - array( $hook['component'], $hook['callback'] ), | |
| 79 | - $hook['priority'], | |
| 80 | - $hook['accepted_args'] | |
| 81 | - ); | |
| 82 | - } | |
| 71 | + /** | |
| 72 | + * @return void | |
| 73 | + */ | |
| 74 | + public function run(): void { | |
| 75 | + foreach ( $this->filters as $hook ) { | |
| 76 | + add_filter( | |
| 77 | + $hook['hook'], | |
| 78 | + array( $hook['component'], $hook['callback'] ), | |
| 79 | + $hook['priority'], | |
| 80 | + $hook['accepted_args'] | |
| 81 | + ); | |
| 82 | + } | |
| 83 | 83 | |
| 84 | - foreach ( $this->actions as $hook ) { | |
| 85 | - add_action( | |
| 86 | - $hook['hook'], | |
| 87 | - array( $hook['component'], $hook['callback'] ), | |
| 88 | - $hook['priority'], | |
| 89 | - $hook['accepted_args'] | |
| 90 | - ); | |
| 91 | - } | |
| 92 | - } | |
| 84 | + foreach ( $this->actions as $hook ) { | |
| 85 | + add_action( | |
| 86 | + $hook['hook'], | |
| 87 | + array( $hook['component'], $hook['callback'] ), | |
| 88 | + $hook['priority'], | |
| 89 | + $hook['accepted_args'] | |
| 90 | + ); | |
| 91 | + } | |
| 92 | + } | |
| 93 | 93 | } |