public function hydrate($value)
    {
        if ($value instanceof MongoId) {
            return (string)$value;
        }
        
        if ($this->nullable && $value === null) {
            return null;
        }
        
        throw new Exception\InvalidArgumentException(sprintf(
            'Invalid value: must be an instance of MongoId, "%s" given.',
            is_object($value) ? get_class($value) : gettype($value)
        ));
    }
public function hydrate($value)
    {
        if ($value instanceof MongoId) {
            return (string)$value;
        }
        
        if ($this->nullable && $value === null) {
            return null;
        }
        
        throw new Exception\InvalidArgumentException(sprintf(
            'Invalid value: must be an instance of MongoId, "%s" given.',
            is_object($value) ? get_class($value) : gettype($value)
        ));
    }
public function hydrate ( $ value ) { if ( $ value instanceof MongoId ) { return ( string ) $ value ; } if ( $ this -> nullable && $ value === null ) { return null ; } throw new Exception \ InvalidArgumentException ( sprintf ( 'Invalid value: must be an instance of MongoId, "%s" given.' , is_object ( $ value ) ? get_class ( $ value ) : gettype ( $ value ) ) ) ; }
Ensure the value extracted is typed as string or null

@param mixed $value The original value.
@return null|string Returns the value that should be hydrated.
Ensure the value extracted is typed as string or null