@param  SimpleXMLElement $e
@param  string           $base_dir
@param  bool             $inclusive

@return static
171053
public static function loadFromXMLElement(
        SimpleXMLElement $e,
        $base_dir,
        $inclusive
    ) {
        $filter = parent::loadFromXMLElement($e, $base_dir, $inclusive);

        if (isset($e->ignoreFiles)) {
            if (!$inclusive) {
                throw new \Psalm\Exception\ConfigException('Cannot nest ignoreFiles inside itself');
            }

            /** @var \SimpleXMLElement $e->ignoreFiles */
            $filter->file_filter = static::loadFromXMLElement($e->ignoreFiles, $base_dir, false);
        }

        return $filter;
    }
137174
static function processRemoveNodePlacement( &$node )
    {
        $nodeType = $node[0];
        if ( $nodeType == eZTemplate::NODE_ROOT )
        {
            $nodeChildren =& $node[1];
            for ( $i = 0; $i < count( $nodeChildren ); ++$i )
            {
                $nodeChild =& $nodeChildren[$i];
                eZTemplateCompiler::processRemoveNodePlacement( $nodeChild );
            }
        }
        else if ( $nodeType == eZTemplate::NODE_TEXT )
        {
            $node[3] = false;
        }
        else if ( $nodeType == eZTemplate::NODE_VARIABLE )
        {
            $node[3] = false;
        }
        else if ( $nodeType == eZTemplate::NODE_FUNCTION )
        {
            $node[4] = false;
            $nodeChildren =& $node[1];
            if ( $nodeChildren )
            {
                for ( $i = 0; $i < count( $nodeChildren ); ++$i )
                {
                    $nodeChild =& $nodeChildren[$i];
                    eZTemplateCompiler::processRemoveNodePlacement( $nodeChild );
                }
            }
        }
        else if ( $nodeType == eZTemplate::NODE_OPERATOR )
        {
        }
    }
1293375
private function findLinkNodes($siteRootId, $language, array $elementtypeIds)
    {
        $treeManager = $this->get('phlexible_tree.tree_manager');
        $elementService = $this->get('phlexible_element.element_service');

        $iconResolver = $this->get('phlexible_element.icon_resolver');
        $db = $this->get('doctrine.dbal.default_connection');

        $qb = $db->createQueryBuilder();

        $qbElementtypeIds = array_map(function($id) use ($qb) {
            return $qb->expr()->literal($id);
        }, $elementtypeIds);

        $qb
            ->select('t.id')
            ->from('tree', 't')
            ->join('t', 'element', 'e', 't.type_id = e.eid')
            ->where($qb->expr()->eq('t.siteroot_id', $qb->expr()->literal($siteRootId)))
            ->andWhere($qb->expr()->in('e.elementtype_id', $qbElementtypeIds))
            ->orderBy('t.sort', 'ASC');

        $treeIds = array_column($db->fetchAll($qb->getSQL()), 'id');

        $data = [];

        $rootTreeId = null;

        foreach ($treeIds as $treeId) {
            $tree = $treeManager->getByNodeId($treeId);
            $node = $tree->get($treeId);

            $element = $elementService->findelement($node->getTypeId());
            $elementVersion = $elementService->findLatestElementVersion($element);

            if (!isset($data[$treeId])) {
                $data[$node->getId()] = [
                    'id' => $node->getId(),
                    'eid' => $node->getTypeId(),
                    'text' => $elementVersion->getBackendTitle($language, $element->getMasterLanguage()).' ['.$node->getId().']',
                    'icon' => $iconResolver->resolveElement($element),
                    'children' => [],
                    'leaf' => true,
                    'expanded' => false,
                    'disabled' => !in_array($element->getElementtypeId(), $elementtypeIds),
                ];
            }

            do {
                $parentNode = $tree->getParent($node);

                if (!$parentNode) {
                    $rootTreeId = $node->getId();
                    break;
                }

                if (!isset($data[$parentNode->getId()])) {
                    $element = $elementService->findElement($parentNode->getTypeId());
                    $elementVersion = $elementService->findLatestElementVersion($element);

                    $data[$parentNode->getId()] = [
                        'id' => $parentNode->getId(),
                        'eid' => $parentNode->getTypeId(),
                        'text' => $elementVersion->getBackendTitle($language, $element->getMasterLanguage()).' ['.$parentNode->getId().']',
                        'icon' => $iconResolver->resolveTreeNode($parentNode, $language),
                        'children' => [],
                        'leaf' => false,
                        'expanded' => false,
                        'disabled' => !in_array($element->getElementtypeId(), $elementtypeIds),
                    ];
                } else {
                    $data[$parentNode->getId()]['leaf'] = false;
                }

                $data[$parentNode->getId()]['children'][$node->getId()] = &$data[$node->getId()];

                $node = $parentNode;
            } while ($parentNode);
        }

        if (!count($data)) {
            return [];
        }

        $data = $this->stripLinkNodeKeys($data[$rootTreeId], $db);

        return $data['children'];
    }
