Return a collection of testcase nodes
from the xml document.

@return array
324673
protected function getCaseNodes(): array
    {
        $caseNodes = $this->xml->xpath('//testcase');
        $cases = [];
        foreach ($caseNodes as $node) {
            $case = $node;
            if (!isset($cases[(string) $node['file']])) {
                $cases[(string) $node['file']] = [];
            }
            $cases[(string) $node['file']][] = $node;
        }

        return $cases;
    }
218731
protected function getNodes()
    {
        $language = $this->currentSiteManager->getSiteLanguage();
        $siteId = $this->currentSiteManager->getSiteId();
        $nodes = $this->nodeRepository->getMenuTree($language, $siteId);

        return $this->getGrantedNodes($nodes);
    }
335234
public function getIterator()
    {
        $elements = new NodeList();
        if ($this->node->hasChildNodes()) {
            foreach ($this->node->childNodes as $node) {
                $elements[] = new Element($node);
            }
        }

        return $elements;
    }
388709
private function getNodes(): array
    {
        return [
            new ConfigurationNode\ViewNode(),
            new ConfigurationNode\DesignNode(),
            new ConfigurationNode\DesignListNode(),
            new ConfigurationNode\DefaultViewTemplatesNode(),
            new ConfigurationNode\HttpCacheNode(),
            new ConfigurationNode\BlockDefinitionNode(),
            new ConfigurationNode\BlockTypeNode(),
            new ConfigurationNode\BlockTypeGroupNode(),
            new ConfigurationNode\LayoutTypeNode(),
            new ConfigurationNode\QueryTypeNode(),
            new ConfigurationNode\PageLayoutNode(),
            new ConfigurationNode\ApiKeysNode(),
            new ConfigurationNode\ValueTypeNode(),
            new ConfigurationNode\DebugNode(),
        ];
    }
588611
public function GetNodeKind()
	{
		switch ( $this->TypeCode )
		{
			case XmlTypeCode::Item:
				return XPathNodeType::All;
			case XmlTypeCode::Document:
				return XPathNodeType::Root;
			case XmlTypeCode::Element:
				return XPathNodeType::Element;
			case XmlTypeCode::Attribute:
				return XPathNodeType::Attribute;
			case XmlTypeCode::Namespace_:
				return XPathNodeType::NamespaceURI;
			case XmlTypeCode::Text:
				return XPathNodeType::Text;
			case XmlTypeCode::Comment:
				return XPathNodeType::Comment;
			case XmlTypeCode::ProcessingInstruction:
				return XPathNodeType::ProcessingInstruction;
			default:
				throw new InvalidOperationException( "GetNodeKind()" );
		}
	}
93594
public function getNodes()
    {
        $nodes = [];
        foreach ($this->applications as $application) {
            foreach ($application->getNodes() as $node) {
                $nodes[$node->getName()] = $node;
            }
        }

        return $nodes;
    }
