/** * Wrapper setting the format to all listeners implementing the * ResponseMutatorInterface * @param string **/ public function setResponseFormat($format = ResponseMutatorInterface::JSON) { foreach ($this->app->getEventsManager()->getListeners('micro:afterHandleRoute') as $listener) { if ($listener instanceof ResponseMutatorInterface) { $listener->setResponseFormat($format); } } return true; }