1353730
public function registerFromDirectorySource($directory)
    {
        $object = $this->getValidPortableElementFromDirectorySource($directory);
        if (is_null($object)) {
            throw new PortableElementNotFoundException('No valid portable element model found in the directory '.$directory);
        }

        return $this->registerModel($object, $directory);
    }
974972
public static function makeFromException($e, $overrideCode = null)
    {
        $code = $overrideCode === null ? $e->getCode() : $overrideCode;

        if ($e instanceof static) {
            $e->code = $code;

            return $e;
        }

        return new static($e->getMessage(), $code, $e);
    }
1185766
private function createDetailLogMessage(\Throwable $e) {		
		// build title
		$eName = get_class($e);
		$title = 'An ' . $eName . ' occurred';
		$debugContent =  $title . PHP_EOL .
				str_repeat('+', mb_strlen($title)) . PHP_EOL . PHP_EOL;
		$debugContent .= $e->getMessage() . PHP_EOL . PHP_EOL;
		
		if ($e instanceof \ErrorException || $e instanceof \Error) {
			$debugContent .= 'File: ' . $e->getFile() . PHP_EOL.
					'Line: ' . $e->getLine()  . PHP_EOL . PHP_EOL;
		}
			
		// build query info for PDOExceptions
		if ($e instanceof QueryStumble) {
			$debugContent .= 'STATEMENT' . PHP_EOL
					. '---------' . PHP_EOL;
			$debugContent .= $e->getQueryString() . PHP_EOL . PHP_EOL;
			
			if ($e instanceof PdoPreparedExecutionException) {
				$boundValuesStr = "";
				foreach($e->getBoundValues() as $name => $value) {
					if (!mb_strlen($boundValuesStr)) $boundValuesStr .= ', ';
					$boundValuesStr .= $name . '=' . TypeUtils::buildScalar($value) . PHP_EOL;
				}
				$debugContent .= 'Bound values: ' . $boundValuesStr . PHP_EOL;
			}
		}
		
		// build stack trace
		$debugContent .= 'STACK TRACE' . PHP_EOL
				. '-----------' . PHP_EOL;
		$debugContent .= $eName . ': ' . $e->getTraceAsString() . PHP_EOL;
		
		$curE = $e;
		while (null != ($curE = $curE->getPrevious())) {
			$debugContent .= PHP_EOL . get_class($curE) . ': ' . $this->createSimpleLogMessage($curE) . PHP_EOL 
					. $curE->getTraceAsString() . PHP_EOL;
		}
		$debugContent .= PHP_EOL;
		
		if (isset($_SERVER['REQUEST_URI'])) {
			// build http request
			$debugContent .= 'HTTP REQUEST' . PHP_EOL
					. '------------' . PHP_EOL;
			$debugContent .= $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . PHP_EOL;
			
			foreach($_SERVER as $name => $value) {
				if (stristr($name, 'HTTP_')) {
					$debugContent .= substr($name, 5) . "	" . $value . PHP_EOL;
				}
			}
		}
		
		if (!$this->stable) {
			$debugContent .= 'VARS CANNOT BE DISPLAYED DUE TO UNSTABLE PHP STATE';
		} else {
			$debugContent .= $this->createLogArrayStr('SERVER VARS', $_SERVER);
	
			if (!empty($_GET)) {
				$debugContent .= $this->createLogArrayStr('HTTP GET VARS', $_GET);
			}
			
			if (!empty($_POST)) {
				$debugContent .= $this->createLogArrayStr('HTTP POST VARS', $_POST);
			}
			
			if (!empty($_COOKIE)) {
				$debugContent .= $this->createLogArrayStr('HTTP COOKIE VARS', $_COOKIE);
			}
		}
		
		return $debugContent;
	}
