Passed
Push — 2.0 ( 6cb80b...404407 )
by Samuel
02:35
created

Response::getErrors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SMartins\Exceptions\JsonApi;
4
5
use Illuminate\Http\JsonResponse;
6
use SMartins\Exceptions\Response\AbstractResponse;
7
8
class Response extends AbstractResponse
9
{
10
    /**
11
     * Returns JSON response.
12
     *
13
     * @return \Illuminate\Http\JsonResponse
14
     */
15
    public function json(): JsonResponse
16
    {
17
        return new JsonResponse(
18
            ['errors' => $this->getErrors()->toArray()],
19
            $this->getStatus(),
20
            $this->getErrors()->getHeaders()
21
        );
22
    }
23
}
24