final public function execute($input, $output)
    {
        $action = $this->action;
        $group  = static::getName();

        if ($this->isDisabled($action)) {
            $output->liteError(\sprintf("Sorry, The command '%s' is invalid in the group '%s'!", $action, $group));
            return -1;
        }

        $method = $this->actionSuffix ? $action . \ucfirst($this->actionSuffix) : $action;

        // the action method exists and only allow access public method.
        if (\method_exists($this, $method) && (($rfm = new \ReflectionMethod($this, $method)) && $rfm->isPublic())) {
            // before
            if (\method_exists($this, $before = 'before' . \ucfirst($action))) {
                $this->$before($input, $output);
            }

            // run action
            $result = $this->$method($input, $output);

            // after
            if (\method_exists($this, $after = 'after' . \ucfirst($action))) {
                $this->$after($input, $output);
            }

            return $result;
        }

        // if you defined the method '$this->notFoundCallback' , will call it
        if (($notFoundCallback = $this->notFoundCallback) && \method_exists($this, $notFoundCallback)) {
            $result = $this->{$notFoundCallback}($action);
        } else {
            $result = -1;
            $output->liteError("Sorry, The command '$action' not exist of the group '{$group}'!");

            // find similar command names
            $similar = Helper::findSimilar($action, $this->getAllCommandMethods(null, true));

            if ($similar) {
                $output->write(sprintf("\nMaybe what you mean is:\n    <info>%s</info>", \implode(', ', $similar)));
            } else {
                $this->showCommandList();
            }
        }

        return $result;
    }
final public function execute($input, $output)
    {
        $action = $this->action;
        $group  = static::getName();

        if ($this->isDisabled($action)) {
            $output->liteError(\sprintf("Sorry, The command '%s' is invalid in the group '%s'!", $action, $group));
            return -1;
        }

        $method = $this->actionSuffix ? $action . \ucfirst($this->actionSuffix) : $action;

        // the action method exists and only allow access public method.
        if (\method_exists($this, $method) && (($rfm = new \ReflectionMethod($this, $method)) && $rfm->isPublic())) {
            // before
            if (\method_exists($this, $before = 'before' . \ucfirst($action))) {
                $this->$before($input, $output);
            }

            // run action
            $result = $this->$method($input, $output);

            // after
            if (\method_exists($this, $after = 'after' . \ucfirst($action))) {
                $this->$after($input, $output);
            }

            return $result;
        }

        // if you defined the method '$this->notFoundCallback' , will call it
        if (($notFoundCallback = $this->notFoundCallback) && \method_exists($this, $notFoundCallback)) {
            $result = $this->{$notFoundCallback}($action);
        } else {
            $result = -1;
            $output->liteError("Sorry, The command '$action' not exist of the group '{$group}'!");

            // find similar command names
            $similar = Helper::findSimilar($action, $this->getAllCommandMethods(null, true));

            if ($similar) {
                $output->write(sprintf("\nMaybe what you mean is:\n    <info>%s</info>", \implode(', ', $similar)));
            } else {
                $this->showCommandList();
            }
        }

        return $result;
    }
final public function execute ( $ input , $ output ) { $ action = $ this -> action ; $ group = static :: getName ( ) ; if ( $ this -> isDisabled ( $ action ) ) { $ output -> liteError ( \ sprintf ( "Sorry, The command '%s' is invalid in the group '%s'!" , $ action , $ group ) ) ; return - 1 ; } $ method = $ this -> actionSuffix ? $ action . \ ucfirst ( $ this -> actionSuffix ) : $ action ; // the action method exists and only allow access public method. if ( \ method_exists ( $ this , $ method ) && ( ( $ rfm = new \ ReflectionMethod ( $ this , $ method ) ) && $ rfm -> isPublic ( ) ) ) { // before if ( \ method_exists ( $ this , $ before = 'before' . \ ucfirst ( $ action ) ) ) { $ this -> $ before ( $ input , $ output ) ; } // run action $ result = $ this -> $ method ( $ input , $ output ) ; // after if ( \ method_exists ( $ this , $ after = 'after' . \ ucfirst ( $ action ) ) ) { $ this -> $ after ( $ input , $ output ) ; } return $ result ; } // if you defined the method '$this->notFoundCallback' , will call it if ( ( $ notFoundCallback = $ this -> notFoundCallback ) && \ method_exists ( $ this , $ notFoundCallback ) ) { $ result = $ this -> { $ notFoundCallback } ( $ action ) ; } else { $ result = - 1 ; $ output -> liteError ( "Sorry, The command '$action' not exist of the group '{$group}'!" ) ; // find similar command names $ similar = Helper :: findSimilar ( $ action , $ this -> getAllCommandMethods ( null , true ) ) ; if ( $ similar ) { $ output -> write ( sprintf ( "\nMaybe what you mean is:\n    <info>%s</info>" , \ implode ( ', ' , $ similar ) ) ) ; } else { $ this -> showCommandList ( ) ; } } return $ result ; }
Run command action in the group

@param  Input  $input
@param  Output $output
@return mixed
@throws \ReflectionException
Run command action in the group