src/Runner/Installer.php
/**
     * Write given hook to .git/hooks directory
     *
     * @param string $hook
     */
Write given hook to .git/hooks directory
@param string $hook
Write given hook to . git / hooks directory @param string $hook
public function writeHookFile(string $hook)
    {
        $hooksDir = $this->repository->getHooksDir();
        $hookFile = $hooksDir . DIRECTORY_SEPARATOR . $hook;
        $doIt     = true;
        if ($this->needInstallConfirmation($hook)) {
            $ans  = $this->io->ask('  <comment>The \'' . $hook . '\' hook exists! Overwrite? [y,n]</comment> ', 'n');
            $doIt = IOUtil::answerToBool($ans);
        }
        if ($doIt) {
            $code = $this->getHookSourceCode($hook);
            $file = new File($hookFile);
            $file->write($code);
            chmod($hookFile, 0755);
            $this->io->write('  <info>\'' . $hook . '\' hook installed successfully</info>');
        }
    }
public function writeHookFile ( string $ hook ) { $ hooksDir = $ this -> repository -> getHooksDir ( ) ; $ hookFile = $ hooksDir . DIRECTORY_SEPARATOR . $ hook ; $ doIt = true ; if ( $ this -> needInstallConfirmation ( $ hook ) ) { $ ans = $ this -> io -> ask ( '  <comment>The \'' . $ hook . '\' hook exists! Overwrite? [y,n]</comment> ' , 'n' ) ; $ doIt = IOUtil :: answerToBool ( $ ans ) ; } if ( $ doIt ) { $ code = $ this -> getHookSourceCode ( $ hook ) ; $ file = new File ( $ hookFile ) ; $ file -> write ( $ code ) ; chmod ( $ hookFile , 0755 ) ; $ this -> io -> write ( '  <info>\'' . $ hook . '\' hook installed successfully</info>' ) ; } }
Write given hook to .git/hooks directory
 @param string $hook
Write given hook to . git / hooks directory @param string $hook
// if hook is configured and no force option is set // ask the user if overwriting the hook is ok