/**
  * generate project based on template
  * @param array $services . note: here '/' in each service name is replaced by '__', to avoid dealing with packages
  * @param string $amfphpEntryPointUrl 
  * @param String absolute url to folder where to put the generated code
  * @return null
  */
 public function generate($services, $amfphpEntryPointUrl, $targetFolder)
 {
     foreach ($services as $service) {
         $service->name = str_replace('/', '__', $service->name);
     }
     $this->services = $services;
     $this->amfphpEntryPointUrl = $amfphpEntryPointUrl;
     Amfphp_BackOffice_ClientGenerator_Util::recurseCopy($this->templateFolderUrl, $targetFolder);
     $it = new RecursiveDirectoryIterator($targetFolder);
     foreach (new RecursiveIteratorIterator($it) as $file) {
         if (In_Array(SubStr($file, StrrPos($file, '.') + 1), $this->codeFileExtensions) == true) {
             $this->fileBeingProcessed = $file;
             $this->processSourceFile($file);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  *
  * @param array $services . note: here '/' in each service name must be replaced by '__', to avoid dealing with packages
  * @param string $amfphpEntryPointUrl 
  * @return string folder where the data was written
  */
 public function generate($services, $amfphpEntryPointUrl)
 {
     $this->services = $services;
     $this->amfphpEntryPointUrl = $amfphpEntryPointUrl;
     $dstFolder = 'ClientGenerator/Generated/' . date("Ymd-his-") . get_class($this);
     Amfphp_BackOffice_ClientGenerator_Util::recurseCopy($this->templateFolderUrl, AMFPHP_BACKOFFICE_ROOTPATH . $dstFolder);
     $it = new RecursiveDirectoryIterator($dstFolder);
     foreach (new RecursiveIteratorIterator($it) as $file) {
         if (In_Array(SubStr($file, StrrPos($file, '.') + 1), $this->codeFileExtensions) == true) {
             $this->fileBeingProcessed = $file;
             $this->processSourceFile($file);
         }
     }
     return $dstFolder;
 }