Skip to content

Commit

Permalink
pre-check for social profile data
Browse files Browse the repository at this point in the history
Signed-off-by: call-me-matt <matthiash@abwesend.de>
  • Loading branch information
call-me-matt committed Jul 15, 2021
1 parent d6ed6b6 commit 137e24b
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Service/Social/DiasporaProvider.php
Expand Up @@ -49,6 +49,9 @@ public function __construct(IClientService $httpClient) {
* @return bool
*/
public function supportsContact(array $contact):bool {
if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
return false;
}
$socialprofiles = $this->getProfileIds($contact);
return isset($socialprofiles) && count($socialprofiles) > 0;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/Social/FacebookProvider.php
Expand Up @@ -45,6 +45,9 @@ public function __construct(IClientService $httpClient) {
* @return bool
*/
public function supportsContact(array $contact):bool {
if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
return false;
}
$socialprofiles = $this->getProfiles($contact);
return isset($socialprofiles) && count($socialprofiles) > 0;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/Social/GravatarProvider.php
Expand Up @@ -38,6 +38,9 @@ public function __construct() {
* @return bool
*/
public function supportsContact(array $contact):bool {
if (!array_key_exists("EMAIL",$contact)) {
return false;
}
$emails = $contact['EMAIL'];
return isset($emails) && count($emails);
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/Social/InstagramProvider.php
Expand Up @@ -55,6 +55,9 @@ public function __construct(IClientService $httpClient,
* @return bool
*/
public function supportsContact(array $contact):bool {
if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
return false;
}
$socialprofiles = $this->getProfiles($contact);
return isset($socialprofiles) && count($socialprofiles) > 0;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/Social/MastodonProvider.php
Expand Up @@ -45,6 +45,9 @@ public function __construct(IClientService $httpClient) {
* @return bool
*/
public function supportsContact(array $contact):bool {
if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
return false;
}
$profiles = $this->getProfileIds($contact);
return isset($profiles) && count($profiles) > 0;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/Social/TumblrProvider.php
Expand Up @@ -38,6 +38,9 @@ public function __construct() {
* @return bool
*/
public function supportsContact(array $contact):bool {
if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
return false;
}
$socialprofiles = $this->getProfileIds($contact);
return isset($socialprofiles) && count($socialprofiles) > 0;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/Social/TwitterProvider.php
Expand Up @@ -54,6 +54,9 @@ public function __construct(IClientService $httpClient,
* @return bool
*/
public function supportsContact(array $contact):bool {
if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
return false;
}
$socialprofiles = $this->getProfileIds($contact);
return isset($socialprofiles) && count($socialprofiles) > 0;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/Social/XingProvider.php
Expand Up @@ -45,6 +45,9 @@ public function __construct(IClientService $httpClient) {
* @return bool
*/
public function supportsContact(array $contact):bool {
if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
return false;
}
$socialprofiles = $this->getProfileIds($contact);
return isset($socialprofiles) && count($socialprofiles) > 0;
}
Expand Down

0 comments on commit 137e24b

Please sign in to comment.