Esempio n. 1
0
 /**
  * If required, generates the XML message from a ComplexType object.
  * Method send() is called on the Transport object to send data to Broadworks.
  *
  * @param ComplexType|string $msg
  * @return mixed
  */
 public function send($msg)
 {
     $this->requestMsg = $msg;
     $this->responseType = is_object($this->requestMsg) ? $msg->getResponseType() : null;
     $msg = $this->ociBuilder->build($msg);
     $this->errorControl->clearLastError();
     return $this->transport->send($msg);
 }
Esempio n. 2
0
 /**
  * Builds ComplexType recursively into XML.
  *
  * @param ComplexType $complex
  * @return string
  */
 public static function buildComplex(ComplexType $complex)
 {
     $oci = '';
     $attributes = self::buildAttributes($complex->getAttributes());
     foreach ($complex->getElements() as $element) {
         if ($element instanceof ComplexType) {
             $oci .= self::buildComplex($element);
         } elseif ($element instanceof SimpleType || $element instanceof SimpleContent || $element instanceof PrimitiveType) {
             $oci .= self::buildSimple($element);
         }
     }
     if ($complex->getSelfClosed()) {
         return "<{$complex->getElementName()} {$attributes}/>";
     }
     return $oci ? "<{$complex->getElementName()} {$attributes}>{$oci}</{$complex->getElementName()}>" : '';
 }