Result   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 49
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A buildFromArray() 0 6 3
A getUpdated() 0 3 1
A getInserted() 0 3 1
1
<?php // Copyright ⓒ 2018 Magneds IP B.V. - All Rights Reserved
2
namespace Magneds\Lokalise\TranslateString\Entity;
3
4
class Result
5
{
6
    /**
7
     * @var int
8
     */
9
    protected $inserted;
10
11
    /**
12
     * @var int
13
     */
14
    protected $updated;
15
16
    /**
17
     * Result constructor.
18
     * @param int $inserted
19
     * @param int $updated
20
     */
21
    public function __construct(int $inserted, int $updated)
22
    {
23
        $this->inserted = $inserted;
24
        $this->updated  = $updated;
25
    }
26
27
    /**
28
     * @return int
29
     */
30
    public function getInserted(): int
31
    {
32
        return $this->inserted;
33
    }
34
35
    /**
36
     * @return int
37
     */
38
    public function getUpdated(): int
39
    {
40
        return $this->updated;
41
    }
42
43
    /**
44
     * @param $data
45
     * @return Result
46
     */
47
    public static function buildFromArray($data)
48
    {
49
        $inserted = array_key_exists('inserted', $data) ? $data['inserted'] : 0;
50
        $updated = array_key_exists('updated', $data) ? $data['updated'] : 0;
51
52
        return new self($inserted, $updated);
53
    }
54
}
55