Skip to content

Commit 9b453bd

Browse files
committed
return also nonexistent email address as (empty) string
1 parent 2c866d3 commit 9b453bd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/AbraFlexi/Adresar.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class Adresar extends RW implements Document
4343
*
4444
* @param string $purpose Purpose - one of Fak|Obj|Nab|Ppt|Skl|Pok
4545
*
46-
* @return null|string email of primary contact or address email or null
46+
* @return null|string email of primary contact or address email or empty string
4747
*/
48-
public function getNotificationEmailAddress(string $purpose = '')
48+
public function getNotificationEmailAddress(string $purpose = ''): string
4949
{
50-
$email = null;
50+
$email = '';
5151
$emailsRaw = $this->getFlexiData(
5252
$this->getApiURL(),
5353
['detail' => 'custom:id,email,kontakty(primarni,email,odesilatFak,odesilatObj,odesilatNab,odesilatPpt,odesilatSkl,odesilatPok)', 'relations' => 'kontakty'],
@@ -213,7 +213,7 @@ public function getEmail(): string
213213
}
214214

215215
/**
216-
* Get Addressbook Item ID.
216+
* Get AddressBook Item ID.
217217
*
218218
* @return array<string, string>
219219
*/

src/AbraFlexi/Stitek.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public static function getAvailableLabels($object)
113113
$labelsRaw = $object->getColumnsFromAbraFlexi(
114114
['kod', 'nazev'],
115115
[$pathToVsb[$evidenceBackup] => true, 'limit' => 0],
116-
'nazev',
116+
'nazev'
117117
);
118118

119119
if (\count($labelsRaw)) {

src/AbraFlexi/email.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ trait email
4848
* 3. try Document's primary contact mail
4949
* 4. try Document's any contact mail
5050
*
51-
* @return string
51+
* @return string - empty when no usable email address was found
5252
*/
53-
public function getEmail()
53+
public function getEmail(): string
5454
{
5555
if (empty($this->getDataValue('kontaktEmail'))) {
5656
$addresser = new Adresar($this->getDataValue('firma'), array_merge(['detail' => 'custom:email'], $this->getConnectionOptions()));
@@ -80,7 +80,7 @@ public function getEmail()
8080
*
8181
* @return string column divided list of email addresses
8282
*/
83-
public function getRecipients(string $purpose = '')
83+
public function getRecipients(string $purpose = ''): string
8484
{
8585
$recipients = [];
8686

0 commit comments

Comments
 (0)