571677
public function getList($templateType, $base = THELIA_TEMPLATE_DIR)
    {
        $list = $exclude = array();

        $tplIterator = TemplateDefinition::getStandardTemplatesSubdirsIterator();

        foreach ($tplIterator as $type => $subdir) {
            if ($templateType == $type) {
                $baseDir = rtrim($base, DS).DS.$subdir;

                try {
                    // Every subdir of the basedir is supposed to be a template.
                    $di = new \DirectoryIterator($baseDir);

                    /** @var \DirectoryIterator $file */
                    foreach ($di as $file) {
                        // Ignore 'dot' elements
                        if ($file->isDot() || ! $file->isDir()) {
                            continue;
                        }

                        // Ignore reserved directory names
                        if (\in_array($file->getFilename(), $exclude)) {
                            continue;
                        }

                        $list[] = new TemplateDefinition($file->getFilename(), $templateType);
                    }
                } catch (\UnexpectedValueException $ex) {
                    // Ignore the exception and continue
                }
            }
        }

        return $list;
    }
244237
static function compileTemplate( $tpl, $key, &$resourceData )
    {
        if ( !eZTemplateCompiler::isCompilationEnabled() )
            return false;

        $resourceData['use-comments'] = eZTemplateCompiler::isCommentsEnabled();

        $cacheFileName = eZTemplateCompiler::compilationFilename( $key, $resourceData );
        $resourceData['uniqid'] = md5( $resourceData['template-filename']. uniqid( "ezp". getmypid(), true ) );

        // Time limit #1:
        // We reset the time limit to 30 seconds to ensure that templates
        // have enough time to compile
        // However if time limit is unlimited (0) we leave it be
        // Time limit will also be reset after subtemplates are compiled
        $maxExecutionTime = ini_get( 'max_execution_time' );
        if ( $maxExecutionTime != 0 && $maxExecutionTime < 30 )
        {
            @set_time_limit( 30 );
        }

        $rootNode =& $resourceData['root-node'];
        if ( !$rootNode )
            return false;

        $GLOBALS['eZTemplateCompilerResourceCache'][$resourceData['template-filename']] =& $resourceData;

        $useComments = eZTemplateCompiler::isCommentsEnabled();

        if ( !$resourceData['test-compile'] )
        {
            eZTemplateCompiler::createCommonCompileTemplate();
        }

        /* Check if we need to disable the generation of spacing for the compiled templates */
        $ini = eZINI::instance();
        $spacing = 'disabled';
        if ( $ini->variable( 'TemplateSettings', 'UseFormatting' ) == 'enabled' )
        {
            $spacing = 'enabled';
        }

        $php = new eZPHPCreator( eZTemplateCompiler::compilationDirectory(), $cacheFileName,
                                 eZTemplateCompiler::TemplatePrefix(), array( 'spacing' => $spacing ) );
        $php->addComment( 'URI:       ' . $resourceData['uri'] );
        $php->addComment( 'Filename:  ' . $resourceData['template-filename'] );
        $php->addComment( 'Timestamp: ' . $resourceData['time-stamp'] . ' (' . date( 'D M j G:i:s T Y', $resourceData['time-stamp'] ) . ')' );

        $php->addCodePiece("\$oldSetArray_{$resourceData['uniqid']} = isset( \$setArray ) ? \$setArray : array();\n".
                           "\$setArray = array();\n");
// Code to decrement include level of the templates
        $php->addCodePiece( "\$tpl->Level++;\n" );
        $php->addCodePiece( "if ( \$tpl->Level > $tpl->MaxLevel )\n".
                            "{\n".
                            "\$text = \$tpl->MaxLevelWarning;".
                            "\$tpl->Level--;\n".
                            "return;\n".
                            "}\n" );
        if ( $resourceData['locales'] && count( $resourceData['locales'] ) )
        {
            $php->addComment( 'Locales:   ' . join( ', ', $resourceData['locales'] ) );

            $php->addCodePiece(
                '$locales = array( "'. join( '", "', $resourceData['locales'] ) . "\" );\n".
                '$oldLocale_'. $resourceData['uniqid']. ' = setlocale( LC_CTYPE, null );'. "\n".
                '$currentLocale_'. $resourceData['uniqid']. ' = setlocale( LC_CTYPE, $locales );'. "\n"
            );
        }
//         $php->addCodePiece( "print( \"" . $resourceData['template-filename'] . " ($cacheFileName)<br/>\n\" );" );
        if ( $useComments )
        {
            $templateFilename = $resourceData['template-filename'];
            if ( file_exists( $templateFilename ) )
            {
                $fd = fopen( $templateFilename, 'rb' );
                if ( $fd )
                {
                    $templateText = fread( $fd, filesize( $templateFilename ) );
                    $php->addComment( "Original code:\n" . $templateText );
                    fclose( $fd );
                }
            }
        }
        $php->addVariable( 'eZTemplateCompilerCodeDate', eZTemplateCompiler::CODE_DATE );
        $php->addCodePiece( "if ( !defined( 'EZ_TEMPLATE_COMPILER_COMMON_CODE' ) )\n" );
        $php->addInclude( eZTemplateCompiler::compilationDirectory() . '/common.php', eZPHPCreator::INCLUDE_ONCE_STATEMENT, array( 'spacing' => 4 ) );
        $php->addSpace();

        if ( eZTemplateCompiler::isAccumulatorsEnabled() )
        {
            $php->addCodePiece( "eZDebug::accumulatorStart( 'template_compiled_execution', 'template_total', 'Template compiled execution', true );\n" );
        }
        if ( eZTemplateCompiler::isTimingPointsEnabled() )
        {
            $php->addCodePiece( "eZDebug::addTimingPoint( 'Script start $cacheFileName' );\n" );
        }

//         $php->addCodePiece( "if ( !isset( \$vars ) )\n    \$vars =& \$tpl->Variables;\n" );
//         $php->addSpace();

        $parameters = array();
        $textName = eZTemplateCompiler::currentTextName( $parameters );

//         $php->addCodePiece( "if ( !isset( \$$textName ) )\n    \$$textName = '';\n" );
//         $php->addSpace();

        $transformedTree = array();
        eZTemplateCompiler::processNodeTransformation( $useComments, $php, $tpl, $rootNode, $resourceData, $transformedTree );

        if ( $ini->variable( 'TemplateSettings', 'TemplateOptimization' ) == 'enabled' )
        {
            /* Retrieve class information for the attribute lookup table */
            if ( isset( $resourceData['handler']->Keys ) and isset( $resourceData['handler']->Keys['class'] ) ) {
                $resourceData['class-info'] = eZTemplateOptimizer::fetchClassDeclaration( $resourceData['handler']->Keys['class'] );
            }
            /* Run the optimizations */
            eZTemplateOptimizer::optimize( $useComments, $php, $tpl, $transformedTree, $resourceData );
        }

        $staticTree = array();
        eZTemplateCompiler::processStaticOptimizations( $useComments, $php, $tpl, $transformedTree, $resourceData, $staticTree );

        $combinedTree = array();
        eZTemplateCompiler::processNodeCombining( $useComments, $php, $tpl, $staticTree, $resourceData, $combinedTree );

        $finalTree = $combinedTree;
        if ( !eZTemplateCompiler::isNodePlacementEnabled() )
            eZTemplateCompiler::processRemoveNodePlacement( $finalTree );

        eZTemplateCompiler::generatePHPCode( $useComments, $php, $tpl, $finalTree, $resourceData );

        if ( eZTemplateCompiler::isTreeEnabled( 'final' ) )
            $php->addVariable( 'finalTree', $finalTree, eZPHPCreator::VARIABLE_ASSIGNMENT, array( 'full-tree' => true ) );
        if ( eZTemplateCompiler::isTreeEnabled( 'combined' ) )
            $php->addVariable( 'combinedTree', $combinedTree, eZPHPCreator::VARIABLE_ASSIGNMENT, array( 'full-tree' => true ) );
        if ( eZTemplateCompiler::isTreeEnabled( 'static' ) )
            $php->addVariable( 'staticTree', $staticTree, eZPHPCreator::VARIABLE_ASSIGNMENT, array( 'full-tree' => true ) );
        if ( eZTemplateCompiler::isTreeEnabled( 'transformed' ) )
            $php->addVariable( 'transformedTree', $transformedTree, eZPHPCreator::VARIABLE_ASSIGNMENT, array( 'full-tree' => true ) );
        if ( eZTemplateCompiler::isTreeEnabled( 'original' ) )
            $php->addVariable( 'originalTree', $rootNode, eZPHPCreator::VARIABLE_ASSIGNMENT, array( 'full-tree' => true ) );

        if ( eZTemplateCompiler::isTimingPointsEnabled() )
            $php->addCodePiece( "eZDebug::addTimingPoint( 'Script end $cacheFileName' );\n" );
        if ( eZTemplateCompiler::isAccumulatorsEnabled() )
            $php->addCodePiece( "eZDebug::accumulatorStop( 'template_compiled_execution', true );\n" );

        if ( $resourceData['locales'] && count( $resourceData['locales'] ) )
        {
            $php->addCodePiece(
                'setlocale( LC_CTYPE, $oldLocale_'. $resourceData['uniqid']. ' );'. "\n"
            );
        }
        $php->addCodePiece('$setArray = $oldSetArray_'. $resourceData['uniqid']. ";\n");

// Code to decrement include level of the templates
        $php->addCodePiece("\$tpl->Level--;\n" );

        /*
        // dump names of all defined PHP variables
        $php->addCodePiece( "echo \"defined vars in $resourceData[uri]:<br/><pre>\\n\";\n" );
        $php->addCodePiece( 'foreach ( array_keys( get_defined_vars() ) as $var_name  ) echo "- $var_name\n";' );
        // dump tpl vars
        $php->addCodePiece( 'echo "\n-----------------------------------------------------------\nvars: ";' );
        $php->addCodePiece( 'var_dump( $vars );' );
        $php->addCodePiece( 'echo "</pre><hr/>\n";' );
        */

        if ( !$resourceData['test-compile'] )
        {
            $php->store( true );
        }

        return true;
    }
