TranslationDeleted   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 51
ccs 0
cts 24
cp 0
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getStatus() 0 3 1
A getMessage() 0 3 1
A createFromArray() 0 14 3
1
<?php
2
3
namespace FAPI\Localise\Model\Translation;
4
5
use FAPI\Localise\Model\CreatableFromArray;
6
7
/**
8
 * @author Tobias Nyholm <[email protected]>
9
 */
10
class TranslationDeleted implements CreatableFromArray
11
{
12
    private $status;
13
14
    private $message;
15
16
    /**
17
     * @param int    $status
18
     * @param string $message
19
     */
20
    private function __construct(int $status, string $message)
21
    {
22
        $this->status = $status;
23
        $this->message = $message;
24
    }
25
26
    /**
27
     * @param array $data
28
     *
29
     * @return TranslationDeleted
30
     */
31
    public static function createFromArray(array $data)
32
    {
33
        $status = 0;
34
        $message = '';
35
36
        if (isset($data['status'])) {
37
            $status = $data['status'];
38
        }
39
40
        if (isset($data['message'])) {
41
            $message = $data['message'];
42
        }
43
44
        return new self($status, $message);
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getMessage(): string
51
    {
52
        return $this->message;
53
    }
54
55
    /**
56
     * @return int
57
     */
58
    public function getStatus(): int
59
    {
60
        return $this->status;
61
    }
62
}
63