RestController::abort()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Linio\Controller;
6
7
use Symfony\Component\HttpFoundation\JsonResponse;
8
9
abstract class RestController
10
{
11
    /**
12
     * @param string $message
13
     * @param int    $status
14
     *
15
     * @return JsonResponse
16
     */
17
    public function abort($message = '', $status = 500)
18
    {
19
        return new JsonResponse(['error' => ['message' => empty($message) ? 'Internal error' : $message]], $status);
20
    }
21
}
22