Hi Marco,

Thanks for your response. Good to know that the final handler is the right
way to go.

I'm not clear on why inheritance would be an invalid solution in this case
though. Isn't it specifically intended for extending the functionality of a
class in a scenario like this (where one class is a definite subtype of
another and you want to reuse some of the parent classes' functionality)?
Alternatively composition via an error handler interface in place of the
handleErrors() method could be used. Both would provide more flexibility
than locking down the whole class with private methods.

Cheers,
- James


On 21 January 2016 at 11:37, Marco Pivetta <[email protected]> wrote:

> Heya,
>
>
> On 21 January 2016 at 11:28, James Abbott <[email protected]> wrote:
>
>> I was just wondering why the existing Zend\Stratigility\FinalHandler has
>> so
>> many of its methods declared private though? It seems to me that extending
>> its behaviour is a valid use case and works well as a means to customise
>> error handling. But looking at the method signatures you wouldn't think it
>> was encouraged.
>>
>
> Inheritance is not the right way to add "your own flavor" to an existing
> behavior. The final handler is just a `function ($request, $response,
> $error = null);` callable: implementing your own is the way to go ;-)
>
> Cheers,
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>
>
>

Reply via email to