Completed
Push — master ( 1a146d...3fc9a0 )
by Tobias
35s queued 17s
created

Error::error()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Happyr\JsonApiResponseFactory\Model;
6
7
/**
8
 * @author Radoje Albijanic <[email protected]>
9
 */
10
final class Error extends AbstractError
11
{
12 1
    public static function error(string $title, int $httpCode): self
13
    {
14 1
        return new self($title, $httpCode);
15
    }
16
17 1
    public static function serverError(string $title = 'Internal server error'): self
18
    {
19 1
        return new self($title, 500);
20
    }
21
22 1
    public static function forbidden(string $title = 'Forbidden'): self
23
    {
24 1
        return new self($title, 403);
25
    }
26
27 1
    public static function notFound(string $title = 'Not Found'): self
28
    {
29 1
        return new self($title, 404);
30
    }
31
32 1
    public static function unauthorized(string $title = 'Unauthorized'): self
33
    {
34 1
        return new self($title, 401);
35
    }
36
37 1
    public static function invalid(string $title = 'Bad Request'): self
38
    {
39 1
        return new self($title, 400);
40
    }
41
}
42