summaryrefslogtreecommitdiffstats
path: root/lib/Service
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-08-05 08:52:08 +0200
committerJoas Schilling <coding@schilljs.com>2022-08-05 13:33:24 +0200
commit1f2e3c9a4fc4ec2618085f1d4a4d173013ecff26 (patch)
tree1e8831d5c03572c6bfbf782c23a09bac1b0506d4 /lib/Service
parent5f274b5624307caf1f4508eb386298f934fac52e (diff)
Adjust coding style
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service')
-rw-r--r--lib/Service/Social/DiasporaProvider.php10
-rw-r--r--lib/Service/Social/FacebookProvider.php8
-rw-r--r--lib/Service/Social/GravatarProvider.php6
-rw-r--r--lib/Service/Social/InstagramProvider.php14
-rw-r--r--lib/Service/Social/MastodonProvider.php6
-rw-r--r--lib/Service/Social/TumblrProvider.php6
-rw-r--r--lib/Service/Social/TwitterProvider.php10
-rw-r--r--lib/Service/Social/XingProvider.php4
-rw-r--r--lib/Service/SocialApiService.php2
9 files changed, 33 insertions, 33 deletions
diff --git a/lib/Service/Social/DiasporaProvider.php b/lib/Service/Social/DiasporaProvider.php
index 67a194e0..ae639212 100644
--- a/lib/Service/Social/DiasporaProvider.php
+++ b/lib/Service/Social/DiasporaProvider.php
@@ -34,7 +34,7 @@ class DiasporaProvider implements ISocialProvider {
private $looping;
/** @var string */
- public $name = "diaspora";
+ public $name = 'diaspora';
public function __construct(IClientService $httpClient) {
$this->httpClient = $httpClient->NewClient();
@@ -49,7 +49,7 @@ class DiasporaProvider implements ISocialProvider {
* @return bool
*/
public function supportsContact(array $contact):bool {
- if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
+ if (!array_key_exists('X-SOCIALPROFILE', $contact)) {
return false;
}
$socialprofiles = $this->getProfileIds($contact);
@@ -91,7 +91,7 @@ class DiasporaProvider implements ISocialProvider {
$avatar = '/.*<logo>(.*)<\/logo>.*/';
if (preg_match($avatar, $htmlResult, $matches)) {
- return (str_replace("small", "large", $matches[1]));
+ return (str_replace('small', 'large', $matches[1]));
}
// keyword not found, second try:
if (!$this->looping) {
@@ -106,7 +106,7 @@ class DiasporaProvider implements ISocialProvider {
return null;
}
}
-
+
/**
* Returns all possible profile ids for contact
*
@@ -130,7 +130,7 @@ class DiasporaProvider implements ISocialProvider {
}
return $profileIds;
}
-
+
/**
* Returns the profile-id
*
diff --git a/lib/Service/Social/FacebookProvider.php b/lib/Service/Social/FacebookProvider.php
index c9035f56..ac609449 100644
--- a/lib/Service/Social/FacebookProvider.php
+++ b/lib/Service/Social/FacebookProvider.php
@@ -31,7 +31,7 @@ class FacebookProvider implements ISocialProvider {
private $httpClient;
/** @var string */
- public $name = "facebook";
+ public $name = 'facebook';
public function __construct(IClientService $httpClient) {
$this->httpClient = $httpClient->NewClient();
@@ -45,7 +45,7 @@ class FacebookProvider implements ISocialProvider {
* @return bool
*/
public function supportsContact(array $contact):bool {
- if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
+ if (!array_key_exists('X-SOCIALPROFILE', $contact)) {
return false;
}
$socialprofiles = $this->getProfiles($contact);
@@ -64,7 +64,7 @@ class FacebookProvider implements ISocialProvider {
$urls = [];
foreach ($profileIds as $profileId) {
$recipe = 'https://graph.facebook.com/{socialId}/picture?width=720';
- $connector = str_replace("{socialId}", $profileId, $recipe);
+ $connector = str_replace('{socialId}', $profileId, $recipe);
$urls[] = $connector;
}
return $urls;
@@ -133,7 +133,7 @@ class FacebookProvider implements ISocialProvider {
*/
protected function findFacebookId(string $profileName):string {
try {
- $result = $this->httpClient->get("https://facebook.com/".$profileName);
+ $result = $this->httpClient->get('https://facebook.com/'.$profileName);
if ($result->getStatusCode() !== 200) {
return $profileName;
}
diff --git a/lib/Service/Social/GravatarProvider.php b/lib/Service/Social/GravatarProvider.php
index 1fd81dc3..401c36df 100644
--- a/lib/Service/Social/GravatarProvider.php
+++ b/lib/Service/Social/GravatarProvider.php
@@ -25,7 +25,7 @@ namespace OCA\Contacts\Service\Social;
class GravatarProvider implements ISocialProvider {
/** @var string */
- public $name = "gravatar";
+ public $name = 'gravatar';
public function __construct() {
}
@@ -38,7 +38,7 @@ class GravatarProvider implements ISocialProvider {
* @return bool
*/
public function supportsContact(array $contact):bool {
- if (!array_key_exists("EMAIL",$contact)) {
+ if (!array_key_exists('EMAIL', $contact)) {
return false;
}
$emails = $contact['EMAIL'];
@@ -59,7 +59,7 @@ class GravatarProvider implements ISocialProvider {
foreach ($emails as $email) {
$hash = md5(strtolower(trim($email['value'])));
$recipe = 'https://www.gravatar.com/avatar/{hash}?s=720&d=404';
- $connector = str_replace("{hash}", $hash, $recipe);
+ $connector = str_replace('{hash}', $hash, $recipe);
$urls[] = $connector;
}
}
diff --git a/lib/Service/Social/InstagramProvider.php b/lib/Service/Social/InstagramProvider.php
index 68ca0cc2..c8fc2135 100644
--- a/lib/Service/Social/InstagramProvider.php
+++ b/lib/Service/Social/InstagramProvider.php
@@ -39,7 +39,7 @@ class InstagramProvider implements ISocialProvider {
private $logger;
/** @var string */
- public $name = "instagram";
+ public $name = 'instagram';
public function __construct(IClientService $httpClient,
LoggerInterface $logger) {
@@ -55,7 +55,7 @@ class InstagramProvider implements ISocialProvider {
* @return bool
*/
public function supportsContact(array $contact):bool {
- if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
+ if (!array_key_exists('X-SOCIALPROFILE', $contact)) {
return false;
}
$socialprofiles = $this->getProfiles($contact);
@@ -74,7 +74,7 @@ class InstagramProvider implements ISocialProvider {
$urls = [];
foreach ($profileIds as $profileId) {
$recipe = 'https://www.instagram.com/{socialId}/?__a=1';
- $connector = str_replace("{socialId}", $profileId, $recipe);
+ $connector = str_replace('{socialId}', $profileId, $recipe);
$connector = $this->getFromJson($connector, 'graphql->user->profile_pic_url_hd');
$urls[] = $connector;
}
@@ -92,7 +92,7 @@ class InstagramProvider implements ISocialProvider {
$candidate = preg_replace('/^' . preg_quote('x-apple:', '/') . '/', '', $candidate);
return basename($candidate);
}
-
+
/**
* Returns all possible profile urls for contact
*
@@ -146,8 +146,8 @@ class InstagramProvider implements ISocialProvider {
]
]);
- $jsonResult = json_decode($result->getBody(),true);
- $location = explode('->' , $desired);
+ $jsonResult = json_decode($result->getBody(), true);
+ $location = explode('->', $desired);
foreach ($location as $loc) {
if (!isset($jsonResult[$loc])) {
return null;
@@ -156,7 +156,7 @@ class InstagramProvider implements ISocialProvider {
}
return $jsonResult;
} catch (RequestException $e) {
- $this->logger->debug('Error fetching instagram urls', [
+ $this->logger->debug('Error fetching instagram urls', [
'app' => Application::APP_ID,
'exception' => $e
]);
diff --git a/lib/Service/Social/MastodonProvider.php b/lib/Service/Social/MastodonProvider.php
index ed8ff1a1..99eb5a58 100644
--- a/lib/Service/Social/MastodonProvider.php
+++ b/lib/Service/Social/MastodonProvider.php
@@ -31,7 +31,7 @@ class MastodonProvider implements ISocialProvider {
private $httpClient;
/** @var string */
- public $name = "mastodon";
+ public $name = 'mastodon';
public function __construct(IClientService $httpClient) {
$this->httpClient = $httpClient->NewClient();
@@ -45,7 +45,7 @@ class MastodonProvider implements ISocialProvider {
* @return bool
*/
public function supportsContact(array $contact):bool {
- if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
+ if (!array_key_exists('X-SOCIALPROFILE', $contact)) {
return false;
}
$profiles = $this->getProfileIds($contact);
@@ -87,7 +87,7 @@ class MastodonProvider implements ISocialProvider {
$htmlResult->loadHTML($result->getBody());
$img = $htmlResult->getElementById('profile_page_avatar');
if (!is_null($img)) {
- return $img->getAttribute("data-original");
+ return $img->getAttribute('data-original');
}
return null;
} catch (\Exception $e) {
diff --git a/lib/Service/Social/TumblrProvider.php b/lib/Service/Social/TumblrProvider.php
index b4bb71e7..ff94d0b2 100644
--- a/lib/Service/Social/TumblrProvider.php
+++ b/lib/Service/Social/TumblrProvider.php
@@ -25,7 +25,7 @@ namespace OCA\Contacts\Service\Social;
class TumblrProvider implements ISocialProvider {
/** @var string */
- public $name = "tumblr";
+ public $name = 'tumblr';
public function __construct() {
}
@@ -38,7 +38,7 @@ class TumblrProvider implements ISocialProvider {
* @return bool
*/
public function supportsContact(array $contact):bool {
- if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
+ if (!array_key_exists('X-SOCIALPROFILE', $contact)) {
return false;
}
$socialprofiles = $this->getProfileIds($contact);
@@ -57,7 +57,7 @@ class TumblrProvider implements ISocialProvider {
$urls = [];
foreach ($profileIds as $profileId) {
$recipe = 'https://api.tumblr.com/v2/blog/{socialId}/avatar/512';
- $connector = str_replace("{socialId}", $profileId, $recipe);
+ $connector = str_replace('{socialId}', $profileId, $recipe);
$urls[] = $connector;
}
return $urls;
diff --git a/lib/Service/Social/TwitterProvider.php b/lib/Service/Social/TwitterProvider.php
index ad2402ba..3d16be8f 100644
--- a/lib/Service/Social/TwitterProvider.php
+++ b/lib/Service/Social/TwitterProvider.php
@@ -38,7 +38,7 @@ class TwitterProvider implements ISocialProvider {
private $logger;
/** @var string */
- public $name = "twitter";
+ public $name = 'twitter';
public function __construct(IClientService $httpClient,
LoggerInterface $logger) {
@@ -54,7 +54,7 @@ class TwitterProvider implements ISocialProvider {
* @return bool
*/
public function supportsContact(array $contact):bool {
- if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
+ if (!array_key_exists('X-SOCIALPROFILE', $contact)) {
return false;
}
$socialprofiles = $this->getProfileIds($contact);
@@ -73,7 +73,7 @@ class TwitterProvider implements ISocialProvider {
$urls = [];
foreach ($profileIds as $profileId) {
$recipe = 'https://twitter.com/{socialId}';
- $connector = str_replace("{socialId}", $profileId, $recipe);
+ $connector = str_replace('{socialId}', $profileId, $recipe);
$connector = $this->getFromHtml($connector, 'profile_image');
$urls[] = $connector;
}
@@ -139,14 +139,14 @@ class TwitterProvider implements ISocialProvider {
foreach ($img->attributes as $attr) {
$value = $attr->nodeValue;
if (strpos($value, $desired)) {
- $value = str_replace("normal", "400x400", $value);
+ $value = str_replace('normal', '400x400', $value);
return $value;
}
}
}
return null;
} catch (RequestException $e) {
- $this->logger->debug('Error fetching twitter urls', [
+ $this->logger->debug('Error fetching twitter urls', [
'app' => Application::APP_ID,
'exception' => $e
]);
diff --git a/lib/Service/Social/XingProvider.php b/lib/Service/Social/XingProvider.php
index 0094fcd1..14ebe2e8 100644
--- a/lib/Service/Social/XingProvider.php
+++ b/lib/Service/Social/XingProvider.php
@@ -31,7 +31,7 @@ class XingProvider implements ISocialProvider {
private $httpClient;
/** @var string */
- public $name = "xing";
+ public $name = 'xing';
public function __construct(IClientService $httpClient) {
$this->httpClient = $httpClient->NewClient();
@@ -45,7 +45,7 @@ class XingProvider implements ISocialProvider {
* @return bool
*/
public function supportsContact(array $contact):bool {
- if (!array_key_exists("X-SOCIALPROFILE",$contact)) {
+ if (!array_key_exists('X-SOCIALPROFILE', $contact)) {
return false;
}
$socialprofiles = $this->getProfileIds($contact);
diff --git a/lib/Service/SocialApiService.php b/lib/Service/SocialApiService.php
index 9a27a93d..378b2fbd 100644
--- a/lib/Service/SocialApiService.php
+++ b/lib/Service/SocialApiService.php
@@ -113,7 +113,7 @@ class SocialApiService {
if ($version >= 4.0) {
// overwrite photo
- $contact['PHOTO'] = "data:" . $imageType . ";base64," . $photo;
+ $contact['PHOTO'] = 'data:' . $imageType . ';base64,' . $photo;
} elseif ($version >= 3.0) {
// add new photo
$imageType = str_replace('image/', '', $imageType);