Completed
Push — master ( d83f32...d4821e )
by Rémi
04:29
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 3
    public function __construct($limitToUser = false, $includeReplies = false)
22
    {
23 3
        $this->limitToUser = $limitToUser;
24 3
        $this->includeReplies = $includeReplies;
25 3
    }
26
27
    /**
28
     * @return array
29
     */
30 3
    public function toArray()
31
    {
32 3
        $request = [];
33
34 3
        if ($this->limitToUser) {
35
            $request['with'] = 'user';
36
        }
37
38 3
        if ($this->includeReplies) {
39
            $request['replies'] = 'all';
40
        }
41
42 3
        return $request;
43
    }
44
}
45