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

FriendsListQuery::toArray()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 4
nop 0
crap 3
1
<?php
2
3
namespace Twitter\API\REST\Query\Friends;
4
5
use Twitter\API\REST\ApiParameters;
6
use Twitter\API\REST\DTO\UserIdentifier;
7
8
class FriendsListQuery implements ApiParameters
9
{
10
    /** @var UserIdentifier */
11
    private $userIdentifier;
12
13
    /** @var int */
14
    private $count;
15
16
    /** @var int */
17
    private $cursor;
18
19
    /** @var bool */
20
    private $skipStatus;
21
22
    /** @var boolean */
23
    private $includeUserEntities;
24
25
    /**
26
     * UserInformationQuery constructor.
27
     *
28
     * @param UserIdentifier $userIdentifier
29
     * @param int            $count
30
     * @param int            $cursor
31
     * @param bool           $skipStatus
32
     * @param bool           $includeUserEntities
33
     */
34 6
    public function __construct(
35
        UserIdentifier $userIdentifier,
36
        $count = 20,
37
        $cursor = -1,
38
        $skipStatus = true,
39
        $includeUserEntities = false
40
    ) {
41 6
        $this->userIdentifier = $userIdentifier;
42 6
        $this->count = $count;
43 6
        $this->cursor = $cursor;
44 6
        $this->skipStatus = $skipStatus;
45 6
        $this->includeUserEntities = $includeUserEntities;
46 6
    }
47
48
    /**
49
     * @return array
50
     */
51 6
    public function toArray()
52
    {
53 6
        $request = $this->userIdentifier->toArray();
54
55 6
        $request['count'] = $this->count;
56 6
        $request['cursor'] = $this->cursor;
57 6
        $request['skip_status'] = $this->skipStatus ? 'true' : 'false';
58 6
        $request['include_entities'] = $this->includeUserEntities ? 'true' : 'false';
59
60 6
        return $request;
61
    }
62
}
63