Update   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 61
ccs 21
cts 24
cp 0.875
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A replyTo() 0 6 1
A isSensitive() 0 6 1
A setLatitude() 0 6 1
A setLongitude() 0 6 1
A displayCoordinates() 0 6 1
A trimUser() 0 6 1
A setMediaIds() 0 6 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
/**
8
 * @link https://dev.twitter.com/rest/reference/post/statuses/update
9
 */
10
class Update extends BaseRequest
11
{
12
    const METHOD   = 'POST';
13
    const ENDPOINT = '/statuses/update.json';
14
15 12
    public function __construct(string $message)
16
    {
17 12
        parent::__construct(self::METHOD, self::ENDPOINT);
18
19 12
        $this->parameters['status'] = $message;
20
    }
21
22 2
    public function replyTo(int $id): Update
23
    {
24 2
        $this->parameters['in_reply_to_status_id'] = (string) $id;
25
26 2
        return $this;
27
    }
28
29 2
    public function isSensitive(): Update
30
    {
31 2
        $this->parameters['possibly_sensitive'] = 'true';
32
33 2
        return $this;
34
    }
35
36 2
    public function setLatitude(float $latitude): Update
37
    {
38 2
        $this->parameters['lat'] = (string) $latitude;
39
40 2
        return $this;
41
    }
42
43 2
    public function setLongitude(float $longitude): Update
44
    {
45 2
        $this->parameters['long'] = (string) $longitude;
46
47 2
        return $this;
48
    }
49
50 2
    public function displayCoordinates(): Update
51
    {
52 2
        $this->parameters['display_coordinates'] = 'true';
53
54 2
        return $this;
55
    }
56
57 2
    public function trimUser(): Update
58
    {
59 2
        $this->parameters['trim_user'] = 'true';
60
61 2
        return $this;
62
    }
63
64
    public function setMediaIds(string ...$ids): Update
65
    {
66
        $this->parameters['media_ids'] = implode(',', $ids);
67
68
        return $this;
69
    }
70
}
71