Inheritance: extends WsdlToPhp\PackageGenerator\Generator\AbstractGeneratorAware
示例#1
0
 /**
  * @param AbstractModel $model
  * @param array $ignoreMeta
  * @return string[]
  */
 public static function getValidMetaValues(AbstractModel $model, array $ignoreMeta = array())
 {
     $meta = $model->getMeta();
     $validMeta = array();
     foreach ($meta as $metaName => $metaValue) {
         if (!in_array($metaName, $ignoreMeta, true)) {
             $finalMeta = self::getMetaValueAnnotation($metaName, $metaValue);
             if (is_scalar($finalMeta)) {
                 $validMeta[] = $finalMeta;
             }
         }
     }
     return $validMeta;
 }
示例#2
0
 /**
  * Gets gather name class
  * @param AbstractModel $model the model for which we generate the folder
  * @return string
  */
 private function getGather(AbstractModel $model)
 {
     return Utils::getPart($this->getOptionGatherMethods(), $model->getCleanName());
 }
示例#3
0
 /**
  * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::setModel()
  * @throws \InvalidaArgumentException
  * @param AbstractModel $model
  * @return StructArray
  */
 public function setModel(AbstractModel $model)
 {
     if ($model instanceof StructModel && !$model->isArray()) {
         throw new \InvalidArgumentException('The model is not a valid array struct (name must contain Array and the model must contain only one property', __LINE__);
     }
     return parent::setModel($model);
 }
 /**
  * @param AbstractModel $model
  * @return AbstractModelFile
  */
 public function setModel(AbstractModel $model)
 {
     $this->model = $model;
     $this->getFile()->getMainElement()->setName($model->getPackagedName());
     return $this;
 }
 /**
  * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::getMeta()
  * @return string[]
  */
 public function getMeta()
 {
     return array_merge_recursive(parent::getMeta(), $this->getTypeStructMeta(), $this->getInheritanceStructMeta());
 }
 /**
  * Enumeration does not need its own value as meta information, it's like the name for struct attribute
  * @param AttributeHandler $tagAttribute
  * @param AbstractModel $model
  */
 protected function parseTagAttributeValue(AttributeHandler $tagAttribute, AbstractModel $model)
 {
     if (!$model instanceof StructValue) {
         $model->addMeta($tagAttribute->getName(), $tagAttribute->getValue(true));
     }
 }
示例#7
0
 /**
  * Main constructor
  * @see AbstractModel::__construct()
  * @uses Service::setMethods()
  * @param Generator $generator
  * @param string $name the service name
  */
 public function __construct(Generator $generator, $name)
 {
     parent::__construct($generator, $name);
     $this->setMethods(new MethodContainer($generator));
 }
示例#8
0
 /**
  * Returns the owner model object, meaning a Struct object
  * @see AbstractModel::getOwner()
  * @uses AbstractModel::getOwner()
  * @return Struct
  */
 public function getOwner()
 {
     return parent::getOwner();
 }
示例#9
0
 /**
  * @param string $wsdl
  * @return Generator
  */
 public static function getInstance($wsdl, $reset = true, $gatherMethods = GeneratorOptions::VALUE_START)
 {
     AbstractModel::purgeUniqueNames();
     AbstractModel::purgeReservedKeywords();
     $g = parent::getInstance($wsdl, $reset);
     $g->setOptionPrefix('Api')->setOptionAddComments(array('release' => '1.1.0'))->setOptionCategory(GeneratorOptions::VALUE_CAT)->setOptionGatherMethods($gatherMethods);
     self::applyParsers($g, $wsdl);
     return $g;
 }
示例#10
0
 /**
  * Main constructor
  * @see AbstractModel::__construct()
  * @uses Struct::setIsStruct()
  * @param Generator $generator
  * @param string $name the original name
  * @param bool $isStruct defines if it's a real sruct or not
  * @param bool $isRestriction defines if it's an enumeration or not
  */
 public function __construct(Generator $generator, $name, $isStruct = true, $isRestriction = false)
 {
     parent::__construct($generator, $name);
     $this->setIsStruct($isStruct)->setIsRestriction($isRestriction)->setAttributes(new StructAttributeContainer($generator))->setValues(new StructValueContainer($generator));
 }
 /**
  * @param string $name
  * @return string
  */
 protected function getParameterName($name)
 {
     return lcfirst(AbstractModel::cleanString($name));
 }
示例#12
0
 /**
  * @see \WsdlToPhp\PackageGenerator\File\AbstractModelFile::setModel()
  * @throws \InvalidaArgumentException
  * @param AbstractModel $model
  * @return StructArray
  */
 public function setModel(AbstractModel $model)
 {
     if ($model instanceof StructModel && !$model->getIsRestriction()) {
         throw new \InvalidArgumentException('Model must be a restriction containing values', __LINE__);
     }
     return parent::setModel($model);
 }
示例#13
0
 /**
  * @see \WsdlToPhp\PackageGenerator\Model\AbstractModel::getMeta()
  * @return string[]
  */
 public function getMeta()
 {
     $inheritanceStruct = $this->getInheritanceStruct();
     return array_merge_recursive(parent::getMeta(), $inheritanceStruct && !$inheritanceStruct->getIsStruct() ? $inheritanceStruct->getMeta() : array());
 }
 /**
  * @param Generator $generator
  * @param string $name
  */
 public function __construct(Generator $generator, $name, $content)
 {
     parent::__construct($generator, $name);
     $this->setContent($content);
 }