FollowParameters::toArray()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

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