Loads assets from the supplied node.

@param \Twig_Node $node

@return array An array of asset formulae indexed by name
3334
private function loadNode(\Twig_Node $node)
    {
        $formulae = array();

        if ($node instanceof AsseticNode) {
            $formulae[$node->getAttribute('name')] = array(
                $node->getAttribute('inputs'),
                $node->getAttribute('filters'),
                array(
                    'output'  => $node->getAttribute('asset')->getTargetPath(),
                    'name'    => $node->getAttribute('name'),
                    'debug'   => $node->getAttribute('debug'),
                    'combine' => $node->getAttribute('combine'),
                    'vars'    => $node->getAttribute('vars'),
                ),
            );
        } elseif ($node instanceof \Twig_Node_Expression_Function) {
            $name = version_compare(\Twig_Environment::VERSION, '1.2.0-DEV', '<')
                ? $node->getNode('name')->getAttribute('name')
                : $node->getAttribute('name');

            if ($this->twig->getFunction($name) instanceof AsseticFilterFunction) {
                $arguments = array();
                foreach ($node->getNode('arguments') as $argument) {
                    $arguments[] = eval('return '.$this->twig->compile($argument).';');
                }

                /** @var \Assetic\Extension\Twig\AsseticFilterInvoker $invoker */
                $invoker = $this->twig->getExtension('assetic')->getFilterInvoker($name);

                $inputs  = isset($arguments[0]) ? (array) $arguments[0] : array();
                $filters = $invoker->getFilters();
                $options = array_replace($invoker->getOptions(), isset($arguments[1]) ? $arguments[1] : array());

                if (!isset($options['name'])) {
                    $options['name'] = $invoker->getFactory()->generateAssetName($inputs, $filters, $options);
                }

                $formulae[$options['name']] = array($inputs, $filters, $options);
            }
        }

        foreach ($node as $child) {
            if ($child instanceof \Twig_Node) {
                $formulae += $this->loadNode($child);
            }
        }

        if ($node->hasAttribute('embedded_templates')) {
            foreach ($node->getAttribute('embedded_templates') as $child) {
                $formulae += $this->loadNode($child);
            }
        }

        // We need to also check the parent since else it won't get parsed
        if ($node->hasNode('parent') && $node->getNode('parent') instanceof \Twig_Node_Expression_Constant) {
            $parent = $node->getNode('parent')->getAttribute('value');
            if ($parent[0] === '!') {
                $source = $this->twig->getLoader()->getSource($parent);
                $tokens = $this->twig->tokenize($source, $parent);
                $nodes  = $this->twig->parse($tokens);

                $formulae += $this->loadNode($nodes);
            }
        }

        return $formulae;
    }
359405
protected function loadModelTable(\DOMNode $node)
    {
        $tableObject = new TableMigration($this);
        $loaded = $tableObject->load($node);

        if ($loaded && in_array($tableObject->getName(), $this->pivotTables)) {
            $tableObject->isPivotTable(true);
        } else if ($tableObject->isPivotTable()) {
            $this->pivotTables[] = $tableObject->getName();
        } // else if

        return $loaded ? $tableObject : false;
    }
134596
function parseNode($node) {
		$src=false;
		$params = array();
		if (isset($node['@attrib'])) {
			$params = $node['@attrib'];
			unset($node['@attrib']);
		}
		// find src
		if (array_key_exists('src',$params))
			$src = $params['src'];
		elseif (array_key_exists('href',$params))
			$src = $params['href'];
		if ($src) {
			$out = '<?php \Assets::instance()->addNode(array(';
			foreach($params as $key=>$val)
				$out.=var_export($key,true).'=>'.(preg_match('/{{(.+?)}}/s',$val)
					?$this->template->token($val):var_export($val,true)).',';
			$out.=')); ?>';
			return $out;
		}
		// inner content
		if (isset($node[0]) && isset($params['type'])) {
			if (!isset($params['group']))
				$params['group'] = ($params['type'] == 'js')
					? 'footer' : 'head';
			if (!isset($params['slot']))
				$params['slot'] = 'inline';
			if ($this->f3->get('ASSETS.handle_inline'))
				return '<?php \Assets::instance()->addInline('.
				'$this->resolve('.(var_export($node,true)).
					',get_defined_vars(),0,false,false),'.
				var_export($params['type'],true).','.
				var_export($params['group'],true).','.
				var_export($params['slot'],true).'); ?>';
			else
				// just bypass
				return $this->f3->call($this->formatter[$params['type']],array(array(
					'data'=>$this->template->build($node),
					'origin'=>'inline'
				)));
		}
	}
