Passed
Branch master (34dd1b)
by Leo
01:41
created

GetMessages::result()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace leocata\M1\Methods\Request;
4
5
use leocata\M1\Abstracts\RequestMethods;
6
7
/**
8
 * Get list of messages
9
 * Class GetMessages
10
 * @package leocata\M1\Methods
11
 */
12
class GetMessages extends RequestMethods
13
{
14
15
    /**
16
     * Query of sessions with activity within specified time period
17
     */
18
    const PERIOD_ALL_TIME = 0;
19
    const PERIOD_LAST_MONTH = 1;
20
    const PERIOD_LAST_WEEK = 2;
21
    const PERIOD_LAST_DAY = 3;
22
23
    /**
24
     * Message type
25
     */
26
    const MESSAGE_TEXT = 0;
27
    const MESSAGE_FILE_LINK = 2;
28
    const MESSAGE_ADD_CONFERENCE = 3;
29
    const MESSAGE_DELETE_CONFERENCE = 4;
30
    const MESSAGE_CONTACT_LINK = 10;
31
32
    /**
33
     * Message status
34
     */
35
    const MESSAGE_STATUS_INCOMING_NEW = 1;
36
    const MESSAGE_STATUS_INCOMING_OUTCOMING = 2;
37
    const MESSAGE_STATUS_OUTCOMING_UNREAD = 3;
38
    const MESSAGE_STATUS_OUTCOMING_OUTCOMING = 4;
39
40
    /**
41
     * Session identifier.
42
     * @var string
43
     */
44
    public $sessionid;
45
46
    /**
47
     * Time period.
48
     *
49
     * Query of sessions with activity within specified time period:
50
     *  - 0 for all time
51
     *  - 1 for the past year
52
     *  - 2 for the last month
53
     *  - 3 for the last week
54
     *  - 4 for the last twenty-four hours
55
     *
56
     * @var integer
57
     */
58
    public $period;
59
60
    /**
61
     * Timestamp with sampling (in milliseconds since 01.01.1970).
62
     * @var integer
63
     */
64
    public $since;
65
66
    /**
67
     * Number of entries in the sample. If "limit" is absent or equal to zero, entries
68
     * are chosen in timestamp’s ascending order(from " since" till now) Otherwise - from "since" in descending order.
69
     * @var integer
70
     */
71
    public $limit;
72
73
    /**
74
     * GetMessages constructor.
75
     */
76
    public function __construct()
77
    {
78
        if ($this->period && $this->since === null) {
79
            $this->since = strtotime('-24 hour');
80
        }
81
    }
82
83
    public function getMandatoryFields(): array
84
    {
85
        return [];
86
    }
87
88
}
89