/** * Write class template to the schema directory. * * @param string $directory The schema class directory. * @param ClassTemplate\ClassFile class template object. * @param boolean $overwrite Overwrite class file. * @return array */ public function writeClassTemplateToPath(ClassFile $cTemplate, $filepath, $overwrite = false) { if (!file_exists($filepath) || $overwrite) { if (false === file_put_contents($filepath, $cTemplate->render())) { throw RuntimeException("Can not write file {$filepath}"); } return true; } elseif (file_exists($filepath)) { return true; } return false; }
/** * Write class template to the schema directory. * * @param string $directory The schema class directory. * @param ClassTemplate\ClassFile class template object. * @param bool $overwrite Overwrite class file. * * @return array */ protected function writeClassTemplateToPath(ClassFile $cTemplate, $filepath) { if (false === file_put_contents($filepath, $cTemplate->render())) { throw RuntimeException("Can not write file {$filepath}"); } return true; }