Completed
Push — master ( 97ed41...46628b )
by Rémi
04:52
created

UserStreamQuery::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Twitter\API\REST\Query\Stream;
4
5
use Twitter\API\REST\ApiParameters;
6
7
class UserStreamQuery implements ApiParameters
8
{
9
    /** @var bool */
10
    private $limitToUser;
11
12
    /** @var bool */
13
    private $includeReplies;
14
15
    /**
16
     * UserStreamQuery constructor.
17
     *
18
     * @param bool $limitToUser
19
     * @param bool $includeReplies
20
     */
21 9
    public function __construct($limitToUser = false, $includeReplies = false)
22
    {
23 9
        $this->limitToUser = $limitToUser;
24 9
        $this->includeReplies = $includeReplies;
25 9
    }
26
27
    /**
28
     * @return array
29
     */
30 9
    public function toArray()
31
    {
32 9
        $request = [];
33
34 9
        if ($this->limitToUser) {
35 3
            $request['with'] = 'user';
36 2
        }
37
38 9
        if ($this->includeReplies) {
39 3
            $request['replies'] = 'all';
40 2
        }
41
42 9
        return $request;
43
    }
44
}
45