Conditions | 9 |
Paths | 9 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | public function getNotificationEmailAddress() |
||
31 | { |
||
32 | $email = null; |
||
33 | $emailsRaw = $this->getFlexiData($this->getApiURL(), |
||
34 | ['detail' => 'custom:id,email,kontakty(primarni,email)', 'relations' => 'kontakty']); |
||
35 | if (is_array($emailsRaw)) { |
||
|
|||
36 | $emails = $emailsRaw[0]; |
||
37 | if (array_key_exists('email', $emails) && strlen(trim($emails['email']))) { |
||
38 | $email = $emails['email']; |
||
39 | } |
||
40 | if (array_key_exists('kontakty', $emails) && !empty($emails['kontakty'])) { |
||
41 | foreach ($emails['kontakty'] as $kontakt) { |
||
42 | if (($kontakt['primarni'] == 'true') && strlen(trim($kontakt['email']))) { |
||
43 | $email = $kontakt['email']; |
||
44 | break; |
||
45 | } |
||
46 | } |
||
47 | } |
||
48 | } |
||
49 | return $email; |
||
50 | } |
||
52 |