100082
static function processNodeTransformationRoot( $useComments, $php, $tpl, &$node, &$resourceData )
    {
        $nodeType = $node[0];
        if ( $nodeType == eZTemplate::NODE_ROOT )
        {
            $children = $node[1];
            $newNode = array( $nodeType,
                              false );
            if ( $children )
            {
                $newChildren = array();
                foreach ( $children as $childNode )
                {
                    $newChildNode = eZTemplateCompiler::processNodeTransformationChild( $useComments, $php, $tpl, $childNode, $resourceData );
                    if ( !$newChildNode )
                        $newChildren[] = $childNode;
                    else
                        $newChildren = array_merge( $newChildren, $newChildNode );
                }
                if ( count( $newChildren ) > 0 )
                    $newNode[1] = $newChildren;
            }
            return $newNode;
        }
        else
            $tpl->error( 'processNodeTransformation', "Unknown root type $nodeType, should be " . eZTemplate::NODE_ROOT );
        return false;
    }
341166
public boolean add(BtrpElement el) {
        switch (el.type()) {
            case VM:
                if (!this.vms.add((VM) el.getElement())) {
                    return false;
                }
                break;
            case NODE:
                if (!this.nodes.add((Node) el.getElement())) {
                    return false;
                }
                break;
            default:
                return false;
        }
        return true;

    }
