Passed
Push — master ( 1fb483...35eebd )
by Roman
04:31
created

SuccessApiResponse::status()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Dictionary\Features\Languages\Response;
6
7
/**
8
 * @psalm-immutable
9
 */
10
final class SuccessApiResponse implements ResponseInterface
11
{
12
    private int $status;
13
    private array $data;
14
15
    public function __construct(array $data = [], int $status = HttpStatusCode::HTTP_OK)
16
    {
17
        $this->data = $data;
18
        $this->status = $status;
19
    }
20
21 1
    public function body(): array
22
    {
23
        return [
24 1
            'success' => true,
25 1
            'data' => $this->data,
26
        ];
27
    }
28
29 1
    public function status(): int
30
    {
31 1
        return $this->status;
32
    }
33
}
34