945129
public function ToString()
	{
		$sb = array();
		switch ( $this->TypeCode )
		{
			case XmlTypeCode::AnyAtomicType:
				$sb[] = "AnyAtomicType";
				break;

			case XmlTypeCode::UntypedAtomic:
				$sb[] = "UntypedAtomic";
				break;

			case XmlTypeCode::None:
				$sb[] = "empty-sequence()";
				break;

			case XmlTypeCode::Item:
				$sb[] = "item()";
				break;

			case XmlTypeCode::Node:
				$sb[] = "node()";
				break;

			case XmlTypeCode::Document:
				$sb[] = "document-node(";
				if ( is_null( $this->SchemaElement ) )
				{
					if ( ! $this->NameTest->IsWildcard() || is_null( $this->SchemaType ) )
					{
						$sb[] = "element(";
						$sb[] = $this->NameTest->ToString();
						if ( ! is_null( $this->SchemaType ) )
						{
							$sb[] = ",";
							$sb[] = get_class( $this->SchemaType );
							if ( $this->Nillable )
								$sb[] = "?";
						}
						else
						{
							$sb[] = ", xs:untyped";
						}
						$sb[] = ")";
					}
				}
				else
				{
					$sb[] = "schema-element(";
					$sb[] = $this->SchemaElement->QualifiedName->__toString();
					$sb[] = ")";
				}
				$sb[] = ")";
				break;

			case XmlTypeCode::Element:
				if ( is_null( $this->SchemaElement ) )
				{
					$sb[] = "element(";
					$sb[] = $this->NameTest->ToString();
					if ( ! is_null( $this->SchemaType ) )
					{
						$sb[] = ",";
						$sb[] = get_class( $this->SchemaType );
						if ( $this->Nillable )
						{
							$sb[] = "?";
						}
					}
					else
					{
						$sb[] = ", xs:untyped";
					}
				}
				else
				{
					$sb[] = "schema-element(";
					$sb[] = $this->SchemaElement->QualifiedName->__toString();
				}
				$sb[] = ")";
				break;

			case XmlTypeCode::Attribute:
				if ( is_null( $this->SchemaAttribute ) )
				{
					$sb[] = "attribute(";
					$sb[] = $this->NameTest->ToString();
					if ( ! is_null( $this->SchemaType ) )
					{
						$sb[] = ",";
						$sb[] = get_class( $this->SchemaType );
					}
				}
				else
				{
					$sb[] = "schema-attribute(";
					$sb[] = $this->SchemaAttribute->QualifiedName;
				}
				$sb[] = ")";
				break;

			case XmlTypeCode::ProcessingInstruction:
				$sb[] = "processing-instruction(";
				break;

			case XmlTypeCode::Comment:
				$sb[] = "comment()";
				break;

			case XmlTypeCode::Text:
				$sb[] = "text()";
				break;

			case XmlTypeCode::String:
				$sb[] = "xs:string";
				break;

			case XmlTypeCode::Boolean:
				$sb[] = "xs:boolean";
				break;

			case XmlTypeCode::Decimal:
				$sb[] = "xs:decimal";
				break;

			case XmlTypeCode::Float:
				$sb[] = "xs:float";
				break;

			case XmlTypeCode::Double:
				$sb[] = "xs:double";
				break;

			case XmlTypeCode::Duration:
				$sb[] = "xs:Duration";
				break;

			case XmlTypeCode::DateTime:
				$sb[] = "xs:dateTime";
				break;

			case XmlTypeCode::Time:
				$sb[] = "xs:time";
				break;

			case XmlTypeCode::Date:
				$sb[] = "xs:date";
				break;

			case XmlTypeCode::GYearMonth:
				$sb[] = "xs:gYearMonth";
				break;

			case XmlTypeCode::GYear:
				$sb[] = "xs:gYear";
				break;

			case XmlTypeCode::GMonthDay:
				$sb[] = "xs:gMonthDay";
				break;

			case XmlTypeCode::GDay:
				$sb[] = "xs:gDay";
				break;

			case XmlTypeCode::GMonth:
				$sb[] = "xs:gMonth";
				break;

			case XmlTypeCode::HexBinary:
				$sb[] = "xs:hexBinary";
				break;

			case XmlTypeCode::Base64Binary:
				$sb[] = "xs:base64Binary";
				break;

			case XmlTypeCode::AnyUri:
				$sb[] = "xs:anyURI";
				break;

			case XmlTypeCode::QName:
				$sb[] = "xs:QName";
				break;

			case XmlTypeCode::Notation:
				$sb[] = "xs:NOTATION";
				break;

			case XmlTypeCode::NormalizedString:
				$sb[] = "xs:normalizedString";
				break;

			case XmlTypeCode::Token:
				$sb[] = "xs:token";
				break;

			case XmlTypeCode::Language:
				$sb[] = "xs:language";
				break;

			case XmlTypeCode::NmToken:
				if ( $this->SchemaType == XmlSchema::$NMTOKENS )
					$sb[] = "xs:NMTOKENS";
				else
					$sb[] = "xs:NMTOKEN";
				break;

			case XmlTypeCode::Name:
				$sb[] = "xs:Name";
				break;

			case XmlTypeCode::NCName:
				$sb[] = "xs:NCName";
				break;

			case XmlTypeCode::Id:
				$sb[] = "xs:ID";
				break;

			case XmlTypeCode::Idref:
				if ( $this->SchemaType == XmlSchema::$IDREFS )
					$sb[] = "xs:IDREFS";
				else
					$sb[] = "xs:IDREF";
				break;

			case XmlTypeCode::Entity:
				if ( $this->SchemaType == XmlSchema::$ENTITIES )
					$sb[] = "xs:ENTITYS";
				else
					$sb[] = "xs:ENTITY";
				break;

			case XmlTypeCode::Integer:
				$sb[] = "xs:integer";
				break;

			case XmlTypeCode::NonPositiveInteger:
				$sb[] = "xs:nonPositiveInteger";
				break;

			case XmlTypeCode::NegativeInteger:
				$sb[] = "xs:negativeInteger";
				break;

			case XmlTypeCode::Long:
				$sb[] = "xs:long";
				break;

			case XmlTypeCode::Int:
				$sb[] = "xs:int";
				break;

			case XmlTypeCode::Short:
				$sb[] = "xs:short";
				break;

			case XmlTypeCode::Byte:
				$sb[] = "xs:byte";
				break;

			case XmlTypeCode::NonNegativeInteger:
				$sb[] = "xs:nonNegativeInteger";
				break;

			case XmlTypeCode::UnsignedLong:
				$sb[] = "xs:unsignedLong";
				break;

			case XmlTypeCode::UnsignedInt:
				$sb[] = "xs:unsignedInt";
				break;

			case XmlTypeCode::UnsignedShort:
				$sb[] = "xs:unsignedShort";
				break;

			case XmlTypeCode::UnsignedByte:
				$sb[] = "xs:unsignedByte";
				break;

			case XmlTypeCode::PositiveInteger:
				$sb[] = "xs:positiveInteger";
				break;

			case XmlTypeCode::DayTimeDuration:
				$sb[] = "xs:dayTimeDuration";
				break;

			case XmlTypeCode::YearMonthDuration:
				$sb[] = "xs:yearMonthDuration";
				break;

			default:
				$sb[] = "[]";
				break;
		}

		switch ( $this->Cardinality )
		{
			case XmlTypeCardinality::OneOrMore:
				$sb[] = "+";
				break;

			case XmlTypeCardinality::ZeroOrMore:
				$sb[] = "*";
				break;

			case XmlTypeCardinality::ZeroOrOne:
				$sb[] = "?";
				break;
		}

		return implode( "", $sb );
	}
