public function configureHook(Config\Hook $config, string $name) : void
    {
        $answer = $this->io->ask('  <info>Enable \'' . $name . '\' hook?</info> <comment>[y,n]</comment> ', 'n');
        $enable = IOUtil::answerToBool($answer);

        $config->setEnabled($enable);

        if ($enable) {
            $addAction = $this->io->ask('  <info>Add a validation action?</info> <comment>[y,n]</comment> ', 'n');

            while (IOUtil::answerToBool($addAction)) {
                $config->addAction($this->getActionConfig());
                // add another action?
                $addAction = $this->io->ask(
                    '  <info>Add another validation action?</info> <comment>[y,n]</comment> ',
                    'n'
                );
            }
        }
    }
public function configureHook(Config\Hook $config, string $name) : void
    {
        $answer = $this->io->ask('  <info>Enable \'' . $name . '\' hook?</info> <comment>[y,n]</comment> ', 'n');
        $enable = IOUtil::answerToBool($answer);

        $config->setEnabled($enable);

        if ($enable) {
            $addAction = $this->io->ask('  <info>Add a validation action?</info> <comment>[y,n]</comment> ', 'n');

            while (IOUtil::answerToBool($addAction)) {
                $config->addAction($this->getActionConfig());
                // add another action?
                $addAction = $this->io->ask(
                    '  <info>Add another validation action?</info> <comment>[y,n]</comment> ',
                    'n'
                );
            }
        }
    }
public function configureHook ( Config \ Hook $ config , string $ name ) : void { $ answer = $ this -> io -> ask ( '  <info>Enable \'' . $ name . '\' hook?</info> <comment>[y,n]</comment> ' , 'n' ) ; $ enable = IOUtil :: answerToBool ( $ answer ) ; $ config -> setEnabled ( $ enable ) ; if ( $ enable ) { $ addAction = $ this -> io -> ask ( '  <info>Add a validation action?</info> <comment>[y,n]</comment> ' , 'n' ) ; while ( IOUtil :: answerToBool ( $ addAction ) ) { $ config -> addAction ( $ this -> getActionConfig ( ) ) ; // add another action? $ addAction = $ this -> io -> ask ( '  <info>Add another validation action?</info> <comment>[y,n]</comment> ' , 'n' ) ; } } }
Configure a hook by asking some questions

@param  \CaptainHook\App\Config\Hook $config
@param  string                       $name
@return void
@throws \Exception
Configure a hook by asking some questions