1 | <?php |
||
8 | class TwitterStatusUpdate |
||
9 | { |
||
10 | /** @var string */ |
||
11 | protected $content; |
||
12 | |||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private $images; |
||
17 | |||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | public $imageIds; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $apiEndpoint = 'statuses/update'; |
||
27 | |||
28 | /* |
||
29 | * @param string $content |
||
30 | */ |
||
31 | public function __construct($content) |
||
38 | |||
39 | /** |
||
40 | * Set Twitter media files. |
||
41 | * |
||
42 | * @param array|string $images |
||
43 | * @return $this |
||
44 | */ |
||
45 | public function withImage($images) |
||
53 | |||
54 | /** |
||
55 | * Get Twitter status update content. |
||
56 | * |
||
57 | * @return string |
||
58 | */ |
||
59 | public function getContent() |
||
63 | |||
64 | /** |
||
65 | * Get Twitter images list. |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getImages() |
||
73 | |||
74 | /** |
||
75 | * Return Twitter status update api endpoint. |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getApiEndpoint() |
||
82 | |||
83 | /** |
||
84 | * Build Twitter request body. |
||
85 | * @return array |
||
86 | */ |
||
87 | public function getRequestBody() |
||
99 | |||
100 | /** |
||
101 | * Check if the message length is too long. |
||
102 | * @param $content |
||
103 | * @param $brevity |
||
104 | * @return int |
||
105 | */ |
||
106 | private function messageIsTooLong($content, Brevity $brevity) |
||
113 | } |
||
114 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.