public function mapValueObject(string $elementName, string $className)
    {
        list($namespace) = self::parseClarkNotation($elementName);

        $this->elementMap[$elementName] = function (Reader $reader) use ($className, $namespace) {
            return \Sabre\Xml\Deserializer\valueObject($reader, $className, $namespace);
        };
        $this->classMap[$className] = function (Writer $writer, $valueObject) use ($namespace) {
            return \Sabre\Xml\Serializer\valueObject($writer, $valueObject, $namespace);
        };
        $this->valueObjectMap[$className] = $elementName;
    }
public function mapValueObject(string $elementName, string $className)
    {
        list($namespace) = self::parseClarkNotation($elementName);

        $this->elementMap[$elementName] = function (Reader $reader) use ($className, $namespace) {
            return \Sabre\Xml\Deserializer\valueObject($reader, $className, $namespace);
        };
        $this->classMap[$className] = function (Writer $writer, $valueObject) use ($namespace) {
            return \Sabre\Xml\Serializer\valueObject($writer, $valueObject, $namespace);
        };
        $this->valueObjectMap[$className] = $elementName;
    }
public function mapValueObject ( string $ elementName , string $ className ) { list ( $ namespace ) = self :: parseClarkNotation ( $ elementName ) ; $ this -> elementMap [ $ elementName ] = function ( Reader $ reader ) use ( $ className , $ namespace ) { return \ Sabre \ Xml \ Deserializer \ valueObject ( $ reader , $ className , $ namespace ) ; } ; $ this -> classMap [ $ className ] = function ( Writer $ writer , $ valueObject ) use ( $ namespace ) { return \ Sabre \ Xml \ Serializer \ valueObject ( $ writer , $ valueObject , $ namespace ) ; } ; $ this -> valueObjectMap [ $ className ] = $ elementName ; }
Map an xml element to a PHP class.

Calling this function will automatically setup the Reader and Writer
classes to turn a specific XML element to a PHP class.

For example, given a class such as :

class Author {
public $firstName;
public $lastName;
}

and an XML element such as:

<author xmlns="http://example.org/ns">
<firstName>...</firstName>
<lastName>...</lastName>
</author>

These can easily be mapped by calling:

$service->mapValueObject('{http://example.org}author', 'Author');
Map an xml element to a PHP class .