215211
public function backcompat(DOMElement $el, $context = '', $isParentMf2 = false) {

		if ( $context ) {
			$mf1Classes = array($context);
		} else {
			$class = str_replace(array("\t", "\n"), ' ', $el->getAttribute('class'));
			$classes = array_filter(explode(' ', $class));
			$mf1Classes = array_intersect($classes, array_keys($this->classicRootMap));
		}

		$elHasMf2 = $this->hasRootMf2($el);

		foreach ($mf1Classes as $classname) {
			// special handling for specific properties
			switch ( $classname )
			{
				case 'hentry':
					$this->upgradeRelTagToCategory($el);

					$rel_bookmark = $this->xpath->query('.//a[contains(concat(" ",normalize-space(@rel)," ")," bookmark ") and @href]', $el);

					if ( $rel_bookmark->length ) {
						foreach ( $rel_bookmark as $tempEl ) {
							$this->addMfClasses($tempEl, 'u-url');
							$this->addUpgraded($tempEl, array('bookmark'));
						}
					}
				break;

				case 'hreview':
					$item_and_vcard = $this->xpath->query('.//*[contains(concat(" ", normalize-space(@class), " "), " item ") and contains(concat(" ", normalize-space(@class), " "), " vcard ")]', $el);

					if ( $item_and_vcard->length ) {
						foreach ( $item_and_vcard as $tempEl ) {
							if ( !$this->hasRootMf2($tempEl) ) {
								$this->backcompat($tempEl, 'vcard');
								$this->addMfClasses($tempEl, 'p-item h-card');
								$this->addUpgraded($tempEl, array('item', 'vcard'));
							}
						}
					}

					$item_and_vevent = $this->xpath->query('.//*[contains(concat(" ", normalize-space(@class), " "), " item ") and contains(concat(" ", normalize-space(@class), " "), " vevent ")]', $el);

					if ( $item_and_vevent->length ) {
						foreach ( $item_and_vevent as $tempEl ) {
							if ( !$this->hasRootMf2($tempEl) ) {
								$this->addMfClasses($tempEl, 'p-item h-event');
								$this->backcompat($tempEl, 'vevent');
								$this->addUpgraded($tempEl, array('item', 'vevent'));
							}
						}
					}

					$item_and_hproduct = $this->xpath->query('.//*[contains(concat(" ", normalize-space(@class), " "), " item ") and contains(concat(" ", normalize-space(@class), " "), " hproduct ")]', $el);

					if ( $item_and_hproduct->length ) {
						foreach ( $item_and_hproduct as $tempEl ) {
							if ( !$this->hasRootMf2($tempEl) ) {
								$this->addMfClasses($tempEl, 'p-item h-product');
								$this->backcompat($tempEl, 'vevent');
								$this->addUpgraded($tempEl, array('item', 'hproduct'));
							}
						}
					}

					$this->upgradeRelTagToCategory($el);
				break;

				case 'vevent':
					$location = $this->xpath->query('.//*[contains(concat(" ", normalize-space(@class), " "), " location ")]', $el);

					if ( $location->length ) {
						foreach ( $location as $tempEl ) {
							if ( !$this->hasRootMf2($tempEl) ) {
								$this->addMfClasses($tempEl, 'h-card');
								$this->backcompat($tempEl, 'vcard');
							}
						}
					}
				break;
			}

			// root class has mf1 properties to be upgraded
			if ( isset($this->classicPropertyMap[$classname]) ) {
				// loop through each property of the mf1 root
				foreach ( $this->classicPropertyMap[$classname] as $property => $data ) {
					$propertyElements = $this->xpath->query('.//*[contains(concat(" ", normalize-space(@class), " "), " ' . $property . ' ")]', $el);

					// loop through each element with the property
					foreach ( $propertyElements as $propertyEl ) {
						$hasRootMf2 = $this->hasRootMf2($propertyEl);

						// if the element has not been upgraded and we're not inside an mf2 root, recurse
						if ( !$this->isElementUpgraded($propertyEl, $property) && !$isParentMf2 )
						{
							$temp_context = ( isset($data['context']) ) ? $data['context'] : null;
							$this->backcompat($propertyEl, $temp_context, $hasRootMf2);
							$this->addMfClasses($propertyEl, $data['replace']);
						}

						$this->addUpgraded($propertyEl, $property);
					}
				}
			}

			if ( empty($context) && isset($this->classicRootMap[$classname]) && !$elHasMf2 ) {
				$this->addMfClasses($el, $this->classicRootMap[$classname]);
			}
		}

		return;
	}
