public function register(string $action, string $class, string $method, array $args = [])
    {
        if (!$action || !$class || !$method) {
            throw $this->c::issue('Action args empty.');
        }
        if (($via_api = $this->viaApi($action))) {
            $action = $this->stripApiVersion($action);
        }
        $default_args = [ // API = no nonce (default).
            'requires_valid_nonce' => $via_api ? false : true,
        ];
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);

        $this->registered_actions[$action] = array_merge($args, compact('class', 'method'));
    }
public function register(string $action, string $class, string $method, array $args = [])
    {
        if (!$action || !$class || !$method) {
            throw $this->c::issue('Action args empty.');
        }
        if (($via_api = $this->viaApi($action))) {
            $action = $this->stripApiVersion($action);
        }
        $default_args = [ // API = no nonce (default).
            'requires_valid_nonce' => $via_api ? false : true,
        ];
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);

        $this->registered_actions[$action] = array_merge($args, compact('class', 'method'));
    }
public function register ( string $ action , string $ class , string $ method , array $ args = [ ] ) { if ( ! $ action || ! $ class || ! $ method ) { throw $ this -> c :: issue ( 'Action args empty.' ) ; } if ( ( $ via_api = $ this -> viaApi ( $ action ) ) ) { $ action = $ this -> stripApiVersion ( $ action ) ; } $ default_args = [ // API = no nonce (default). 'requires_valid_nonce' => $ via_api ? false : true , ] ; $ args = array_merge ( $ default_args , $ args ) ; $ args = array_intersect_key ( $ args , $ default_args ) ; $ this -> registered_actions [ $ action ] = array_merge ( $ args , compact ( 'class' , 'method' ) ) ; }
Registers an action.

@since 160608 ReST utils.

@param string $action Action identifier.
@param string $class  A utility class name.
@param string $method A utility class method callback.
@param array  $args   Any additional behavioral args.
Registers an action .