Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function createClassmap()
 {
     /*
      * INI FILE GENERATION
      */
     $outputPath = array($this->config->getOutputPath());
     // if the psr0 autoloader has been selected, transform the class namespace into a filesystem path
     if ($this->config->getAutoloader() === Config::AUTOLOADER_PSR0) {
         $outputPath[] = str_ireplace('\\', DIRECTORY_SEPARATOR, $this->config->getNamespace());
     }
     // append the file name
     $outputPath[] = 'classmap.ini';
     // finalize the output path
     $outputPath = implode(DIRECTORY_SEPARATOR, $outputPath);
     // remove the file if exists
     $fs = new Filesystem();
     $fs->remove($outputPath);
     foreach ($this->classmap as $wsdlType => $phpType) {
         file_put_contents($outputPath, "{$wsdlType} = {$phpType}" . AbstractGenerator::LINE_FEED, FILE_APPEND);
     }
     /*
      * CLASS GENERATION
      */
     // create the class
     $class = ClassGenerator::fromReflection(new ClassReflection('\\Sapone\\Template\\ClassmapTemplate'));
     $class->setName('Classmap');
     $class->setExtendedClass('\\ArrayObject');
     $class->setNamespaceName($this->config->getNamespace());
     $doc = new DocBlockGenerator();
     $doc->setTag(new GenericTag('@service', $this->config->getWsdlDocumentPath()));
     $class->setDocBlock($doc);
     $this->serializeClass($class);
     return $class->getName();
 }