Yeah, I tried to come up with something else - Codec was one - but really,
gzip, crypt, etc are special cases of encoding.  I don't know, if anyone can
come up with a good alternative I'm open to ideas there.

On Mon, Apr 5, 2010 at 5:27 PM, Hector Virgen <djvir...@gmail.com> wrote:

> This sounds like a really good idea! But I'm not too sure about the
> namespace "Encode". Do you think there might be more opportunities for
> two-way transformation besides just encoding? I'm thinking gzip/deflate,
> encrypt/decrypt, etc.
>
> --
> Hector
>
>
> On Fri, Apr 2, 2010 at 2:17 PM, OnyxRaven <onyxra...@gmail.com> wrote:
>
>>
>> I've been doing some work with some of the symmetric Filters - especially
>> encryption and urlencoding.  What I've come up with is a more 'formal'
>> class
>> which encompasses and encoder and a decoder.
>>
>> The idea is that the same Zend_Encoder based class should be just an
>> identity to the value passed in.
>>
>> (given scalar $x, $params to Crypt;)
>> $enc = new Zend_Encoder_Crypt($params);
>> $y1 = $enc->encode($x);
>> $y2 = $enc->decode($y1);
>> assert($x === $y);
>>
>> An Encoder could easily be just a composition of Filter objects.
>>
>> Encoder chaining would run encode() in the order specified in the chain,
>> but
>> decode() would run in reverse order.
>>
>> $enc->addEncoder(Zend_Encoder_Base64)
>> $enc->addEncoder(Zend_Encoder_UrlEncode);
>> $enc->encode(); // runs Base64->encode(); UrlEncode->encode();
>> $enc->decode(); // runs UrlEncode->decode(); Base64->decode();
>>
>> Is this a valuable class?  If so, I'll happily put together the proposal
>> and
>> start up some basic implementations.
>> --
>> View this message in context:
>> http://n4.nabble.com/idea-Zend-Encoder-tp1749646p1749646.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>
>

Reply via email to