final public function run()
    {
        $this->notify("run");

        $this->addOptions();

        $this->notify("options added");

        $this->populateOptions();

        $this->addHelpCommand();

        $this->notify("options available");

        if ($this->option("help")) {
            return $this->printHelp();
        }

        $this->notify("pre main");

        try {
            $status = $this->main();
        } catch (\Exception $e) {
            $status = $this->catchMainException($e);
        }

        $this->notify("shutdown");

        return $status;
    }
final public function run()
    {
        $this->notify("run");

        $this->addOptions();

        $this->notify("options added");

        $this->populateOptions();

        $this->addHelpCommand();

        $this->notify("options available");

        if ($this->option("help")) {
            return $this->printHelp();
        }

        $this->notify("pre main");

        try {
            $status = $this->main();
        } catch (\Exception $e) {
            $status = $this->catchMainException($e);
        }

        $this->notify("shutdown");

        return $status;
    }
final public function run ( ) { $ this -> notify ( "run" ) ; $ this -> addOptions ( ) ; $ this -> notify ( "options added" ) ; $ this -> populateOptions ( ) ; $ this -> addHelpCommand ( ) ; $ this -> notify ( "options available" ) ; if ( $ this -> option ( "help" ) ) { return $ this -> printHelp ( ) ; } $ this -> notify ( "pre main" ) ; try { $ status = $ this -> main ( ) ; } catch ( \ Exception $ e ) { $ status = $ this -> catchMainException ( $ e ) ; } $ this -> notify ( "shutdown" ) ; return $ status ; }
This is an instance of the template method pattern. It runs the entire Cli Command
but leaves the `main` method abstract to ensure it is implemented in the
subclass. An optional addOptions hook is also provided here.

@return int Status code. 0 for success, other values indicate an error.
This is an instance of the template method pattern . It runs the entire Cli Command but leaves the main method abstract to ensure it is implemented in the subclass . An optional addOptions hook is also provided here .