src/Encoder/ObjectEncoder.php
private function encodeObject($object, array $options, callable $encode)
    {
        if ($options['object.format'] === 'string') {
            return $encode((string) $object);
        } elseif ($options['object.format'] === 'serialize') {
            return sprintf('unserialize(%s)', $encode(serialize($object)));
        } elseif ($options['object.format'] === 'export') {
            return sprintf('\\%s::__set_state(%s)', \get_class($object), $encode($this->getObjectState($object)));
        }

        return $this->encodeObjectArray($object, $options, $encode);
    }
private function encodeObject($object, array $options, callable $encode)
    {
        if ($options['object.format'] === 'string') {
            return $encode((string) $object);
        } elseif ($options['object.format'] === 'serialize') {
            return sprintf('unserialize(%s)', $encode(serialize($object)));
        } elseif ($options['object.format'] === 'export') {
            return sprintf('\\%s::__set_state(%s)', \get_class($object), $encode($this->getObjectState($object)));
        }

        return $this->encodeObjectArray($object, $options, $encode);
    }
private function encodeObject ( $ object , array $ options , callable $ encode ) { if ( $ options [ 'object.format' ] === 'string' ) { return $ encode ( ( string ) $ object ) ; } elseif ( $ options [ 'object.format' ] === 'serialize' ) { return sprintf ( 'unserialize(%s)' , $ encode ( serialize ( $ object ) ) ) ; } elseif ( $ options [ 'object.format' ] === 'export' ) { return sprintf ( '\\%s::__set_state(%s)' , \ get_class ( $ object ) , $ encode ( $ this -> getObjectState ( $ object ) ) ) ; } return $ this -> encodeObjectArray ( $ object , $ options , $ encode ) ; }
Encodes the object as string according to encoding options.
@param object $object Object to encode as PHP
@param array $options List of encoder options
@param callable $encode Callback used to encode values
@return string The object encoded as string
Encodes the object as string according to encoding options .