Ejemplo n.º 1
0
 /**
  * @return PhpMethod
  */
 protected function getEnumMethodGetValidValues()
 {
     $method = new PhpMethod(self::METHOD_GET_VALID_VALUES, array(), PhpMethod::ACCESS_PUBLIC, false, true);
     $validValues = $this->getEnumMethodValues();
     $method->addChild('return array(');
     foreach ($validValues as $validValue) {
         $method->addChild(sprintf('%s,', $method->getIndentedString($validValue, 1)));
     }
     $method->addChild(');');
     return $method;
 }
Ejemplo n.º 2
0
 /**
  * @param PhpMethod $method
  * @param StructModel $struct
  * @return ClassMap
  */
 protected function addStructToClassMapList(PhpMethod $method, StructModel $struct)
 {
     if ($struct->getIsStruct() && !$struct->getIsRestriction()) {
         $method->addChild($method->getIndentedString(sprintf('\'%s\' => \'%s\',', $struct->getName(), $this->getStructName($struct)), 1));
     }
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * @param PhpMethod $method
  * @param StructAttributeModel $attribute
  * @param string $thisAccess
  * @return Struct
  */
 protected function addStructMethodGetBodyForXml(PhpMethod $method, StructAttributeModel $attribute, $thisAccess)
 {
     if ($attribute->isXml()) {
         $method->addChild(sprintf('if (!empty($this->%1$s) && !($this->%1$s instanceof \\DOMDocument)) {', $thisAccess))->addChild($method->getIndentedString('$dom = new \\DOMDocument(\'1.0\', \'UTF-8\');', 1))->addChild($method->getIndentedString('$dom->formatOutput = true;', 1))->addChild($method->getIndentedString(sprintf('if ($dom->loadXML($this->%s)) {', $thisAccess), 1))->addChild($method->getIndentedString(sprintf('$this->%s($dom);', $attribute->getSetterName()), 2))->addChild($method->getIndentedString('}', 1))->addChild($method->getIndentedString('unset($dom);', 1))->addChild('}');
     }
     return $this;
 }
Ejemplo n.º 4
0
 /**
  * @param PhpFunctionParameter $parameter
  * @param PhpMethod $method
  * @return string
  */
 protected function getOperationCallParameterName(PhpFunctionParameter $parameter, PhpMethod $method)
 {
     $cloneParameter = clone $parameter;
     $cloneParameter->setType(null);
     if ($this->getMethod()->nameIsClean() === false) {
         return sprintf('%s%s', PhpMethod::BREAK_LINE_CHAR, $method->getIndentedString(sprintf('%s,', $cloneParameter->getPhpDeclaration()), 1));
     } else {
         return $cloneParameter->getPhpDeclaration();
     }
 }