Completed
Push — master ( d83f32...d4821e )
by Rémi
04:29
created

UserStreamQuery   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 69.23%

Importance

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

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 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