Conditions | 2 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 2.0017 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
30 | 42 | public function addSubscriber( |
|
31 | string $email, |
||
32 | string $listHash, |
||
33 | int $subscriberStatus = 0, |
||
34 | bool $sendConfirmationToSubscriber = false, |
||
35 | array $customFieldsWithValues = [] |
||
36 | ) { |
||
37 | 42 | $getParameters = []; |
|
38 | 12 | $postParameters = [ |
|
39 | 42 | 'email' => $email, |
|
40 | 42 | 'list' => $listHash, |
|
41 | 42 | 'state' => $subscriberStatus, |
|
42 | 42 | 'confirm' => $sendConfirmationToSubscriber, |
|
43 | 'custom_fields' => $customFieldsWithValues ?: null |
||
44 | ]; |
||
45 | |||
46 | 30 | $postParameters = array_filter($postParameters, function ($value) { |
|
47 | 42 | return $value !== null; |
|
48 | 42 | }); |
|
49 | 42 | $this->processRequest($getParameters, $postParameters); |
|
50 | 7 | return null; |
|
51 | } |
||
61 |