src/Metadata/Extractor/XmlExtractor.php
private function getAttributes(\SimpleXMLElement $resource, string $elementName, bool $topLevel = false): array
    {
        $attributes = [];
        foreach ($resource->{$elementName} as $attribute) {
            $value = isset($attribute->attribute[0]) ? $this->getAttributes($attribute, 'attribute') : XmlUtils::phpize($attribute);
            // allow empty operations definition, like <collectionOperation name="post" />
            if ($topLevel && '' === $value) {
                $value = [];
            }
            if (isset($attribute['name'])) {
                $attributes[(string) $attribute['name']] = $value;
            } else {
                $attributes[] = $value;
            }
        }

        return $attributes;
    }
private function getAttributes(\SimpleXMLElement $resource, string $elementName, bool $topLevel = false): array
    {
        $attributes = [];
        foreach ($resource->{$elementName} as $attribute) {
            $value = isset($attribute->attribute[0]) ? $this->getAttributes($attribute, 'attribute') : XmlUtils::phpize($attribute);
            // allow empty operations definition, like <collectionOperation name="post" />
            if ($topLevel && '' === $value) {
                $value = [];
            }
            if (isset($attribute['name'])) {
                $attributes[(string) $attribute['name']] = $value;
            } else {
                $attributes[] = $value;
            }
        }

        return $attributes;
    }
private function getAttributes ( \ SimpleXMLElement $ resource , string $ elementName , bool $ topLevel = false ) : array { $ attributes = [ ] ; foreach ( $ resource -> { $ elementName } as $ attribute ) { $ value = isset ( $ attribute -> attribute [ 0 ] ) ? $ this -> getAttributes ( $ attribute , 'attribute' ) : XmlUtils :: phpize ( $ attribute ) ; // allow empty operations definition, like <collectionOperation name="post" /> if ( $ topLevel && '' === $ value ) { $ value = [ ] ; } if ( isset ( $ attribute [ 'name' ] ) ) { $ attributes [ ( string ) $ attribute [ 'name' ] ] = $ value ; } else { $ attributes [ ] = $ value ; } } return $ attributes ; }
Recursively transforms an attribute structure into an associative array.
Recursively transforms an attribute structure into an associative array .