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

WebErrorHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 2
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