Library/Phalcon/Commands/CommandsListener.php
public function beforeCommand(Event $event, Command $command)
    {
        $parameters = $command->parseParameters([], ['h' => 'help']);

        if (
            count($parameters) < ($command->getRequiredParams() + 1) ||
            $command->isReceivedOption(['help', 'h', '?']) ||
            in_array($command->getOption(1), ['help', 'h', '?'])
        ) {
            $command->getHelp();

            return false;
        }

        if( !defined('BASE_PATH') ) {
            throw new CommandsException('Commands need a BASE_PATH constant defined.');
        }

        if ($command->canBeExternal() == false) {
            $path = $command->getOption('directory');
            if (!file_exists($path.'.phalcon')) {
                throw new CommandsException('This command should be invoked inside a Phalcon project directory.');
            }
        }

        return true;
    }
public function beforeCommand(Event $event, Command $command)
    {
        $parameters = $command->parseParameters([], ['h' => 'help']);

        if (
            count($parameters) < ($command->getRequiredParams() + 1) ||
            $command->isReceivedOption(['help', 'h', '?']) ||
            in_array($command->getOption(1), ['help', 'h', '?'])
        ) {
            $command->getHelp();

            return false;
        }

        if( !defined('BASE_PATH') ) {
            throw new CommandsException('Commands need a BASE_PATH constant defined.');
        }

        if ($command->canBeExternal() == false) {
            $path = $command->getOption('directory');
            if (!file_exists($path.'.phalcon')) {
                throw new CommandsException('This command should be invoked inside a Phalcon project directory.');
            }
        }

        return true;
    }
public function beforeCommand ( Event $ event , Command $ command ) { $ parameters = $ command -> parseParameters ( [ ] , [ 'h' => 'help' ] ) ; if ( count ( $ parameters ) < ( $ command -> getRequiredParams ( ) + 1 ) || $ command -> isReceivedOption ( [ 'help' , 'h' , '?' ] ) || in_array ( $ command -> getOption ( 1 ) , [ 'help' , 'h' , '?' ] ) ) { $ command -> getHelp ( ) ; return false ; } if ( ! defined ( 'BASE_PATH' ) ) { throw new CommandsException ( 'Commands need a BASE_PATH constant defined.' ) ; } if ( $ command -> canBeExternal ( ) == false ) { $ path = $ command -> getOption ( 'directory' ) ; if ( ! file_exists ( $ path . '.phalcon' ) ) { throw new CommandsException ( 'This command should be invoked inside a Phalcon project directory.' ) ; } } return true ; }
Before command executing

@param Event   $event
@param Command $command

@return bool
@throws CommandsException
Before command executing