Passed
Push — master ( eba427...0340e7 )
by Pieter
07:10
created

Update::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
ccs 3
cts 3
cp 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace PeeHaa\AsyncTwitter\Api\Request\Status;
4
5
use PeeHaa\AsyncTwitter\Api\Request\BaseRequest;
6
7
class Update extends BaseRequest
8
{
9
    const METHOD   = 'POST';
10
    const ENDPOINT = '/statuses/update.json';
11
12 12
    public function __construct(string $message)
13
    {
14 12
        parent::__construct(self::METHOD, self::ENDPOINT);
15
16 12
        $this->parameters['status'] = $message;
17
    }
18
19 2
    public function replyTo(int $id): Update
20
    {
21 2
        $this->parameters['in_reply_to_status_id'] = (string) $id;
22
23 2
        return $this;
24
    }
25
26 2
    public function isSensitive(): Update
27
    {
28 2
        $this->parameters['possibly_sensitive'] = 'true';
29
30 2
        return $this;
31
    }
32
33 2
    public function setLatitude(float $latitude): Update
34
    {
35 2
        $this->parameters['lat'] = (string) $latitude;
36
37 2
        return $this;
38
    }
39
40 2
    public function setLongitude(float $longitude): Update
41
    {
42 2
        $this->parameters['long'] = (string) $longitude;
43
44 2
        return $this;
45
    }
46
47 2
    public function displayCoordinates(): Update
48
    {
49 2
        $this->parameters['display_coordinates'] = 'true';
50
51 2
        return $this;
52
    }
53
54 2
    public function trimUser(): Update
55
    {
56 2
        $this->parameters['trim_user'] = 'true';
57
58 2
        return $this;
59
    }
60
61
    public function setMediaIds(string ...$ids): Update
62
    {
63
        $this->parameters['media_ids'] = implode(',', $ids);
64
65
        return $this;
66
    }
67
}
68