Reduce array value

@param Stack $tokens
@param Struct $parent
@return void
160332
protected function reduceArrayValue(Stack $tokens, Struct $parent)
    {
        $token = $this->read(array(Tokenizer::T_ARRAY_VALUE), $tokens);

        $name = $token->match['name'];
        $parent->$name = array_map(
            function ($value) use ($token) {
                return $this->getValue($token, $value);
            },
            preg_split('(",\\s*")', $token->match['value'])
        );
    }
1333804
public function topDiff(FrameCollection $parentFrames)
    {
        $diff = $this->frames;

        $parentFrames = $parentFrames->getArray();
        $p = count($parentFrames)-1;

        for ($i = count($diff)-1; $i >= 0 && $p >= 0; $i--) {
            /** @var Frame $tailFrame */
            $tailFrame = $diff[$i];
            if ($tailFrame->equals($parentFrames[$p])) {
                unset($diff[$i]);
            }
            $p--;
        }
        return $diff;
    }
611064
public function swap(int $current, int $parent): void {
        $tmp = $this->heap[$current];
        $this->heap[$current] = $this->heap[$parent];
        $this->heap[$parent] = $tmp;
    }
537564
private static List<Token> addParentheses(List<Token> tokens) {
        List<Token> result = new ArrayList<Token>();
        result.add(new Token(TokenType.OPENING, "("));
        for (Token token : tokens) {
            if (token.type == TokenType.OR) {
                result.add(new Token(TokenType.CLOSING, ")"));
                result.add(token);
                result.add(new Token(TokenType.OPENING, "("));
            } else {
                result.add(token);
            }
        }
        result.add(new Token(TokenType.CLOSING, ")"));
        return result;
    }
170078
private function matchHidden(ParentNode $parent) {
    $parent->addChildren($this->getSkipNodes($this->skipped));
    $this->skipped = [];
    $this->skipParent = $parent;
  }
677128
public function setParent(&$parent)
	{
		JLog::add('JNode::setParent() is deprecated.', JLog::WARNING, 'deprecated');

		if ($parent instanceof JNode || is_null($parent))
		{
			$hash = spl_object_hash($this);

			if (!is_null($this->_parent))
			{
				unset($this->_parent->children[$hash]);
			}

			if (!is_null($parent))
			{
				$parent->_children[$hash] = & $this;
			}

			$this->_parent = & $parent;
		}
	}
7464
public function removeAllPlaceholders($parent = null)
    {
        if (isset($parent)) {
            list(, , $template) = $this->getParentPlaceholder($parent);
        }

        if (!isset($template)) {
            $template = $this;
        }
        if ($template === false) {
            if ($this->throwException) {
                if (is_array($parent)) {
                    $parent = implode('.', $parent);
                }
                throw new TemplateException("Unknown scope: {$parent}");
            }
            return;
        }
        $template->placeholders = [];
    }
627069
public function parentStack() {
        $p=$this->owner;
        
        while($p) {
            $stack[]=$p;
            if($p->FolderID && $p->FolderID>0) {
                $folder=$p->Folder();
                if(!empty($folder) && $folder!==false && $folder->ID!=0) {
                    $p=$folder;
                }
            }else {
                $p=$p->LanguageID ? $p->Language() : null;
            }
        }
        
        return $stack;
    }
516836
private function unresolveRecursively(&$current, &$parent = null)
    {
        foreach ($current as $key => &$value) {
            if ($value !== null && !is_scalar($value)) {
                $this->unresolveRecursively($value, $current);
            }
            if ($key === 'x-ref-id') {
                $parent = (object)['$ref' => $value];
            }
        }
    }
78418
public function handleGetChildren($parent)
	{
		$this->setDataSource(
			call_user_func($this->tree_view_children_callback, $parent)
		);

		if ($this->getPresenter()->isAjax()) {
			$this->getPresenter()->payload->_datagrid_url = $this->refresh_url;
			$this->getPresenter()->payload->_datagrid_tree = $parent;

			$this->redrawControl('items');

			$this->onRedraw();
		} else {
			$this->getPresenter()->redirect('this');
		}
	}
