concrete/src/Console/Command/InstallCommand.php
private function getWizard(InputInterface $input, OutputInterface $output, $firstKey = null)
    {
        $questions = $this->wizardSteps();
        $tryAgain = false;
        $result = null;

        // Loop over the questions, parse them, then yield them out
        foreach ($questions as $question) {
            if (!$firstKey && $question instanceof \Closure) {
                $result = $question($input, $output, $this);

                if ($result === false || is_string($result)) {
                    $tryAgain = true;
                    break;
                }

                continue;
            }

            $question = (array) $question;
            if ($firstKey && $question[0] !== $firstKey) {
                continue;
            }

            // If we still have a firstKey set, that means we've hit the first key. Unset so that we don't test again
            if ($firstKey) {
                $firstKey = null;
            }

            if (in_array($question[0], ['demo-password', 'demo-email'], true) && '' === (string) $input->getOption('demo-username')) {
                continue;
            }

            yield $question[0] => $this->getQuestion($question, $input);
        }

        if ($tryAgain) {
            // Try again, passing the result as the first next item. This allows us to use this like a goto
            foreach ($this->getWizard($input, $output, $result) as $key => $value) {
                yield $key => $value;
            }
        }
    }
private function getWizard(InputInterface $input, OutputInterface $output, $firstKey = null)
    {
        $questions = $this->wizardSteps();
        $tryAgain = false;
        $result = null;

        // Loop over the questions, parse them, then yield them out
        foreach ($questions as $question) {
            if (!$firstKey && $question instanceof \Closure) {
                $result = $question($input, $output, $this);

                if ($result === false || is_string($result)) {
                    $tryAgain = true;
                    break;
                }

                continue;
            }

            $question = (array) $question;
            if ($firstKey && $question[0] !== $firstKey) {
                continue;
            }

            // If we still have a firstKey set, that means we've hit the first key. Unset so that we don't test again
            if ($firstKey) {
                $firstKey = null;
            }

            if (in_array($question[0], ['demo-password', 'demo-email'], true) && '' === (string) $input->getOption('demo-username')) {
                continue;
            }

            yield $question[0] => $this->getQuestion($question, $input);
        }

        if ($tryAgain) {
            // Try again, passing the result as the first next item. This allows us to use this like a goto
            foreach ($this->getWizard($input, $output, $result) as $key => $value) {
                yield $key => $value;
            }
        }
    }
private function getWizard ( InputInterface $ input , OutputInterface $ output , $ firstKey = null ) { $ questions = $ this -> wizardSteps ( ) ; $ tryAgain = false ; $ result = null ; // Loop over the questions, parse them, then yield them out foreach ( $ questions as $ question ) { if ( ! $ firstKey && $ question instanceof \ Closure ) { $ result = $ question ( $ input , $ output , $ this ) ; if ( $ result === false || is_string ( $ result ) ) { $ tryAgain = true ; break ; } continue ; } $ question = ( array ) $ question ; if ( $ firstKey && $ question [ 0 ] !== $ firstKey ) { continue ; } // If we still have a firstKey set, that means we've hit the first key. Unset so that we don't test again if ( $ firstKey ) { $ firstKey = null ; } if ( in_array ( $ question [ 0 ] , [ 'demo-password' , 'demo-email' ] , true ) && '' === ( string ) $ input -> getOption ( 'demo-username' ) ) { continue ; } yield $ question [ 0 ] => $ this -> getQuestion ( $ question , $ input ) ; } if ( $ tryAgain ) { // Try again, passing the result as the first next item. This allows us to use this like a goto foreach ( $ this -> getWizard ( $ input , $ output , $ result ) as $ key => $ value ) { yield $ key => $ value ; } } }
A wizard generator.

@param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@param null $firstKey

@return \Generator|\Symfony\Component\Console\Question\Question[]
A wizard generator .