Action_Scheduler\WP_CLI\Action
Generate_Command::execute()
Execute command.
Method of the class: Generate_Command{}
No Hooks.
Return
null
. Nothing (null).
Usage
$Generate_Command = new Generate_Command(); $Generate_Command->execute();
Generate_Command::execute() Generate Command::execute code WC 9.8.1
public function execute() { $hook = $this->args[0]; $schedule_start = $this->args[1]; $callback_args = get_flag_value( $this->assoc_args, 'args', array() ); $group = get_flag_value( $this->assoc_args, 'group', '' ); $interval = (int) get_flag_value( $this->assoc_args, 'interval', 0 ); // avoid absint() to support negative intervals $count = absint( get_flag_value( $this->assoc_args, 'count', 1 ) ); if ( ! empty( $callback_args ) ) { $callback_args = json_decode( $callback_args, true ); } $schedule_start = as_get_datetime_object( $schedule_start ); $function_args = array( 'start' => absint( $schedule_start->format( 'U' ) ), 'interval' => $interval, 'count' => $count, 'hook' => $hook, 'callback_args' => $callback_args, 'group' => $group, ); $function_args = array_values( $function_args ); try { $actions_added = $this->generate( ...$function_args ); } catch ( \Exception $e ) { $this->print_error( $e ); } $num_actions_added = count( (array) $actions_added ); $this->print_success( $num_actions_added, 'single' ); }