ZF-11443: Zend_Controller_Router_Route_Chain does not implement getDefault and getDefaults

Description

Zend_Controller_Router_Route_Chain does not implement getDefault and getDefaults. All other shipped Route implementations provide this, and I see no reason for not providing these on Chain as well.

Note: getDefault and getDefaults are not required by Zend_Controller_Router_Route_Interface.

Comments

There are two mistakes in your code: * Coding style: "As with classes, the brace should always be written on the line underneath the function name." ("getDefault" and "getDefaults") * In the method "getDefault" the variable "$default" is undefined

You are right about the potentially undefined variable, thanks. The style is also wrong in the other Route implementations, that is where I copy-pasted the line from.

At first I implemented the function to return the default from the least specific (first added/first matching) route. I changed that to most specific at the last moment (to match the behaviour of the Chain), hence the missing $default definition.

The documentation notes the parameter priority as 'the outer route has the higher priority'. I'm not sure how to interpret that in combination with the actual behaviour, maybe it is an documentation error.

Fix and unit test from Môshe tested and added.

@[~môshevds]: You will need to sign and submit a CLA before we can apply your suggested improvement. See here: http://framework.zend.com/wiki/display/…

Can we add the patch to version 1.12?

Fixed on trunk (25248) and release-1.12 (25249)

(I deleted the patches from Môshe and written a new implementation.)