Test Failed
Push — master ( 85ca69...144c12 )
by Roman
15:41
created

SuccessApiResponse::status()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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