Message   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A ok() 0 4 1
A created() 0 4 1
A accepted() 0 4 1
A noContent() 0 4 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