/**
  * @see \WsdlToPhp\PackageGenerator\Parser\Wsdl\AbstractParser::parseWsdl()
  */
 protected function parseWsdl(Wsdl $wsdl, Schema $schema = null)
 {
     foreach ($this->getTags() as $tag) {
         if ($tag instanceof AbstractTagImport && $tag->getLocationAttribute() != '') {
             $finalLocation = Utils::resolveCompletePath($this->getLocation($wsdl, $schema), $tag->getLocationAttribute());
             $this->generator->addSchemaToWsdl($wsdl, $finalLocation);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * @param string $metaName
  * @param mixed $metaValue
  * @return string|null
  */
 public static function getMetaValueAnnotation($metaName, $metaValue)
 {
     $meta = null;
     if (is_array($metaValue)) {
         $metaValue = implode(' | ', $metaValue);
     }
     $metaValue = GeneratorUtils::cleanComment($metaValue, ', ', stripos($metaName, 'SOAPHeader') === false);
     if (is_scalar($metaValue)) {
         $meta = sprintf("\t- %s: %s", $metaName, $metaValue);
     }
     return $meta;
 }
Ejemplo n.º 3
0
 /**
  * Clean a string to make it valid as PHP variable
  * @uses GeneratorUtils::cleanString()
  * @param string $string the string to clean
  * @param bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores
  * @return string
  */
 public static function cleanString($string, $keepMultipleUnderscores = true)
 {
     return GeneratorUtils::cleanString($string, $keepMultipleUnderscores);
 }
Ejemplo n.º 4
0
 /**
  * @param string $url
  * @return string
  */
 public function getUrlContent($url)
 {
     if (strpos($url, '://') !== false) {
         return Utils::getContentFromUrl($url, $this->getOptionBasicLogin(), $this->getOptionBasicPassword(), $this->getOptionProxyHost(), $this->getOptionProxyPort(), $this->getOptionProxyLogin(), $this->getOptionProxyPassword(), $this->getSoapClient()->getSoapClientStreamContextOptions());
     } elseif (is_file($url)) {
         return file_get_contents($url);
     }
     return null;
 }
Ejemplo n.º 5
0
 /**
  * @see \WsdlToPhp\PackageGenerator\File\AbstractFile::writeFile()
  * @param bool $withSrc
  * @return int|bool
  */
 public function writeFile($withSrc = true)
 {
     if (!$this->getModel() instanceof AbstractModel) {
         throw new \InvalidArgumentException('You MUST define the model before begin able to generate the file', __LINE__);
     }
     GeneratorUtils::createDirectory($this->getFileDestination($withSrc));
     $this->defineNamespace()->defineUseStatement()->addAnnotationBlock()->addClassElement();
     return parent::writeFile();
 }
Ejemplo n.º 6
0
 /**
  * Returns potential default value
  * @uses AbstractModel::getMetaValueFirstSet()
  * @uses Utils::getValueWithinItsType()
  * @uses StructAttribute::getType()
  * @uses StructAttribute::getContainsElements()
  * @return mixed
  */
 public function getDefaultValue()
 {
     if ($this->isArray()) {
         return array();
     }
     return Utils::getValueWithinItsType($this->getMetaValueFirstSet(array('default', 'Default', 'DefaultValue', 'defaultValue', 'defaultvalue')), $this->getType());
 }
Ejemplo n.º 7
0
 /**
  *
  */
 public function testGetEndPartStringEndingWithInt()
 {
     $this->assertSame('Operation', Utils::getPart(GeneratorOptions::VALUE_END, 'MyOperation0'));
 }
Ejemplo n.º 8
0
 /**
  * Allows to define from which class the curent model extends
  * @param bool $short
  * @return string
  */
 public function getExtends($short = false)
 {
     $extends = $this->getGenerator()->getOptionSoapClientClass();
     return $short ? Utils::removeNamespace($extends) : $extends;
 }
 /**
  * @param bool $withNamespace
  * @param bool $withinItsType
  * @param string $asType
  * @return mixed
  */
 public function getValue($withNamespace = false, $withinItsType = true, $asType = self::DEFAULT_VALUE_TYPE)
 {
     $value = $this->getAttribute()->value;
     if ($withNamespace === false && !empty($value)) {
         $value = implode('', array_slice(explode(':', $value), -1, 1));
     }
     if ($value !== null && $withinItsType === true) {
         $value = Utils::getValueWithinItsType($value, empty($asType) ? $this->getType() : $asType);
     }
     return $value;
 }
Ejemplo n.º 10
0
 /**
  * Returns the value with good type
  * @uses AbstractModel::getName()
  * @uses Utils::getValueWithinItsType()
  * @return mixed
  */
 public function getValue()
 {
     return Utils::getValueWithinItsType($this->getName());
 }
Ejemplo n.º 11
0
 /**
  * Allows to define from which class the curent model extends
  * @param bool $short
  * @return string
  */
 public function getExtends($short = false)
 {
     $extends = '';
     if ($this->isArray()) {
         $extends = $this->getGenerator()->getOptionStructArrayClass();
     } elseif (!$this->getIsRestriction()) {
         $extends = $this->getGenerator()->getOptionStructClass();
     }
     return $short ? Utils::removeNamespace($extends) : $extends;
 }
Ejemplo n.º 12
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testExceptionOntInitDirectory()
 {
     Utils::createDirectory($destination = self::getTestDirectory() . 'notwritable', 0444);
     $generator = self::getBingGeneratorInstance();
     $generator->setOptionComposerName('wsdltophp/invalid')->setOptionDestination($destination);
     $generator->generatePackage();
 }
Ejemplo n.º 13
0
 /**
  *
  */
 public function testCleanString()
 {
     $this->assertSame('КонтактнаяИнформация', Utils::cleanString('КонтактнаяИнформация'));
     $this->assertSame('____________________', Utils::cleanString('-"\'{&~(|`\\^¨@)°]+=}£'));
     $this->assertSame('1234567890aBcD_EfGhI', Utils::cleanString('1234567890aBcD_EfGhI'));
     $this->assertSame('äöüß', Utils::cleanString('äöüß'));
     $this->assertSame('θωερτψυιοπασδφγηςκλζχξωβνμάέήίϊΐόύϋΰώ', 'θωερτψυιοπασδφγηςκλζχξωβνμάέήίϊΐόύϋΰώ');
 }