Exemplo n.º 1
0
 protected function parseSnipCallerPlaceholderValues(SnipCaller $node)
 {
     $namedPlaceholderValues = array();
     $unNamedPlaceholderValues = array();
     $inlineContent = array();
     if ($node->hasContent()) {
         $unNamedPlaceholderValues[] = $node->getContent();
     } elseif ($node->hasChilds()) {
         if (($childs = $node->getChilds()) && $childs[0] instanceof PlaceholderValue) {
             foreach ($childs as $child) {
                 if ($child->hasContent()) {
                     $value = $child->getContent();
                 } else {
                     $value = $child->getChilds();
                 }
                 if ($placeholderName = $child->getName()) {
                     $namedPlaceholderValues[$placeholderName] = $value;
                     if ($child->hasSInlineContent()) {
                         $inlineContent[$placeholderName] = $child->getSInlineContent();
                     }
                 } else {
                     $unNamedPlaceholderValues[] = $value;
                 }
             }
         } else {
             //only one
             $unNamedPlaceholderValues[] = $childs;
         }
     }
     return array($namedPlaceholderValues, $unNamedPlaceholderValues, $inlineContent);
 }
Exemplo n.º 2
0
 function enterSnipCaller(SnipCaller $node)
 {
     while (($next = $node->getNextSibling()) instanceof PlaceholderValue) {
         $node->addChild($next);
     }
     $mustValueType = false;
     if ($node->hasChilds()) {
         foreach ($node->getChilds() as $child) {
             if ($child instanceof PlaceholderValue) {
                 $mustValueType = true;
             } else {
                 if ($mustValueType) {
                     throw new SyntaxErrorException('if one placeholdervalue child exists, all children of SnipCaller must be placeholdervalue');
                 }
             }
         }
     }
 }