On Sat, 9 May 2009, Hans-Christian Otto wrote:

> I just found a regexp in MvcTools that is senseless from my point of 
> view. In ezcMvcController::createActionMethodName you do
> 
>       $actionMethod = 'do' . preg_replace( '@[^A-Za-z]@', '',  
> preg_replace( '@[a-za-...@e', 'ucfirst( "\\0" )', $action ) );
> 
> to transform an action like foo_bar to a method name like "doFooBar". 
> Wouldn't "dofoobar" be enough?
> 
> Using
> 
>       $actionMethod = 'do' . preg_replace( '@[^A-Za-z]@', '',  $action );
> 
> should result in the same method.
> 
> So, why do you still use camelcase here?

You're right that the code would work fine. However, if we use camel 
case, the method names also show up nicely in error message and stack 
traces, making debugging easier.

regards,
-- 
Derick Rethans
eZ components Product Manager
eZ systems | http://ez.no
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to