| Conditions | 4 |
| Paths | 8 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function single(string $url, string $title = null, array $tags = null, int $tweetId = null) |
||
| 22 | { |
||
| 23 | $data = $this->keys() + ['time' => time(), 'url' => utf8_encode($url)]; |
||
| 24 | if (!is_null($title)) { |
||
| 25 | $data = $data + ['title' => utf8_encode($title)]; |
||
| 26 | } |
||
| 27 | if (!is_null($tags)) { |
||
| 28 | $data = $data + ['tags' => implode(',', $tags)]; |
||
| 29 | } |
||
| 30 | if (!is_null($tweetId)) { |
||
| 31 | $data = $data + ['tweet_id' => $tweetId]; |
||
| 32 | } |
||
| 33 | |||
| 34 | $response = $this->request('/v3/add', $data); |
||
| 35 | $responseData = json_decode($response->getBody()); |
||
| 36 | |||
| 37 | return $responseData; |
||
| 38 | } |
||
| 39 | } |
||
| 40 |