Skip to content
This repository was archived by the owner on Dec 18, 2022. It is now read-only.

Commit 39d3ca0

Browse files
Magnus LindgrenBarnebys
authored andcommitted
Redundancy fix
1 parent e12b102 commit 39d3ca0

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/Api.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,8 @@ private static function getApiInstance()
4040
*/
4141
public static function getContactIdByMail($mail)
4242
{
43-
$api = self::getApiInstance();
44-
45-
$parameters = [
46-
'search' => $mail,
47-
'limit' => 1
48-
];
49-
50-
$data = $api->makeRequest('contacts', $parameters);
51-
$contacts = $data['contacts'];
52-
if(sizeof($contacts) > 0){
53-
return (int) current($contacts)['id'];
54-
}
55-
56-
throw new ContactNotFoundException();
43+
$contact = self::getContactByMail($mail);
44+
return (int) $contact['id'];
5745
}
5846

5947
/**

0 commit comments

Comments
 (0)