Completed
Push — master ( 5c6dda...f1d038 )
by Tobias
03:08
created

TranslationDeleted   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 52
ccs 0
cts 25
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createFromArray() 0 15 3
A getMessage() 0 4 1
A getStatus() 0 4 1
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
    private $message;
14
15
    /**
16
     * @param int    $status
17
     * @param string $message
18
     */
19
    private function __construct(int $status, string $message)
20
    {
21
        $this->status = $status;
22
        $this->message = $message;
23
    }
24
25
    /**
26
     * @param array $data
27
     *
28
     * @return TranslationDeleted
29
     */
30
    public static function createFromArray(array $data)
31
    {
32
        $status = 0;
33
        $message = '';
34
35
        if (isset($data['status'])) {
36
            $status = $data['status'];
37
        }
38
39
        if (isset($data['message'])) {
40
            $message = $data['message'];
41
        }
42
43
        return new self($status, $message);
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getMessage(): string
50
    {
51
        return $this->message;
52
    }
53
54
    /**
55
     * @return int
56
     */
57
    public function getStatus(): int
58
    {
59
        return $this->status;
60
    }
61
}
62