SetState   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 55
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A offline() 0 3 1
A getMandatoryFields() 0 3 1
A busy() 0 3 1
A online() 0 3 1
A away() 0 3 1
1
<?php
2
3
namespace leocata\M1\Methods\Request;
4
5
use leocata\M1\Abstracts\RequestMethods;
6
7
/**
8
 * Class SetState
9
 * Set user's state.
10
 */
11
class SetState extends RequestMethods
12
{
13
    const OFFLINE = 0;
14
    const ONLINE = 1;
15
    const AWAY = 2;
16
    const BUSY = 3;
17
18
    /**
19
     * State:
20
     * 0 "offline" offline
21
     * 1 "online" online
22
     * 2 "away" absent (can receive calls, but shan't receive messages)
23
     * 3 "busy" busy (can receive messages, but shan’t receive calls).
24
     *
25
     * @var int
26
     */
27
    public $state = -1;
28
    public $termid;
29
    public $note;
30
31
    /**
32
     * Set state online.
33
     */
34 1
    public function online()
35
    {
36 1
        $this->state = self::ONLINE;
37 1
    }
38
39
    /**
40
     * Set state offline.
41
     */
42 1
    public function offline()
43
    {
44 1
        $this->state = self::OFFLINE;
45 1
    }
46
47
    /**
48
     * Set state away.
49
     */
50 1
    public function away()
51
    {
52 1
        $this->state = self::AWAY;
53 1
    }
54
55
    /**
56
     * Set state busy.
57
     */
58 1
    public function busy()
59
    {
60 1
        $this->state = self::BUSY;
61 1
    }
62
63 1
    public function getMandatoryFields(): array
64
    {
65 1
        return ['state'];
66
    }
67
}
68