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

Device   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A userId() 0 3 2
A __construct() 0 5 1
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