HttpException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
1
<?php
2
3
namespace Huntie\JsonApi\Exceptions;
4
5
use Huntie\JsonApi\Support\JsonApiErrors;
6
use Illuminate\Foundation\Application;
7
use Illuminate\Http\Response;
8
use Illuminate\Http\Exceptions\HttpResponseException;
9
10
class HttpException extends HttpResponseException
11
{
12
    use JsonApiErrors;
13
14
    /**
15
     * Create a new HttpException instance.
16
     *
17
     * @param string            $message  The message for this exception
18
     * @param Response|int|null $response The response object or HTTP status code send to the client
19
     */
20
    public function __construct($message, $response = null)
21
    {
22
        if (is_null($response)) {
23
            $response = $this->error(Response::HTTP_BAD_REQUEST, $message);
24
        } else if (is_int($response)) {
25
            $response = $this->error($response, $message);
26
        }
27
28
        parent::__construct($response);
29
    }
30
}
31