getErrorHandler() public method

public getErrorHandler ( ) : League\BooBoo\Runner
return League\BooBoo\Runner
Example #1
0
 /**
  * @return void
  */
 protected function setErrorHandler()
 {
     $app = $this;
     $this->configuration->getLogHandler()->setLogger($this->serviceLogger());
     $this->configuration->getErrorHandler()->pushHandler($this->configuration->getLogHandler());
     $this->configuration->getErrorHandler()->register();
     $this->setExceptionDecorator(function (\Exception $e) use($app) {
         $formatter = new ErrorHandler\Formatter\JsonXml($app->configuration);
         return new Response($formatter->format($e), http_response_code());
     });
 }
Example #2
0
 public function testGetters()
 {
     $config = new Config('phprest', 1, true);
     $this->assertEquals('phprest', $config->getVendor());
     $this->assertEquals(1, $config->getApiVersion());
     $this->assertEquals(true, $config->isDebug());
     $this->assertInstanceOf('\\League\\Container\\Container', $config->getContainer());
     $this->assertInstanceOf('\\League\\Route\\RouteCollection', $config->getRouter());
     $this->assertInstanceOf('\\League\\Event\\Emitter', $config->getEventEmitter());
     $this->assertInstanceOf('\\Phprest\\Service\\Hateoas\\Config', $config->getHateoasConfig());
     $this->assertInstanceOf('\\Phprest\\Service\\Hateoas\\Service', $config->getHateoasService());
     $this->assertInstanceOf('\\League\\BooBoo\\Runner', $config->getErrorHandler());
     $this->assertInstanceOf('\\Phprest\\ErrorHandler\\Handler\\Log', $config->getLogHandler());
 }