Completed
Push — gh-27-android-devices ( 34c0bd )
by Serhii
02:00
created

Device::getModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @author Serhii Nekhaienko <[email protected]>
4
 * @license GPL
5
 * @copyright Serhii Nekhaienko &copy 2018
6
 * @version 4.0.2
7
 * @project endorphin-studio/browser-detector
8
 */
9
10
namespace EndorphinStudio\Detector\Data;
11
12
/**
13
 * Class Device
14
 * Result of device detection
15
 * @package EndorphinStudio\Detector\Data
16
 */
17
class Device extends AbstractDataWithVersion
18
{
19
    /**
20
     * @return Model|null
21
     */
22
    public function getModel(): Model
23
    {
24
        return $this->model;
25
    }
26
27
    /**
28
     * @param Model|null $model
29
     */
30
    public function setModel(Model $model)
31
    {
32
        $this->model = $model;
33
    }
34
35
    /**
36
     * @return bool
37
     */
38
    public function isHasModel(): bool
39
    {
40
        return $this->hasModel;
41
    }
42
43
    /**
44
     * @param bool $hasModel
45
     */
46
    public function setHasModel(bool $hasModel)
47
    {
48
        $this->hasModel = $hasModel;
49
    }
50
51
    /**
52
     * @var Model | null
53
     */
54
    private $model = null;
55
56
    /**
57
     * @var bool
58
     */
59
    private $hasModel = false;
60
61
62
    public function jsonSerialize()
63
    {
64
        $fields = get_object_vars($this);
65
        unset($fields['result']);
66
        return $fields;
67
    }
68
}