151543
protected function createObject($mapperClass, $element, $included)
    {
        /** @var Mapper $mapper */
        $mapper = new $mapperClass;

        return $mapper->createObject(array_merge($this->getAttributes($element), $included));
    }
948590
public function CreateWithIterator( $context, $dataPool, $baseIter, $special )
	{
		switch ( $this->type )
		{
			case XPath2ExprType::Attribute:
				return AttributeNodeIterator::fromNodeTest( $context, $this->nodeTest, $baseIter );

			case XPath2ExprType::Child:

				if ( $special && $this->nodeTest != SequenceTypes::$Node )
					return new SpecialChildNodeIterator( $context, $this->nodeTest, $baseIter );

				return ChildNodeIterator::fromNodeTest( $context, $this->nodeTest, $baseIter );

			case XPath2ExprType::Descendant:

				if ( $special && $this->nodeTest != SequenceTypes::$Node )
					return new SpecialDescendantNodeIterator( $context, $this->nodeTest, false, $baseIter );

				return DescendantNodeIterator::fromNodeTest( $context, $this->nodeTest, false, $baseIter );

			case XPath2ExprType::DescendantOrSelf:

				if ( $special && $this->nodeTest != SequenceTypes::$Node )
					return SpecialDescendantNodeIterator::fromNodeTest( $context, $this->nodeTest, true, $baseIter );

				return DescendantNodeIterator::fromNodeTest( $context, $this->nodeTest, true, $baseIter );

			case XPath2ExprType::Ancestor:

				return AncestorNodeIterator::fromParts( $context, $this->nodeTest, false, $baseIter );

			case XPath2ExprType::AncestorOrSelf:

				return AncestorNodeIterator::fromParts( $context, $this->nodeTest, true, $baseIter );

			case XPath2ExprType::Following:

				return FollowingNodeIterator::fromNodeTest( $context, $this->nodeTest, $baseIter );

			case XPath2ExprType::FollowingSibling:

				return FollowingSiblingNodeIterator::fromNodeTest( $context, $this->nodeTest, $baseIter );

			case XPath2ExprType::Parent:

				return ParentNodeIterator::fromNodeTest( $context, $this->nodeTest, $baseIter );

			case XPath2ExprType::Preceding:

				return PrecedingNodeIterator::fromNodeTest( $context, $this->nodeTest, $baseIter );

			case XPath2ExprType::PrecedingSibling:

				return PrecedingSiblingNodeIterator::fromNodeTest( $context, $this->nodeTest, $baseIter );

			case XPath2ExprType::NamespaceUri:

				return NamespaceNodeIterator::fromNodeTest( $context, $this->nodeTest, $baseIter );

			case XPath2ExprType::Self:

				return SelfNodeIterator::fromNodeTest( $context, $this->nodeTest, $baseIter );

			case XPath2ExprType::Expr:

				return ExprNodeIterator::fromParts( $context, $this->node, $dataPool, $baseIter );

			case XPath2ExprType::PositionFilter:

				return new PositionFilterNodeIterator( Convert::ToInt32( $this->nodeTest ), $baseIter );

			case XPath2ExprType::ChildOverDescendants:

				return ChildOverDescendantsNodeIterator::fromParts( $context, /* ChildOverDescendantsNodeIterator.NodeTest[] */ $this->nodeTest, $baseIter );

			default:

				return null;
		}
	}
