Completed
Push — master ( ab2960...44d5ac )
by Patrick
03:26
created

WebErrorHandler::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 3
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace Http;
3
4
class WebErrorHandler
5
{
6
    public function __invoke($request, $response, $exception)
7
    {
8
        if($exception->getCode() === \Http\Rest\ACCESS_DENIED)
9
        {
10
            return $response->withStatus(401);
11
        }
12
        return $response
13
            ->withStatus(500)
14
            ->withHeader('Content-Type', 'text/html')
15
            ->write(print_r($exception, true));
16
   }
17
}
18