Neos\ContentRepository\Domain\Service\ImportExport\NodeImportService::parsePropertiesElement PHP Метод

parsePropertiesElement() защищенный Метод

Parses the content of the properties-tag and returns the properties as an array 'property name' => property value
protected parsePropertiesElement ( XMLReader $reader, string $currentNodeIdentifier ) : array
$reader XMLReader reader positioned just after an opening properties-tag
$currentNodeIdentifier string
Результат array the properties
    protected function parsePropertiesElement(\XMLReader $reader, $currentNodeIdentifier)
    {
        $properties = array();
        $currentProperty = null;
        $currentType = null;
        $currentEncoding = null;
        $currentClassName = null;
        $currentIdentifier = null;
        while ($reader->read()) {
            switch ($reader->nodeType) {
                case \XMLReader::ELEMENT:
                    $currentProperty = $reader->name;
                    $currentType = $reader->getAttribute('__type');
                    $currentIdentifier = $reader->getAttribute('__identifier');
                    $currentClassName = $reader->getAttribute('__classname');
                    $currentEncoding = $reader->getAttribute('__encoding');
                    if ($reader->isEmptyElement) {
                        switch ($currentType) {
                            case 'array':
                                $properties[$currentProperty] = array();
                                break;
                            case 'string':
                                $properties[$currentProperty] = '';
                                break;
                            default:
                                $properties[$currentProperty] = null;
                        }
                        $currentType = null;
                    }
                    // __type="object" __identifier="uuid goes here" __classname="Neos\Media\Domain\Model\ImageVariant" __encoding="json"
                    if ($currentType === 'array') {
                        $value = $this->parseArrayElements($reader, $currentProperty, $currentNodeIdentifier);
                        $properties[$currentProperty] = $value;
                    }
                    break;
                case \XMLReader::END_ELEMENT:
                    if ($reader->name === 'properties') {
                        return $properties;
                    }
                    break;
                case \XMLReader::CDATA:
                case \XMLReader::TEXT:
                    $properties[$currentProperty] = $this->convertElementToValue($reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $currentProperty);
                    break;
            }
        }
        return $properties;
    }