protected function extractTokensStructure(common\structure $val) { $aContent = $aBefore = $aChildContent = $aChildBefore = array(); $bExtract = $bContent = false; $val->isExtracted(true); foreach ($val->getContents() as $sName => $aStructure) { list($aChildContent[$sName], $aChildBefore[$sName]) = $this->extractTokens($aStructure); if ($aChildContent[$sName]) { $bContent = true; } if ($aChildBefore[$sName]) { $bExtract = true; } } if ($bExtract) { if ($bContent) { $inside = clone $val; $inside->setContents($aChildContent); $aContent[] = $inside; } $val->setContents($aChildBefore); $aBefore[] = $val; } else { //$val->setContents($aChildContent); $aContent[] = $val; } return array($aContent, $aBefore); }
protected function assignStructure(common\structure $struct, common\_var $target, $bDebug) { $aResult = array(); foreach ($struct->getContents() as $sKey => $mContent) { $aChildContent = $this->assignArray($mContent, $target, $bDebug); $aResult[$sKey] = is_array($aChildContent) ? $aChildContent : array($aChildContent); } $struct->setContents($aResult); }