Test Failed
Push — master ( 257d98...3364ef )
by Yunus Emre
06:12
created

BaseException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace TarfinLabs\Parasut\Exceptions;
4
5
use Exception;
6
use Illuminate\Http\Client\Response;
7
8
abstract class BaseException extends Exception
9
{
10
    public static int $statusCode;
11
12
    /**
13
     * Create an Exception.
14
     *
15
     * @param  \Illuminate\Http\Client\Response  $response
16
     */
17
    public function __construct(Response $response)
18
    {
19
        parent::__construct(
20
            "{$response->json()['errors'][0]['title']}: {$response->json()['errors'][0]['detail']}",
21
            $response->status()
22
        );
23
    }
24
}
25