48914
public function getBranches()
    {
        $branches = array();

        $xml = $this->execute('branch');

        foreach ($xml->branch as $xmlBranch) {
            $branch = new BranchSummary;
            $branch->setName(self::normalise($xmlBranch->name, 'string'));
            $branch->setFirmId(self::normalise($xmlBranch->firmid, 'int'));
            $branch->setBranchId(self::normalise($xmlBranch->branchid, 'int'));
            $branch->setUrl(self::normalise($xmlBranch->url, 'string'));
            $branches[] = $branch;
        }

        return $branches;
    }
172253
public function flattenCases(): array
    {
        $dict = [];
        foreach ($this->getCases() as $case) {
            if (!isset($dict[$case->file])) {
                $dict[$case->file] = new TestSuite($case->class, 0, 0, 0, 0, 0, 0);
            }
            $dict[$case->file]->cases[] = $case;
            ++$dict[$case->file]->tests;
            $dict[$case->file]->assertions += $case->assertions;
            $dict[$case->file]->failures += \count($case->failures);
            $dict[$case->file]->errors += \count($case->errors);
            $dict[$case->file]->skipped += \count($case->skipped);
            $dict[$case->file]->time += $case->time;
            $dict[$case->file]->file = $case->file;
        }

        return array_values($dict);
    }
117565
protected function getTreeNodeCustomisations()
    {
        $rootTitle = $this->getCMSTreeTitle();
        return function (SiteTree $node) use ($rootTitle) {
            return [
                'listViewLink' => $this->LinkListViewChildren($node->ID),
                'rootTitle' => $rootTitle,
                'extraClass' => $this->getTreeNodeClasses($node),
                'Title' => _t(
                    self::class . '.PAGETYPE_TITLE',
                    '(Page type: {type}) {title}',
                    [
                        'type' => $node->i18n_singular_name(),
                        'title' => $node->Title,
                    ]
                )
            ];
        };
    }
