Message::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
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 Message extends AbstractMeta
11
{
12 4
    public function __construct(string $message, int $httpStatusCode)
13
    {
14 4
        parent::__construct(['message' => $message], $httpStatusCode);
15 4
    }
16
17 1
    public static function ok(string $message = 'OK'): self
18
    {
19 1
        return new self($message, 200);
20
    }
21
22 1
    public static function created(string $message = 'Created'): self
23
    {
24 1
        return new self($message, 201);
25
    }
26
27 1
    public static function accepted(string $message = 'Accepted'): self
28
    {
29 1
        return new self($message, 202);
30
    }
31
32 1
    public static function noContent(string $message = 'No Content'): self
33
    {
34 1
        return new self($message, 204);
35
    }
36
}
37