Пример #1
0
 private function assembleClassMap(TypeMap $typeMap, $linefeed, $indentation)
 {
     $classMap = [];
     foreach ($typeMap->getTypes() as $type) {
         $classMap[] = sprintf('%snew ClassMap(\'%s\', \\%s::class),', $indentation, $type->getXsdName(), $type->getFullName());
     }
     return implode($linefeed, $classMap);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  * @throws \Phpro\SoapClient\Exception\InvalidArgumentException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configFile = $input->getOption('config');
     if (!$configFile || !$this->filesystem->fileExists($configFile)) {
         throw InvalidArgumentException::invalidConfigFile();
     }
     $config = (include $configFile);
     if (!$config instanceof ConfigInterface) {
         throw InvalidArgumentException::invalidConfigFile();
     }
     $soapClient = new SoapClient($config->getWsdl(), $config->getSoapOptions());
     $typeMap = TypeMap::fromSoapClient($config->getNamespace(), $soapClient);
     $file = new FileGenerator();
     $generator = new ClassMapGenerator($config->getRuleSet());
     $output->write($generator->generate($file, $typeMap));
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $configFile = $this->input->getOption('config');
     if (!$configFile || !$this->filesystem->fileExists($configFile)) {
         throw InvalidArgumentException::invalidConfigFile();
     }
     $config = (include $configFile);
     if (!$config instanceof ConfigInterface) {
         throw InvalidArgumentException::invalidConfigFile();
     }
     $soapClient = new SoapClient($config->getWsdl(), $config->getSoapOptions());
     $typeMap = TypeMap::fromSoapClient($config->getNamespace(), $soapClient);
     $generator = new TypeGenerator($config->getRuleSet());
     foreach ($typeMap->getTypes() as $type) {
         $path = $type->getPathname($config->getDestination());
         if ($this->handleType($generator, $type, $path)) {
             $this->output->writeln(sprintf('Generated class %s to %s', $type->getFullName(), $path));
         }
     }
     $this->output->writeln('Done');
 }