/** */ private function initConfigFile() { if (false === $this->checkConfigFile->exists()) { $generate = $this->setQuestion('Do you want generate a php-git.hooks.yml file?', 'Y/n', 'Y'); if ('N' === strtoupper($generate)) { $this->io->write('<error>Remember that you need a configuration file to use php-git-hooks library.</error>'); return; } $preCommitData = $this->preCommit(); $commitMsgData = $this->commitMsg(); $this->configData = array_merge($preCommitData, $commitMsgData); $this->configFileWriter->write($this->checkConfigFile->getFile(), $this->configData); } }
/** * @return array */ public function getData() { $yaml = new Yaml(); return $yaml->parse(file_get_contents($this->checkConfigFile->getFile())); }
/** * @throws ConfigFileNotFoundException */ public function validate() { if (false === $this->checkConfigFile->exists()) { throw new ConfigFileNotFoundException(); } }