/** * Creates a new file for each the base class and the DO class with the code for * the object with the given name. Will overwrite existing file! * * @param string $name The object's name. * @param string $baseFileName The file name the base class will be written to. * @param string $fileName The file name the class will be written to. * * @author Ralf Schubert * @version * Version 0.1, 15.01.2011<br /> * Version 0.2, 24.06.2014 (ID#194: split base class and DO class into separate files to better support auto loading.)<br /> */ protected function createNewServiceObject($name, $baseFileName, $fileName) { $namespace = $this->getNamespaceByObjectName($name); $path = dirname($fileName); if (!file_exists($path)) { $folder = new Folder(); $folder->create($path); } // create base class file $content = '<?php' . PHP_EOL . 'namespace ' . $namespace . ';' . PHP_EOL . PHP_EOL . $this->generateBaseObjectCode($name) . PHP_EOL; $baseFile = new File(); $baseFile->create($baseFileName)->writeContent($content); // create class file $content = '<?php' . PHP_EOL . 'namespace ' . $namespace . ';' . PHP_EOL . PHP_EOL . $this->generateObjectCode($name) . PHP_EOL; $file = new File(); $file->create($fileName)->writeContent($content); }