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

UserStreamQuery   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 38
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toArray() 0 14 3
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