protected static function handleEvent(CommandEvent $event)
    {
        $valid = false;

        // Construct menus ...
        $menu1 = array(
            'install' => \cli\Colors::colorize('%N%gInstall ' . self::PROJECT_NAME_SHORT . '%N'),
            'quit'    => \cli\Colors::colorize('%N%rQuit %N'),
        );
        $menu2 = \cli\Colors::colorize('%NInstall to %g' . self::getInstallPath() . ' %N');
        $menu3 = array(
            'change' => \cli\Colors::colorize('%N%gChange path to install%N'),
            'quit'   => \cli\Colors::colorize('%N%rQuit%N'),
        );
        $menu4 = 'Enter path';

        // Show the big old school banner - yeah i like :)
        self::showBanner();

        // Retrieve and store arguments
        self::initArguments($event);

        // show Version information
        self::showVersion();

        // Begin CLI loop
        while (true) {
            // Ask for OK for install in general ...
            $resolved = self::resolveTree($menu1, 'install');
            if ($resolved === 'quit') {
                break;

            } else {

                // Ask if autodetected install path is ok ...
                $resolved = self::resolveChoice($menu2);

                if ($resolved === 'y') {
                    // Try to validate and use the auto detected path ...
                    try {
                        $path  = self::validatePath(self::getInstallPath());
                        $valid = true;

                    } catch (Exception $e) {
                        return self::showError($e->getMessage());
                    }

                    // If operation failed above -> Ask user for alternative path to install
                    if ($valid !== true) {
                        self::showError('Automatic detected path seems to be invalid. Please choose another path!');
                        $path = self::askAlternatePath($menu4);
                    }

                } else {
                    // Check for alternate path ...
                    $resolved = self::resolveTree($menu3, 'change');

                    // If user decided to change the path
                    if ($resolved === 'change') {
                        // If operation failed above -> Ask user for path to install
                        $valid = self::askAlternatePath($menu4);

                    } else {
                        // Quit
                        break;
                    }
                }

                // Check if alternate path also failed in case of exception ...
                if ($valid === true) {
                    if (self::install(self::getInstallPath() . DIRECTORY_SEPARATOR) === true) {
                        self::showSuccess();
                        self::showVhostExample(self::getInstallPath() . DIRECTORY_SEPARATOR);
                        self::showOutro(self::getInstallPath());

                    } else {
                        self::showFailed();
                    }
                }
            }

            // OK, continue on to composer install
            return $valid;
        }

        // Something failed and we ended up here.
        return false;
    }
protected static function handleEvent(CommandEvent $event)
    {
        $valid = false;

        // Construct menus ...
        $menu1 = array(
            'install' => \cli\Colors::colorize('%N%gInstall ' . self::PROJECT_NAME_SHORT . '%N'),
            'quit'    => \cli\Colors::colorize('%N%rQuit %N'),
        );
        $menu2 = \cli\Colors::colorize('%NInstall to %g' . self::getInstallPath() . ' %N');
        $menu3 = array(
            'change' => \cli\Colors::colorize('%N%gChange path to install%N'),
            'quit'   => \cli\Colors::colorize('%N%rQuit%N'),
        );
        $menu4 = 'Enter path';

        // Show the big old school banner - yeah i like :)
        self::showBanner();

        // Retrieve and store arguments
        self::initArguments($event);

        // show Version information
        self::showVersion();

        // Begin CLI loop
        while (true) {
            // Ask for OK for install in general ...
            $resolved = self::resolveTree($menu1, 'install');
            if ($resolved === 'quit') {
                break;

            } else {

                // Ask if autodetected install path is ok ...
                $resolved = self::resolveChoice($menu2);

                if ($resolved === 'y') {
                    // Try to validate and use the auto detected path ...
                    try {
                        $path  = self::validatePath(self::getInstallPath());
                        $valid = true;

                    } catch (Exception $e) {
                        return self::showError($e->getMessage());
                    }

                    // If operation failed above -> Ask user for alternative path to install
                    if ($valid !== true) {
                        self::showError('Automatic detected path seems to be invalid. Please choose another path!');
                        $path = self::askAlternatePath($menu4);
                    }

                } else {
                    // Check for alternate path ...
                    $resolved = self::resolveTree($menu3, 'change');

                    // If user decided to change the path
                    if ($resolved === 'change') {
                        // If operation failed above -> Ask user for path to install
                        $valid = self::askAlternatePath($menu4);

                    } else {
                        // Quit
                        break;
                    }
                }

                // Check if alternate path also failed in case of exception ...
                if ($valid === true) {
                    if (self::install(self::getInstallPath() . DIRECTORY_SEPARATOR) === true) {
                        self::showSuccess();
                        self::showVhostExample(self::getInstallPath() . DIRECTORY_SEPARATOR);
                        self::showOutro(self::getInstallPath());

                    } else {
                        self::showFailed();
                    }
                }
            }

            // OK, continue on to composer install
            return $valid;
        }

        // Something failed and we ended up here.
        return false;
    }
