Passed
Push — master ( e3bf26...71b022 )
by Orkhan
01:57
created

Device::__construct()   A

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
     * @param User|string $user
28
     * @param array $properties
29
     */
30
    public function __construct($user, array $properties = [])
31
    {
32
        parent::__construct($properties);
33
34
        $this->user = $user;
35
    }
36
37
    public function userId()
38
    {
39
        return $this->user instanceof User ? $this->user->id : $this->user;
40
    }
41
}
42