defined( 'ABSPATH' ) || exit;
protected array $actions;
protected array $filters;
public function __construct() {
$this->actions = array();
$this->filters = array();
* @param mixed $component
* @param string $callback
* @param int $accepted_args
public function add_action( string $hook, $component, string $callback, int $priority = 10, int $accepted_args = 1 ) {
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
* @param mixed $component
* @param string $callback
* @param int $accepted_args
public function add_filter( string $hook, $component, string $callback, int $priority = 10, int $accepted_args = 1 ) {
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
* @param mixed $component
* @param string $callback
* @param int $accepted_args
'component' => $component,
'accepted_args' => $accepted_args,
public function run(): void {
foreach ( $this->filters as $hook ) {
array( $hook['component'], $hook['callback'] ),
foreach ( $this->actions as $hook ) {
array( $hook['component'], $hook['callback'] ),