Device::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Orkhanahmadov\Sipgate\Resources;
4
5
/**
6
 * @property string id
7
 * @property string alias
8
 * @property string type
9
 * @property bool online
10
 * @property bool dnd
11
 * @property array activePhonelines
12
 * @property array activeGroups
13
 * @property array credentials
14
 * @property array registered
15
 * @property string emergencyAddressId
16
 * @property string addressUrl
17
 */
18
class Device extends Resource
19
{
20
    /**
21
     * @var User|string
22
     */
23
    public $user;
24
25
    /**
26
     * Device constructor.
27
     *
28
     * @param User|string $user
29
     * @param array $properties
30
     */
31
    public function __construct($user, array $properties = [])
32
    {
33
        parent::__construct($properties);
34
35
        $this->user = $user;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function userId()
42
    {
43
        return $this->user instanceof User ? $this->user->id : $this->user;
44
    }
45
}
46