Total Complexity | 3 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 91.67% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class CampaignSendHandler extends AbstractHandler |
||
19 | { |
||
20 | const API_ENDPOINT = '/rest/campaigns/send'; |
||
21 | |||
22 | /** |
||
23 | * @param string $campaignHash |
||
24 | * @param string $timeToSend |
||
25 | * @return null |
||
26 | */ |
||
27 | 49 | public function sendCampaign(string $campaignHash, string $timeToSend = '') |
|
28 | { |
||
29 | 49 | $getParameters = []; |
|
30 | 14 | $postParameters = [ |
|
31 | 49 | 'hash' => $campaignHash, |
|
32 | 'time' => $timeToSend ?: null |
||
33 | ]; |
||
34 | |||
35 | 35 | $postParameters = array_filter($postParameters, function ($value) { |
|
36 | 49 | return $value !== null; |
|
37 | 49 | }); |
|
38 | 49 | $this->processRequest($getParameters, $postParameters); |
|
39 | 7 | return null; |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return string |
||
44 | */ |
||
45 | 7 | protected function getApiEndpoint(): string |
|
48 | } |
||
49 | } |
||
50 |