603365
public function run(string $file, Node $node): array
    {
        $hints = [];
        $catch_block_list = [];

        foreach ($node->children as $catch) {
            $klasses = $catch->children['class'];
            $stmts = $catch->children['stmts'];
            foreach ($catch_block_list as $catch_block) {
                $catch_klasses = $catch_block->children['class'];
                $catch_stmts = $catch_block->children['stmts'];
                if ($this->isEqualsWithoutLineno($catch_stmts, $stmts)) {
                    $hints[] = new Hint(
                        self::HINT_TYPE,
                        $this->messages(array_merge($catch_klasses->children, $klasses->children)),
                        $file,
                        $catch_stmts->lineno,
                        self::HINT_LINK
                    );
                }
            }
            $catch_block_list[] = $catch;
        }

        return $hints;
    }
374579
public function compile(Node\File $node): array {
        if (is_null($node->class)) {
            throw new UnexpectedValueException('File without class cannot be saved');
        }

        $result = $node->uses;

        if (is_a($node->class, Node\Class_::class)) {
            $result[] = $this->compileClass($node->class);
        } else if (is_a($node->class, Node\Enum::class)) {
            $result[] = $this->compileEnum($node->class);
        }

        if (!is_null($node->namespace)) {
            $result = [new PHPNode\Stmt\Namespace_($node->namespace, $result)];
        }

        return $result;
    }
576869
private function getChildrenValues(\DOMNode $node, $name)
    {
        $children = array();
        foreach ($node->childNodes as $child) {
            if ($child instanceof \DOMElement && $child->localName === $name) {
                $children[] = $child->nodeValue;
            }
        }

        return $children;
    }
1331885
public function getNodeAttributes(Node $node) {
        // Extract the properties of the node
        $attributes = $node->getProperties();

        // Add the node id to the attributes since \\Orientdb\Node
        // does not consider it to be a property, it is treated differently
        // and available through the getId() method.
        $attributes[$this->model->getKeyName()] = $node->getId();

        return $attributes;
    }
82610
public function run(string $file, Node $node): array
    {
        if ($node->flags !== \ast\flags\BINARY_BOOL_OR) {
            return [];
        }

        if ($this->isArrayAndInstanceOfCountable($node->children['left'], $node->children['right'])
             || $this->isArrayAndInstanceOfCountable($node->children['right'], $node->children['left'])) {
            return [new Hint(
                self::HINT_TYPE,
                self::HINT_MESSAGE,
                $file,
                $node->lineno,
                self::HINT_LINK
            )];
        }

        return [];
    }
120811
public function enterNode(Node $node)
    {
        if ($node instanceof UseUse) {
            $this->imports[] = $node->name->toString();
        }

        return $node;
    }
985116
public static function exportList($node)
    {
        $child = $node->addChild('thumbnailtypes');
        $list = static::getList();
        foreach ($list as $link) {
            $linkNode = $child->addChild('thumbnailtype');
            $linkNode->addAttribute('name', $link->getName());
            $linkNode->addAttribute('handle', $link->getHandle());
            $linkNode->addAttribute('sizingMode', $link->getSizingMode());
            $linkNode->addAttribute('upscalingEnabled', $link->isUpscalingEnabled() ? '1' : '0');
            $linkNode->addAttribute('keepAnimations', $link->isKeepAnimations() ? '1' : '0');
            if ($link->getWidth()) {
                $linkNode->addAttribute('width', $link->getWidth());
            }
            if ($link->getHeight()) {
                $linkNode->addAttribute('height', $link->getHeight());
            }
            if ($link->isRequired()) {
                $linkNode->addAttribute('required', $link->isRequired());
            }
            $linkNode->addAttribute('limitedToFileSets', $link->isLimitedToFileSets() ? '1' : '0');
            $filesetsNode = null;
            foreach ($link->getAssociatedFileSets() as $afs) {
                $fileSet = FileSet::getByID($afs->getFileSetID());
                if ($fileSet !== null) {
                    if ($filesetsNode === null) {
                        $filesetsNode = $linkNode->addChild('fileSets');
                    }
                    $filesetsNode->addChild('fileSet')->addAttribute('name', $fileSet->getFileSetName());
                }
            }
        }
    }
957228
public function getInternalLinks( \DOMNode $node ) : array
	{
		$this->guardHasOwnerDocument( $node );

		$internalLinks = [];
		$xpath         = new \DOMXPath( $node->ownerDocument );
		$aTags         = $xpath->query( '*//a[@href]' );

		/** @var \DOMElement $aTag */
		foreach ( $aTags as $aTag )
		{
			$href = $aTag->getAttribute( 'href' );
			if ( !$this->isHyperRefIgnored( $href ) )
			{
				$internalLinks[] = $aTag;
			}
		}

		return $internalLinks;
	}
