Austinb/GameQ — pull request #78 by Blackskyliner (2013-01-15 18:07:20+00:00)
Title: [UNTESTED] Added custom Protocol normalizer

I thought about the Issue #61 and how we can decouple the additional
filters for our protocol so we have a more detached manner of
normalisation. This branch is a suggestion how we could add some
pluggable mechanism to this. We use the current unused parameters of the
normalise filter. We just insert a array with some values which protocol
specific normalisation should be done. I think this is - somehow - a
clean way to do this but I thought if it is not the same we already have
with the filters, but for this case in a more categorized way. (we could
in fact implement each of those normalizer as own filters, but then copy
some logic from the current/default normalise filter.

I also thought about having pluggable generic normalizer which could be
pluggable, but I don't know if there is any use-case for that. We would
then to have some key/value pair of params to normalize which
normalizers we want to load/apply on our data.

I also changed the way I modify the data from #61, as we now use a copy
and return the changed array after that. This is a bit slower as some
copying has to be made and we could easily adapt that to by-reference
but I would suggest to only do that if we discussed about that
beforehand.

Hopefully this is some kind of the way you thought about doing the whole
thing. We could now add generic normalizer for each protocol which could
filter the settings we have inside the Protocol::$normazie at the moment.

Those generic protocol normalizer could be used through naming by
convention and thus having like 'GameQ_Filters_Normalizer_Ts3', whereas
Ts3 is the ucfirst of the name of the given protocol so we will not have
to specify the generic normalisation (which we do through $normalize
'overload/overwrite' atm).

Some thoughts about all of this? Did I messed up your idea or did I hit
some good spot with this implementation? (As sperating of the whole
normalisation from the protocol is now possible)