RestController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A abort() 0 4 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