private function namedTreeToStdObject(ProcessableInterface $tree)
 {
     $result = new \StdClass();
     $msgName = $tree->getName();
     $result->{$msgName} = new \StdClass();
     foreach ($tree->getChildren() as $child) {
         $childName = $child->getName();
         if (property_exists($result->{$msgName}, $childName)) {
             $nodeToMove = $result->{$msgName}->{$childName};
             $resultContent = [];
             $resultContent[] = $nodeToMove;
             $leafContent = $this->toStdObject($child);
             $resultContent[] = $leafContent->{$childName};
             $result->{$msgName}->{$childName} = $resultContent;
         } else {
             $result->{$msgName} = $this->mergeObjects($result->{$msgName}, $this->toStdObject($child));
         }
     }
     return $result;
 }
예제 #2
0
 private function buildChildrenTreeBody(ProcessableInterface $message)
 {
     $content = '';
     $contentArray = [];
     foreach ($message->getChildren() as $child) {
         $contentArray[] = $this->buildContent($child);
     }
     $content = '{' . implode(',', $contentArray) . '}';
     return $content;
 }