Device   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 5
c 1
b 0
f 1
dl 0
loc 26
rs 10

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
     *
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