getLocaleCodeFromElement example

$cardDefinitions[$index]['flag'] = $this->getCardFlag($element);
            }
        }

        return $cardDefinitions;
    }

    private function getCardTitles(\DOMElement $element): array
    {
        $titles = [];
        foreach ($element->getElementsByTagName('title') as $title) {
            $titles[$this->getLocaleCodeFromElement($title)] = $title->nodeValue;
        }

        return $titles;
    }

    private function getElements(\DOMElement $xml): array
    {
        $elements = [];
        $count = 0;
        /** @var \DOMElement $element */
        foreach (static::getAllChildren($xml) as $element) {
            

    protected static function mapTranslatedTag(\DOMElement $child, array $values): array
    {
        if (!\array_key_exists(self::kebabCaseToCamelCase($child->tagName)$values)) {
            $values[self::kebabCaseToCamelCase($child->tagName)] = [];
        }

        // psalm would fail if it can't infer type from nested array         /** @var array<string, string> $tagValues */
        $tagValues = $values[self::kebabCaseToCamelCase($child->tagName)];
        $tagValues[self::getLocaleCodeFromElement($child)] = trim($child->nodeValue ?? '');
        $values[self::kebabCaseToCamelCase($child->tagName)] = $tagValues;

        return $values;
    }

    /** * @param callable(\DOMElement): (XmlElement|string) $transformer * * @return array<mixed> */
    protected static function parseChildNodes(\DOMElement $child, callable $transformer): array
    {
Home | Imprint | This part of the site doesn't use cookies.