375101
private function getAbstracts()
    {
        $r = '';

        // Inside abstracts
        foreach ($this->modules as $module) {
            $abstracts = (array)$this->xml->xpath('/draggy/module[@name=\'' . $module . '\']/abstract');

            foreach ($abstracts as $abstract) {
                $abstractAttributes = (array)$abstract;
                $abstractAttributes = $abstractAttributes['@attributes'];

                $this->checkMandatoryAttributes('Abstract in module ' . $module, $abstractAttributes, ['name']);

                $abstractName = $abstractAttributes['name'];

                $this->insideAbstracts[$module][] = $abstractName;

                $this->checkMandatoryAttributes(
                    'Abstract ' . $abstractName . ' in module ' . $module,
                    $abstractAttributes,
                    ['left', 'top']
                );

                $r .= 'var s = new Abstract(\'' . $abstractName . '\',\'' . str_replace(
                    '\\',
                    '\\\\',
                    $module
                ) . '\');' . PHP_EOL;
                $r .= 's.moveTo(\'' . ( $abstractAttributes['left'] /*- 1*/ ) . 'px\',\'' . ( $abstractAttributes['top'] /*- 1*/ ) . 'px\');' . PHP_EOL;

                $r .= $this->getClassLikeProperties($abstractAttributes, 's');

                $r .= 's.setModule(Container.prototype.getContainerByName(\'' . str_replace(
                    '\\',
                    '\\\\',
                    $module
                ) . '\').getId());' . PHP_EOL;
            }
        }

        // Outside abstracts
        $abstracts = (array)$this->xml->xpath('/draggy/loose/abstract');

        foreach ($abstracts as $abstract) {
            $abstractAttributes = (array)$abstract;
            $abstractAttributes = $abstractAttributes['@attributes'];

            $this->checkMandatoryAttributes('Loose abstract', $abstractAttributes, ['name']);

            $abstractName = $abstractAttributes['name'];

            $this->outsideAbstracts[] = $abstractName;

            $this->checkMandatoryAttributes('Loose abstract ' . $abstractName, $abstractAttributes, ['left', 'top']);

            $r .= 'var s = new Abstract(\'' . $abstractName . '\');' . PHP_EOL;
            $r .= 's.moveTo(\'' . ( $abstractAttributes['left'] ) . 'px\',\'' . ( $abstractAttributes['top'] ) . 'px\');' . PHP_EOL;

            $r .= $this->getClassLikeProperties($abstractAttributes, 's');
        }

        return $r;
    }
141687
public function getRootFormat()
    {
        $result = [];
        $roots  = $this->getRoot();
        foreach ($roots as $key => $node) {

            $v = $node->formatNode();

            $result = array_merge($result, $v);
        }
        return $result;
    }
557094
public function getRootNodes()
	{
		$filter = new DoctrineSearchCondition();
		$filter->levelEqualsTo(0);
		
		$order = new DoctrineSelectOrder();
		$order->byLeftAscending();
		
		$rootNodes = $this->nestedSetRepository->search($filter, $order);
		
		return $rootNodes;
	}
1331818
public function get_children() {
        if (!$this->lf->is_directory()) {
            return array();
        }

        $result = array();
        $fs = get_file_storage();

        $storedfiles = $fs->get_directory_files($this->context->id, $this->lf->get_component(), $this->lf->get_filearea(), $this->lf->get_itemid(),
                                                $this->lf->get_filepath(), false, true, "filepath, filename");
        foreach ($storedfiles as $file) {
            $result[] = new file_info_stored($this->browser, $this->context, $file, $this->urlbase, $this->topvisiblename,
                                             $this->itemidused, $this->readaccess, $this->writeaccess, false);
        }

        return $result;
    }
1286433
public function getSiblings() {
        $parent = $this->getParent();
        if (is_null($parent)) {
            // This is the root node.
            return [];
        }

        $children = $parent->getChildren();
        $index = array_search($this, $children);
        unset($children[$index]);
        return $children;
    }
874853
public function extractLinks()
    {
        if ($this->extractedLinks) {
            return $this->extractedLinks;
        }

        if (!is_html($this->body)) {
            return [];
        }

        $libxmlPreviousState = libxml_use_internal_errors(true);

        $dom = new DOMDocument;
        $dom->loadHTML($this->body);

        libxml_clear_errors();
        libxml_use_internal_errors($libxmlPreviousState);

        $links = [];

        foreach ($this->tags as $tag => $attribute) {
            foreach ($dom->getElementsByTagName($tag) as $element) {
                $link = $element->getAttribute($attribute);

                if (!$link) {
                    continue;
                }

                $links[] = clean_url(url_to_absolute($this->url, $link), true, true);
            }
        }

        return $this->extractedLinks = array_unique($links);
    }
917575
public function getNodes($content)
    {
        $items = array();
        $document = $this->createDocumentFromXML($content);
        $nodes = $document->getElementsByTagName('item');
        if ($nodes->length) {
            foreach ($nodes as $node) {
                try {
                    $item = $this->create($node);
                    $items[] = $item;
                } catch (\Exception $e) {
                    throw new RuntimeException($e->getMessage());
                }
            }
        }

        return $items;
    }