Tobias Schlitt | 3 May 2006 23:34
Picon
Favicon

Re: 1.1 enhancement: Option access

Hi Derick Rethans!
On 05/03/06 10:29 you wrote:

>>> I am not sure if we should support both syntaxes. I don't like the
>>> idea that you can do the same thing in two different ways. I would
>>> prefer to only support the first case.

>> The problem here is, that we have to convert the object to an array then
>> manually when getOptions() is used and back when setOptions() is used,
>> which we need to keep for BC reasons. The shown implementation allows us
>> to simple return the object. I think in this special case it does not
>> hurt to support both syntaxes. We can simply not document the array
>> access method, if you want.

> Ok, forgot about the current array passing for setOptions().

Yeah, it's still a bit ugly with the new implementation, since you have
to do something like

public function setOptions( $options )
{
    if ( is_array( $options ) )
    {
        $this->options = new ezcFooBarOptions( $options );
    }
    else if ( $options instanceof ezcBaseOptions )
    {
        $this->options = $options;
    }
    else
    {
        throw new ...;
    }
}

(asuming that we won't do assignement to $this i the ezcBaseOptions
constructore).

But it's still better than always converting forth and back.

Regards,
Toby
--

-- 
Mit freundlichen Gruessen / Med vennlig hilsen
Tobias Schlitt

system developer / utvikler / entwickler
eZ systems GmbH
Emil-Figge-Str. 76-80
44227 Dortmund
Germany

ts@... | eZ systems | ez.no


Gmane