1267932
protected function _include(array $node) {
        $attrib=$node['@attrib'];
        $hive='get_defined_vars()';
        $if = false;
        $include = $attrib[0];
        if (isset($attrib[1]) && strpos($attrib[0], 'if ')) {
            $if = substr($attrib[0], 3);
            $include = $attrib[1];
        }

        return
            '<?php '.($if?
                ('if ('.$this->token($if).') '):'').
                ('echo $this->render('.
                    (preg_match('/@.*$/',$include)?
                        $this->token($include):
                        Base::instance()->stringify($include)).','.
                    '$this->mime,'.$hive.'); ?>');
    }
761251
private function loadTags(&$tags, \DOMXPath $xpath, \DOMNode $context = null)
    {
        $result = [];

        /** @var \DOMElement $node */
        foreach ($xpath->query('x:tag', $context) as $node) {
            $tag = $this->loadTag($xpath, $node);
            $this->validateTag($tag, $tags);

            $result[] = $tag;
        }

        return $result;
    }
87233
private function processNode(array $node): array
    {
        $config = [];
        foreach ($node as $name => $value) {
            if (\preg_match('/^num__([0-9]+)$/', $name, $matches)) {
                $name = $matches[1];
            }
            if (\count($nameEx = \explode('.', $name)) > 1) {
                $name = \array_shift($nameEx);
                $mergeBase = isset($config[$name]) ? $config[$name] : [];
                $mergeWith = $this->processNode([\implode('.', $nameEx) => $value]);
                $config[$name] = \array_merge_recursive($mergeBase, $mergeWith);
            } elseif (\is_array($value)) {
                $config[$name] = $this->processNode($value);
            } else {
                $config[$name] = $this->castValue((string)$value);
            }
        }
        return $config;
    }
181759
public function indexAction(ResourceNode $node)
    {
        $resource = $this->manager->getResourceFromNode($node);

        $user = $this->get('security.token_storage')->getToken()->getUser();
        $isFavourite = $this->get('claroline.persistence.object_manager')->getRepository('HeVinciFavouriteBundle:Favourite')
            ->findOneBy(array('user' => $user, 'resourceNode' => $node));

        return array(
            'isFavourite' => $isFavourite ? true : false,
            '_resource' => $resource,
        );
    }
61063
protected function _getOptions(&$node)
	{
		$v = (int) $node['client_id'];
		$clientId = $v ? $v : 0;

		$options = array();
		$path1 = null;
		$path2 = null;

		// Load template entries for each menuid
		$db = App::get('db');
		$query = $db->getQuery()
			->select('template')
			->from('#__template_styles')
			->whereEquals('client_id', (int) $clientId)
			->whereEquals('home', '1');
		$db->setQuery($query->toString());
		$template = $db->loadResult();

		if ($module = (string) $node['module'])
		{
			$base = ($clientId == 1) ? PATH_CORE : PATH_CORE;
			$module = preg_replace('#\W#', '', $module);
			$path1 = PATH_CORE . '/modules/' . $module . '/tmpl';
			$path2 = PATH_APP . '/templates/' . $template . '/html/' . $module;
			$options[] = Builder\Select::option('', '');
		}

		if ($path1 && $path2)
		{
			$path1 = Util::normalizePath($path1);
			$path2 = Util::normalizePath($path2);

			$files = App::get('filesystem')->files($path1, '^[^_]*\.php$');
			foreach ($files as $file)
			{
				$options[] = Builder\Select::option(App::get('filesystem')->extension($file));
			}

			if (is_dir($path2) && $files = App::get('filesystem')->files($path2, '^[^_]*\.php$'))
			{
				$options[] = Builder\Select::optgroup(App::get('language')->txt('JOPTION_FROM_DEFAULT'));
				foreach ($files as $file)
				{
					$options[] = Builder\Select::option(App::get('filesystem')->extension($file));
				}
				$options[] = Builder\Select::optgroup(App::get('language')->txt('JOPTION_FROM_DEFAULT'));
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::_getOptions($node), $options);

		return $options;
	}
1130443
public function mutate(Node $node)
    {
        return [
            new Node\Stmt\Expression($node->expr),
            new Node\Stmt\Return_(
                new Node\Expr\ConstFetch(new Node\Name('null'))
            ),
        ];
    }