350138
protected static function resolveRelativeUrlAfterEarlyChecks(string $base, string $rel): string
    {
        /* fix url file for Windows */
        $base = preg_replace('#^file:\/\/([^/])#', 'file:///\1', $base);

        /**
         * @var mixed[]
         *
         * parse base URL and convert to local variables:
         * $scheme, $host, $path
         */
        $parts = parse_url($base);

        return static::resolveRelativeUrlToAbsoluteUrl(
            $rel,
            (
                $rel[0] === '/'
                    ? ''  // destroy path if relative url points to root
                    : ( // remove non-directory element from path
                        isset($parts['path'])
                            ? preg_replace(
                                '#/[^/]*$#',
                                '',
                                (string) $parts['path']
                            )
                            : ''
                    )
            ),
            $parts
        );
    }
1158825
final protected function ExceptionAsXML(\Exception $e, \DOMNode &$par)
	{
		//echo $e . PHP_EOL .  print_r($par, true);
		$exc = $par->appendChild($this->createElement('Exception'));
		$exc->appendChild($this->createElement('File', $e->getFile()));
		$exc->appendChild($this->createElement('Line', $e->getLine()));
		$exc->appendChild($this->createElement('Code', $e->getCode()));
		$exc->appendChild(
			$this->createElement('Message', $e->getMessage())
		);

		array_reduce(
			$e->getTrace(),
			function($parent, $el)
			{
				$trace = $this->createElement('Trace');
				$parent->appendChild($trace);
				$trace->appendChild($this->createElement('File', $el['file']));
				$trace->appendChild($this->createElement('Line', $el['line']));
				$trace->appendChild(
					$this->createElement('Function', $el['function'])
				);
				$trace->appendChild($this->createElement('Type', $el['type']));
				$args = $trace->appendChild($this->createElement('Args'));

				foreach ($el['args'] as $arg) {
					$args->appendChild(
						$this->createElement('Arg', print_r($arg, true))
					);
				}
				return $parent;
			},
			$exc->appendChild($this->createElement('StackTrace'))
		);
	}
