ApiPlatform\Core\Metadata\Extractor\XmlExtractor::getAttributes PHP Метод

getAttributes() приватный метод

Recursively transforms an attribute structure into an associative array.
private getAttributes ( SimpleXMLElement $resource, string $elementName ) : array
$resource SimpleXMLElement
$elementName string
Результат array
    private function getAttributes(\SimpleXMLElement $resource, string $elementName) : array
    {
        $attributes = [];
        foreach ($resource->{$elementName} as $attribute) {
            if (isset($attribute->attribute[0])) {
                $value = $this->getAttributes($attribute, 'attribute');
            } else {
                $value = XmlUtils::phpize($attribute);
            }
            if (isset($attribute['name'])) {
                $attributes[(string) $attribute['name']] = $value;
            } else {
                $attributes[] = $value;
            }
        }
        return $attributes;
    }