/** * Generation template method * * @return bool */ public function generate() { try { if ($this->_validateData()) { $sourceCode = $this->_generateCode(); if ($sourceCode) { $fileName = $this->_ioObject->getResultFileName($this->_getResultClassName()); $this->_ioObject->writeResultFile($fileName, $sourceCode); return $fileName; } else { $this->_addError('Can\'t generate source code.'); } } } catch (\Exception $e) { $this->_addError($e->getMessage()); } return false; }