This is unreadable. We need to break it into two conditions. I think the !$response condition can be removed, as if it is null, the $response instanceof Resposne will evaluate to false anyway. Something like that : https://gist.github.com/bakura10/9b0e4079a58c4c1dc887

(is the $e->getParam('exception') needed actually ?