Пример #1
0
 /**
  * @param ControllerGenerator $generator
  */
 public static function saveController($generator)
 {
     $generator->setNamespace(Generator::$namespace . '\\' . $generator->getVersion() . '\\' . 'Controllers\\' . $generator->getEntityName());
     $filePath = self::formPath($generator->getVersion(), 'Controllers', $generator->getEntityName(), $generator->getEntityName() . 'Controller');
     $class = $generator->create();
     if (is_file($filePath)) {
         $diff = new ClassDiff($filePath, $class->getNamespaceName() . '\\' . $class->getName(), $class);
         $class = $diff->merge();
     }
     file_put_contents($filePath, self::generatorToString($class));
 }
Пример #2
0
 /**
  * @param Generator\SDK\SDKGenerator $generator
  */
 public static function saveSDK($generator)
 {
     $generator->setNamespace(Generator::$namespace);
     $filePath = self::$outputDir . '/' . $generator->getVersion() . '/' . $generator->getName() . '.php';
     $class = $generator->create();
     if (is_file($filePath)) {
         $diff = new ClassDiff($filePath, $class->getNamespaceName() . '\\' . $class->getName(), $class);
         $class = $diff->merge();
     }
     file_put_contents($filePath, self::generatorToString($class));
 }