Result::getInserted()   A
last analyzed

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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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