protected static function handleEvent ( CommandEvent $ event ) { $ valid = false ; // Construct menus ... $ menu1 = array ( 'install' => \ cli \ Colors :: colorize ( '%N%gInstall ' . self :: PROJECT_NAME_SHORT . '%N' ) , 'quit' => \ cli \ Colors :: colorize ( '%N%rQuit %N' ) , ) ; $ menu2 = \ cli \ Colors :: colorize ( '%NInstall to %g' . self :: getInstallPath ( ) . ' %N' ) ; $ menu3 = array ( 'change' => \ cli \ Colors :: colorize ( '%N%gChange path to install%N' ) , 'quit' => \ cli \ Colors :: colorize ( '%N%rQuit%N' ) , ) ; $ menu4 = 'Enter path' ; // Show the big old school banner - yeah i like :) self :: showBanner ( ) ; // Retrieve and store arguments self :: initArguments ( $ event ) ; // show Version information self :: showVersion ( ) ; // Begin CLI loop while ( true ) { // Ask for OK for install in general ... $ resolved = self :: resolveTree ( $ menu1 , 'install' ) ; if ( $ resolved === 'quit' ) { break ; } else { // Ask if autodetected install path is ok ... $ resolved = self :: resolveChoice ( $ menu2 ) ; if ( $ resolved === 'y' ) { // Try to validate and use the auto detected path ... try { $ path = self :: validatePath ( self :: getInstallPath ( ) ) ; $ valid = true ; } catch ( Exception $ e ) { return self :: showError ( $ e -> getMessage ( ) ) ; } // If operation failed above -> Ask user for alternative path to install if ( $ valid !== true ) { self :: showError ( 'Automatic detected path seems to be invalid. Please choose another path!' ) ; $ path = self :: askAlternatePath ( $ menu4 ) ; } } else { // Check for alternate path ... $ resolved = self :: resolveTree ( $ menu3 , 'change' ) ; // If user decided to change the path if ( $ resolved === 'change' ) { // If operation failed above -> Ask user for path to install $ valid = self :: askAlternatePath ( $ menu4 ) ; } else { // Quit break ; } } // Check if alternate path also failed in case of exception ... if ( $ valid === true ) { if ( self :: install ( self :: getInstallPath ( ) . DIRECTORY_SEPARATOR ) === true ) { self :: showSuccess ( ) ; self :: showVhostExample ( self :: getInstallPath ( ) . DIRECTORY_SEPARATOR ) ; self :: showOutro ( self :: getInstallPath ( ) ) ; } else { self :: showFailed ( ) ; } } } // OK, continue on to composer install return $ valid ; } // Something failed and we ended up here. return false ; }
Handles a received event - dispatcher.

@author Benjamin Carl <opensource@clickalicious.de>
@return boolean|null TRUE on success, otherwise FALSE
@access protected
Handles a received event - dispatcher .