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