For a given format node returns the options for it.

@param \DOMNode $formatNode

@return array
348789
private function getOptionsFromFormatNode(\DOMNode $formatNode)
    {
        $optionsNode = $this->xpath->query('x:options', $formatNode)->item(0);

        return $this->getParametersFromNode($optionsNode, 'option');
    }
627065
protected function formatScopes($unformatted = [])
    {
        if (is_null($unformatted)) {
            return [];
        }

        $scopes = [];
        foreach ($unformatted as $scope) {
            if ($scope instanceof ScopeEntity) {
                $scopes[$scope->getId()] = $scope;
            }
        }

        return $scopes;
    }
964114
protected function getReturn(\DOMNode $node)
    {
        $crawler = new Crawler($node);
        $type = $crawler->attr('type');
        $description = $this->getInner($node);

        return array($type, $description);

    }
682205
protected function parseValues(\SimpleXMLElement $node)
    {
        $values = [];

        foreach ($node->value as $item) {
            if ($item->count() > 0) {
                $value = $this->parseValues($item);
            } else {
                $value = trim($item);
            }

            if (isset($item['key'])) {
                $values[(string) $item['key']] = $value;
            } else {
                $values[] = $value;
            }
        }

        return $values;
    }
106048
private function resolveArgumentsFromMethodCall(Return_ $returnNode): array
    {
        $arguments = [];
        if ($returnNode->expr instanceof MethodCall) {
            foreach ($returnNode->expr->args as $arg) {
                if ($arg->value instanceof Array_) {
                    $arguments[] = $arg->value;
                }
            }
        }

        return $arguments;
    }
739564
public static function get_ancestors( \DOMNode $node ) {
		$result = [];

		while ( ( $node = $node->parentNode ) && ( $node instanceof \DOMElement ) ) { // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
			$result[] = $node;
		}

		return $result;
	}
1058986
public function groupOptions() {
        return array_map(function ($node) {
            return [$node->getAttribute("value"),
                $this->readOptions($this->xpath->query("./option", $node))];
        }, iterator_to_array($this->xpath->query("./optgroup", $this->domNode)));
    }
284290
private function parseTypeConfig(\DOMXPath $xpath, \DOMNode $typeRootNode)
    {
        $staticFields  = $this->parseMappingFields($xpath, $typeRootNode);
        $idFieldName   = $typeRootNode->getAttribute('idFieldName');
        $datasources   = $this->parseDatasources($xpath, $typeRootNode);

        $mappingParams = ['staticFields' => $staticFields];

        return ['mapping' => $mappingParams, 'idFieldName' => $idFieldName, 'datasources' => $datasources];
    }
1256893
public function getOptions()
    {
        $options = [];
        foreach ($this->childNodes as $child) {
            if ($child instanceof Select\Option) {
                $options[] = $child;
            } else if ($child instanceof Select\Optgroup) {
                foreach ($child->getChildren() as $c) {
                    if ($c instanceof Select\Option) {
                        $options[] = $c;
                    }
                }
            }
        }
        return $options;
    }
1157593
protected function getCurrentDimensionPresetIdentifiersForNode($node)
    {
        $targetPresets = $this->contentDimensionsPresetSource->findPresetsByTargetValues($node->getDimensions());
        $presetCombo = [];
        foreach ($targetPresets as $dimensionName => $presetConfig) {
            $fullPresetConfig = $this->contentDimensionsPresetSource->findPresetByDimensionValues($dimensionName, $presetConfig['values']);
            $presetCombo[$dimensionName] = $fullPresetConfig['identifier'];
        }
        return $presetCombo;
    }
1361310
private function loadParam(\DOMXPath $xpath, \DOMNode $node)
    {
        $result = [
            'name' => $this->getValueFromXPath('@name', $xpath, $node),
            'type' => $this->getValueFromXPath('@type', $xpath, $node, 'string'),
            'meta' => $this->loadMeta($xpath, $node),
        ];

        switch ($result['type']) {
            case 'collection':
                $result['value'] = $this->loadParams('x:param', $xpath, $node);
                break;
            default:
                $result['value'] = $this->getValueFromXPath('@value', $xpath, $node);
                break;
        }

        return $result;
    }
788846
public function getByReferenceCallArguments($callNode)
    {
        $byReferenceArguments = $callNode->args;
        if (!$this->calleeReflector->supports($callNode)) {
            return $byReferenceArguments;
        }

        $reflection = $this->calleeReflector->reflect($callNode);
        $byReferenceParameterPositions = array_flip($reflection->getByReferenceParameterPositions());
        $byReferenceArguments = array_intersect_key($byReferenceArguments, $byReferenceParameterPositions);

        return $byReferenceArguments;
    }
868248
protected function getFormatOptionsFromPost()
    {
        $presetMode = post('format_preset');

        $options = [
            'delimiter' => null,
            'enclosure' => null,
            'escape' => null,
            'encoding' => null
        ];

        if ($presetMode == 'custom') {
            $options['delimiter'] = post('format_delimiter');
            $options['enclosure'] = post('format_enclosure');
            $options['escape'] = post('format_escape');
            $options['encoding'] = post('format_encoding');
        }

        return $options;
    }
1156704
protected function convertNode(\DOMNode $node, $path = '')
    {
        $output = [];
        if ($node->nodeType == XML_ELEMENT_NODE) {
            $nodeName = $this->parseNodeName($node);
            $output[$nodeName] = $this->parseNodeData($node, $path);
        } elseif ($node->nodeType == XML_CDATA_SECTION_NODE
            || $node->nodeType == XML_TEXT_NODE && trim($node->nodeValue) != '') {
            return $node->nodeValue;
        }

        return $output;
    }
604317
protected function getOptions()
	{
		$options = array();

		/** @var \SimpleXMLElement $option */
		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			$text = $this->translateOptions
				? $this->getText()->alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))
				: trim((string) $option);

			// Set up option elements.
			$tmp = new stdClass;
			$tmp->value = (string) $option['value'];
			$tmp->text = $text;
			$tmp->disable = ((string) $option['disabled'] == 'true');
			$tmp->class = (string) $option['class'];
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		reset($options);

		return $options;
	}
854957
protected function getOptions()
	{
		$options = array();

		$select = new HtmlSelect;

		// Try to inject the text object into the field
		try
		{
			$select->setText($this->getText());
		}
		catch (\RuntimeException $exception)
		{
			// A Text object was not set, ignore the error and try to continue processing
		}

		/** @var \SimpleXMLElement $option */
		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			// Create a new option object based on the <option /> element.
			$tmp = $select->option(
				(string) $option['value'], trim((string) $option), 'value', 'text', ((string) $option['disabled'] == 'true')
			);

			// Set some option attributes.
			$tmp->class = (string) $option['class'];

			// Set some JavaScript option attributes.
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		reset($options);

		return $options;
	}
951390
private function parseXml($file)
    {
        $formats = [];

        // load xml file
        $xmlDoc = $this->tryLoad($file);

        $this->xpath = new \DOMXPath($xmlDoc);
        $this->xpath->registerNamespace('x', static::XML_NAMESPACE_URI);

        foreach ($this->xpath->query('/x:formats/x:format') as $formatNode) {
            $this->addFormatFromFormatNode($formatNode, $formats);
        }

        return $formats;
    }