Completed
Push — master ( 42bf74...d12924 )
by Elf
01:37
created

ApiResponseException::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ElfSundae\Laravel\Api\Exceptions;
4
5
use RuntimeException;
6
use ElfSundae\Laravel\Api\ApiResponse;
7
8
class ApiResponseException extends RuntimeException
9
{
10
    /**
11
     * The underlying response instance.
12
     *
13
     * @var \ElfSundae\Laravel\Api\ApiResponse
14
     */
15
    protected $response;
16
17
    /**
18
     * Create a new exception instance.
19
     *
20
     * @param  mixed  $data
21
     * @param  int  $code
22
     * @param  array  $headers
23
     * @param  int  $options
24
     */
25
    public function __construct($data = null, $code = -1, $headers = [], $options = 0)
26
    {
27
        $this->response = new ApiResponse($data, $code, $headers, $options);
28
    }
29
30
    /**
31
     * Get the underlying response instance.
32
     *
33
     * @return \ElfSundae\Laravel\Api\ApiResponse
34
     */
35
    public function getResponse()
36
    {
37
        return $this->response;
38
    }
39
40
    /**
41
     * Render the exception into an HTTP response.
42
     *
43
     * @param  \Illuminate\Http\Request  $request
44
     * @return \Illuminate\Http\Response
45
     */
46
    public function render($request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
47
    {
48
        return $this->getResponse();
49
    }
50
}
51