StatusCode::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 4
c 2
b 1
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
cc 3
nc 4
nop 1
crap 3
1
<?php
2
3
namespace HttpStatusCodes;
4
5
class StatusCode implements Contracts\StatusCode
6
{
7
    protected $message;
8
    protected $code;
9
    protected $description;
10
    protected $rfcNumber;
11
12
    /**
13
     * StatusCode constructor.
14
     */
15 6
    public function __construct($data)
16
    {
17 6
        $this->message     = $data['message'];
18 6
        $this->code        = $data['code'];
19 6
        $this->description = $data['description'] ? $data['description'] : '';
20 6
        $this->rfcNumber   = $data['rfc'] ? $data['rfc'] : 0;
21
    }
22
23 4
    public function getMessage(): string
24
    {
25 4
        return $this->message;
26
    }
27
28 1
    public function getCode(): int
29
    {
30 1
        return $this->code;
31
    }
32
33 1
    public function getDescription(): string
34
    {
35 1
        return $this->description;
36
    }
37
38 1
    public function getRFCNumber(): int
39
    {
40 1
        return $this->rfcNumber;
41
    }
42
}
43