| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 85.71% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | class SpamTestHandler extends AbstractHandler |
||
| 19 | { |
||
| 20 | const API_ENDPOINT = '/rest/spam_test/check'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param string $subject |
||
| 24 | * @param string $content |
||
| 25 | * @param string $fromEmail |
||
| 26 | * @param string $fromName |
||
| 27 | * @return \stdClass |
||
| 28 | */ |
||
| 29 | 42 | public function spamCheck( |
|
| 30 | string $subject, |
||
| 31 | string $content, |
||
| 32 | string $fromEmail = '', |
||
| 33 | string $fromName = '' |
||
| 34 | ): \stdClass { |
||
| 35 | 42 | $getParameters = []; |
|
| 36 | 12 | $postParameters = [ |
|
| 37 | 42 | 'subject' => $subject, |
|
| 38 | 42 | 'html' => $content, |
|
| 39 | 'from' => $fromEmail ?: null, |
||
| 40 | 'from_name' => $fromName ?: null |
||
| 41 | ]; |
||
| 42 | |||
| 43 | 30 | $postParameters = array_filter($postParameters, function ($value) { |
|
| 44 | 42 | return $value !== null; |
|
| 45 | 42 | }); |
|
| 46 | 42 | $response = $this->processRequest($getParameters, $postParameters); |
|
| 47 | 7 | return $response; |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | 7 | protected function getApiEndpoint(): string |
|
| 56 | } |
||
| 57 | } |
||
| 58 |