835396
public function parse(array $tokens)
    {
        $symbolNodes = $this->detectSymbols($tokens);

        $nodes = $this->createTreeByBrackets($symbolNodes);

        $nodes = $this->transformTreeByFunctions($nodes);

        $this->checkGrammar($nodes);

        // Wrap the nodes in an array node.
        $rootNode = new ContainerNode($nodes);

        return $rootNode;
    }
798253
public void setParentGroups(final List<TemplateTokenInfo> tokenInfos) {
        // inefficient, perhaps should look into being provided a map of tokenInfos
        // - keep double itterator for now as
        // probably irrelevant in the face of speed as a whole
        for (final String tokenName : containsString) {
            for (final TemplateTokenInfo tokenInfo : tokenInfos) {
                if (tokenName.equals(tokenInfo.getName())) {
                    tokenInfo.setParentGroup(this);
                    break;
                }
            }
        }
    }
54881
protected function _processTree($parent)
    {
        $hasScope = $parent instanceof FunctionDef || $parent->type === 'namespace' | $parent->type === 'declare';
        if ($hasScope) {
            $this->_variables[++$this->_depth] = [];
        }
        foreach ($parent->tree as $index => $node) {
            if (!empty($node->tree)) {
                $this->_processTree($node);
            }
            if ($node->processable && $node->type === 'code') {
                $this->_uses = $node->namespace ? $node->namespace->uses : [];

                $this->_monkeyPatch($node, $parent, $index);
            }
        }
        if ($hasScope) {
            $this->_flushVariables($parent);
            $this->_depth--;
        }
    }
627384
public function setParent($parent)
	{
		if ($parent instanceof JCategoryNode || is_null($parent))
		{
			if (!is_null($this->_parent))
			{
				$key = array_search($this, $this->_parent->_children);
				unset($this->_parent->_children[$key]);
			}

			if (!is_null($parent))
			{
				$parent->_children[] = & $this;
			}

			$this->_parent = $parent;

			if ($this->id != 'root')
			{
				if ($this->parent_id != 1)
				{
					$this->_path = $parent->getPath();
				}

				$this->_path[] = $this->id . ':' . $this->alias;
			}

			if (count($parent->_children) > 1)
			{
				end($parent->_children);
				$this->_leftSibling = prev($parent->_children);
				$this->_leftSibling->_rightsibling = & $this;
			}
		}
	}
250427
protected function formatOpeningParenthesis($token, $i, array &$tokens, array &$originalTokens)
    {
        $length = 0;
        for ($j = 1; $j <= 250; ++$j) {
            if (isset($tokens[$i + $j])) {
                $next = $tokens[$i + $j];
                if ($this->parentheses->stringIsClosingParentheses($next)) {
                    $this->parentheses->writeNewInlineParentheses();
                    break;
                }

                if ($this->parentheses->invalidParenthesesTokenValue($next)
                    || $this->parentheses->invalidParenthesesTokenType($next)
                ) {
                    break;
                }

                $length += \strlen($next[Tokenizer::TOKEN_VALUE]);
            }
        }
        $this->newLine->writeNewLineForLongInlineValues($length);

        if (WhiteSpace::isPrecedingCurrentTokenOfTokenTypeWhiteSpace($originalTokens, $token)) {
            $this->formattedSql = \rtrim($this->formattedSql, ' ');
        }

        $this->newLine->addNewLineAfterOpeningParentheses();

        return $tokens;
    }
729480
protected function updateTokens(array $tokens)
    {
        $this->roles = null;
        $this->contextHash = null;

        if ($this->request === null) {
            return;
        }

        /** @var $token TokenInterface */
        foreach ($tokens as $token) {
            $token->updateCredentials($this->request);
        }

        $sessionDataContainer = $this->objectManager->get(SessionDataContainer::class);
        $sessionDataContainer->setSecurityTokens(array_merge($this->inactiveTokens, $this->activeTokens));
    }
1037551
protected function separateActiveAndInactiveTokens(array $tokens)
    {
        if ($this->request === null) {
            return;
        }

        /** @var $token TokenInterface */
        foreach ($tokens as $token) {
            if ($this->isTokenActive($token)) {
                $this->activeTokens[$token->getAuthenticationProviderName()] = $token;
            } else {
                $this->inactiveTokens[$token->getAuthenticationProviderName()] = $token;
            }
        }
    }