1117998
static function instance( $input_charset_code, $output_charset_code, $use_cache = true )
    {
        $globalsKey = "eZCodePageMapper-$input_charset_code-$output_charset_code";

        if ( !isset( $GLOBALS[$globalsKey] ) ||
             !( $GLOBALS[$globalsKey] instanceof eZCodePageMapper ) )
        {
            $GLOBALS[$globalsKey] = new eZCodePageMapper( $input_charset_code, $output_charset_code, $use_cache );
        }

        return $GLOBALS[$globalsKey];
    }
1268644
public static function __static()
	{
		// XmlTypeCode::getTypeForCode( XmlTypeCode::Boolean );
		XmlSchema::$AnySimpleType = DOMSchemaType::GetBuiltInSimpleTypeByQName( new \lyquidity\xml\qname( SCHEMA_PREFIX, XmlReservedNs::xs, "anySimpleType" ) );
		XmlSchema::$AnyType = DOMSchemaType::GetBuiltInComplexTypeByQName( new \lyquidity\xml\qname( SCHEMA_PREFIX, XmlReservedNs::xs, "anyType" ) );
		XmlSchema::$AnyUri = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::AnyUri );
		XmlSchema::$AnyAtomicType = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::AnyAtomicType );
		XmlSchema::$UntypedAtomic = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::UntypedAtomic );
		XmlSchema::$Boolean = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Boolean );
		XmlSchema::$Byte = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Byte );
		XmlSchema::$Integer = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Integer );
		XmlSchema::$Decimal = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Decimal );
		XmlSchema::$Double = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Double );
		XmlSchema::$Float = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Float );
		XmlSchema::$Long = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Long );
		XmlSchema::$Short = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Short );
		XmlSchema::$UnsignedLong = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::UnsignedLong );
		XmlSchema::$UnsignedInt = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::UnsignedInt );
		XmlSchema::$UnsignedShort = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::UnsignedShort );
		XmlSchema::$DateTime = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::DateTime );
		XmlSchema::$Date = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Date );
		XmlSchema::$Time = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Time );
		XmlSchema::$Duration = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Duration );
		XmlSchema::$YearMonthDuration = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::YearMonthDuration );
		XmlSchema::$DayTimeDuration = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::DayTimeDuration );
		XmlSchema::$GYearMonth = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::GYearMonth );
		XmlSchema::$GYear = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::GYear );
		XmlSchema::$GDay = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::GDay );
		XmlSchema::$GMonth = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::GMonth );
		XmlSchema::$GMonthDay = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::GMonthDay );
		XmlSchema::$QName = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::QName );
		XmlSchema::$HexBinary = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::HexBinary );
		XmlSchema::$Base64Binary = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Base64Binary );
		XmlSchema::$NMTOKEN = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::NmToken );
		XmlSchema::$IDREF = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Idref );
		XmlSchema::$ID = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Id );
		XmlSchema::$IDREFS = DOMSchemaType::GetBuiltInSimpleTypeByQName( new \lyquidity\xml\qname( SCHEMA_PREFIX, XmlReservedNs::xs, "IDREFS" ) );
		XmlSchema::$NMTOKENS = DOMSchemaType::GetBuiltInSimpleTypeByQName( new \lyquidity\xml\qname( SCHEMA_PREFIX, XmlReservedNs::xs, "NMTOKENS" ) );
		XmlSchema::$ENTITY = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Entity );
		XmlSchema::$ENTITIES = DOMSchemaType::GetBuiltInSimpleTypeByQName( new \lyquidity\xml\qname( SCHEMA_PREFIX, XmlReservedNs::xs, "ENTITIES" ) );
		XmlSchema::$Name = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Name );
		XmlSchema::$NCName = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::NCName );
		XmlSchema::$String = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::String );
		XmlSchema::$Token = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Token );
		XmlSchema::$Notation = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Notation );
		XmlSchema::$Language = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::Language );
		XmlSchema::$NormalizedString = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( XmlTypeCode::NormalizedString );
	}