Adjust coding style
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
5f274b5624
commit
1f2e3c9a4f
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
]);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
]);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -60,15 +60,15 @@ class DiasporaProviderTest extends TestCase {
|
|||
public function dataProviderSupportsContact() {
|
||||
$contactWithSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "diaspora"],
|
||||
["value" => "two", "type" => "diaspora"]
|
||||
['value' => 'one', 'type' => 'diaspora'],
|
||||
['value' => 'two', 'type' => 'diaspora']
|
||||
]
|
||||
];
|
||||
|
||||
$contactWithoutSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "social2"],
|
||||
["value" => "two", "type" => "social1"]
|
||||
['value' => 'one', 'type' => 'social2'],
|
||||
['value' => 'two', 'type' => 'social1']
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -89,25 +89,25 @@ class DiasporaProviderTest extends TestCase {
|
|||
public function dataProviderGetImageUrls() {
|
||||
$contactWithSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one@two", "type" => "diaspora"],
|
||||
["value" => "two@three", "type" => "diaspora"]
|
||||
['value' => 'one@two', 'type' => 'diaspora'],
|
||||
['value' => 'two@three', 'type' => 'diaspora']
|
||||
]
|
||||
];
|
||||
$contactWithSocialUrls = [
|
||||
"https://two/public/one.atom",
|
||||
"https://three/public/two.atom"
|
||||
'https://two/public/one.atom',
|
||||
'https://three/public/two.atom'
|
||||
];
|
||||
$contactWithSocialHtml = array_map(function ($url) {
|
||||
return "<logo>".$url."-small-avatar.jpg</logo>";
|
||||
return '<logo>'.$url.'-small-avatar.jpg</logo>';
|
||||
}, $contactWithSocialUrls);
|
||||
$contactWithSocialImg = array_map(function ($url) {
|
||||
return $url."-large-avatar.jpg";
|
||||
return $url.'-large-avatar.jpg';
|
||||
}, $contactWithSocialUrls);
|
||||
|
||||
$contactWithoutSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "social2"],
|
||||
["value" => "two", "type" => "social1"]
|
||||
['value' => 'one', 'type' => 'social2'],
|
||||
['value' => 'two', 'type' => 'social1']
|
||||
]
|
||||
];
|
||||
$contactWithoutSocialUrls = [];
|
||||
|
@ -157,14 +157,14 @@ class DiasporaProviderTest extends TestCase {
|
|||
public function testGetImageUrlLoop() {
|
||||
$contact = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one@two", "type" => "diaspora"],
|
||||
['value' => 'one@two', 'type' => 'diaspora'],
|
||||
]
|
||||
];
|
||||
$url1 = "https://two/public/one.atom";
|
||||
$url2 = "https://four/public/three.atom";
|
||||
$url1 = 'https://two/public/one.atom';
|
||||
$url2 = 'https://four/public/three.atom';
|
||||
$html1 = '<link rel="alternate" href="'.$url2.'" />';
|
||||
$html2 = "<logo>".$url2."-small-avatar.jpg</logo>";
|
||||
$img = $url2."-large-avatar.jpg";
|
||||
$html2 = '<logo>'.$url2.'-small-avatar.jpg</logo>';
|
||||
$img = $url2.'-large-avatar.jpg';
|
||||
|
||||
$this->response
|
||||
->method('getBody')
|
||||
|
|
|
@ -60,15 +60,15 @@ class FacebookProviderTest extends TestCase {
|
|||
public function dataProviderSupportsContact() {
|
||||
$contactWithSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "123124123", "type" => "facebook"],
|
||||
["value" => "23426523423", "type" => "facebook"]
|
||||
['value' => '123124123', 'type' => 'facebook'],
|
||||
['value' => '23426523423', 'type' => 'facebook']
|
||||
]
|
||||
];
|
||||
|
||||
$contactWithoutSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "social2"],
|
||||
["value" => "two", "type" => "social1"]
|
||||
['value' => 'one', 'type' => 'social2'],
|
||||
['value' => 'two', 'type' => 'social1']
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -89,19 +89,19 @@ class FacebookProviderTest extends TestCase {
|
|||
public function dataProviderGetImageUrls() {
|
||||
$contactWithSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "123456", "type" => "facebook"],
|
||||
["value" => "7891011", "type" => "facebook"]
|
||||
['value' => '123456', 'type' => 'facebook'],
|
||||
['value' => '7891011', 'type' => 'facebook']
|
||||
]
|
||||
];
|
||||
$contactWithSocialUrls = [
|
||||
"https://graph.facebook.com/123456/picture?width=720",
|
||||
"https://graph.facebook.com/7891011/picture?width=720",
|
||||
'https://graph.facebook.com/123456/picture?width=720',
|
||||
'https://graph.facebook.com/7891011/picture?width=720',
|
||||
];
|
||||
|
||||
$contactWithoutSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "social2"],
|
||||
["value" => "two", "type" => "social1"]
|
||||
['value' => 'one', 'type' => 'social2'],
|
||||
['value' => 'two', 'type' => 'social1']
|
||||
]
|
||||
];
|
||||
$contactWithoutSocialUrls = [];
|
||||
|
@ -129,11 +129,11 @@ class FacebookProviderTest extends TestCase {
|
|||
public function testGetImageUrlLookup() {
|
||||
$contact = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "username1", "type" => "facebook"],
|
||||
['value' => 'username1', 'type' => 'facebook'],
|
||||
]
|
||||
];
|
||||
$url1 = "https://facebook.com/username1";
|
||||
$url2 = "https://graph.facebook.com/1234567/picture?width=720";
|
||||
$url1 = 'https://facebook.com/username1';
|
||||
$url2 = 'https://graph.facebook.com/1234567/picture?width=720';
|
||||
$html1 = '"entity_id":"1234567"';
|
||||
|
||||
$this->response
|
||||
|
|
|
@ -38,11 +38,11 @@ class GravatarProviderTest extends TestCase {
|
|||
|
||||
public function dataProviderSupportsContact() {
|
||||
$contactWithEmail = [
|
||||
'EMAIL' => [["value" => "one"], ["value" => "two"]]
|
||||
'EMAIL' => [['value' => 'one'], ['value' => 'two']]
|
||||
];
|
||||
|
||||
$contactWithoutEmail = [
|
||||
'PHONE' => [["value" => "one"], ["value" => "two"]]
|
||||
'PHONE' => [['value' => 'one'], ["value" => "two"]]
|
||||
];
|
||||
|
||||
return [
|
||||
|
@ -67,9 +67,9 @@ class GravatarProviderTest extends TestCase {
|
|||
$contactWithoutEmail = [
|
||||
'PHONE' => [["value" => "one"], ["value" => "two"]]
|
||||
];
|
||||
|
||||
|
||||
$urls = [];
|
||||
|
||||
|
||||
foreach ($contactWithEmail['EMAIL'] as $email) {
|
||||
$hash = md5(strtolower(trim($email['value'])));
|
||||
$recipe = 'https://www.gravatar.com/avatar/{hash}?s=720&d=404';
|
||||
|
|
|
@ -39,15 +39,15 @@ class TumblrProviderTest extends TestCase {
|
|||
public function dataProviderSupportsContact() {
|
||||
$contactWithSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "username1", "type" => "tumblr"],
|
||||
["value" => "username2", "type" => "tumblr"]
|
||||
['value' => 'username1', 'type' => 'tumblr'],
|
||||
['value' => 'username2', 'type' => 'tumblr']
|
||||
]
|
||||
];
|
||||
|
||||
$contactWithoutSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "social2"],
|
||||
["value" => "two", "type" => "social1"]
|
||||
['value' => 'one', 'type' => 'social2'],
|
||||
['value' => 'two', 'type' => 'social1']
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -68,20 +68,20 @@ class TumblrProviderTest extends TestCase {
|
|||
public function dataProviderGetImageUrls() {
|
||||
$contactWithSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "username1", "type" => "tumblr"],
|
||||
["value" => "username2", "type" => "tumblr"]
|
||||
['value' => 'username1', 'type' => 'tumblr'],
|
||||
['value' => 'username2', 'type' => 'tumblr']
|
||||
]
|
||||
];
|
||||
|
||||
$contactWithoutSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "social2"],
|
||||
["value" => "two", "type" => "social1"]
|
||||
['value' => 'one', 'type' => 'social2'],
|
||||
['value' => 'two', 'type' => 'social1']
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($contactWithSocial['X-SOCIALPROFILE'] as $profile) {
|
||||
$urls[] = "https://api.tumblr.com/v2/blog/".$profile['value']."/avatar/512";
|
||||
$urls[] = 'https://api.tumblr.com/v2/blog/'.$profile['value'].'/avatar/512';
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
@ -66,15 +66,15 @@ class TwitterProviderTest extends TestCase {
|
|||
public function dataProviderSupportsContact() {
|
||||
$contactWithSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "username1", "type" => "twitter"],
|
||||
["value" => "username2", "type" => "twitter"]
|
||||
['value' => 'username1', 'type' => 'twitter'],
|
||||
['value' => 'username2', 'type' => 'twitter']
|
||||
]
|
||||
];
|
||||
|
||||
$contactWithoutSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "social2"],
|
||||
["value" => "two", "type" => "social1"]
|
||||
['value' => 'one', 'type' => 'social2'],
|
||||
['value' => 'two', 'type' => 'social1']
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -95,27 +95,27 @@ class TwitterProviderTest extends TestCase {
|
|||
public function dataProviderGetImageUrls() {
|
||||
$contactWithSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "https://twitter.com/username1", "type" => "twitter"],
|
||||
["value" => "https://twitter.com/@username2", "type" => "twitter"]
|
||||
['value' => 'https://twitter.com/username1', 'type' => 'twitter'],
|
||||
['value' => 'https://twitter.com/@username2', 'type' => 'twitter']
|
||||
]
|
||||
];
|
||||
$contactWithSocialUrls = [
|
||||
"https://twitter.com/username1",
|
||||
"https://twitter.com/username2",
|
||||
'https://twitter.com/username1',
|
||||
'https://twitter.com/username2',
|
||||
];
|
||||
$contactWithSocialHtml = [
|
||||
'<html><img src="./profile_images/username1_normal.jpg" /></html>',
|
||||
'<html><img src="./profile_images/username2_normal.jpg" /></html>',
|
||||
];
|
||||
$contactWithSocialImgs = [
|
||||
"./profile_images/username1_400x400.jpg",
|
||||
"./profile_images/username2_400x400.jpg"
|
||||
'./profile_images/username1_400x400.jpg',
|
||||
'./profile_images/username2_400x400.jpg'
|
||||
];
|
||||
|
||||
$contactWithoutSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "social2"],
|
||||
["value" => "two", "type" => "social1"]
|
||||
['value' => 'one', 'type' => 'social2'],
|
||||
['value' => 'two', 'type' => 'social1']
|
||||
]
|
||||
];
|
||||
$contactWithoutSocialUrls = [];
|
||||
|
@ -143,10 +143,10 @@ class TwitterProviderTest extends TestCase {
|
|||
*/
|
||||
public function testGetImageUrls($contact, $htmls, $urls, $imgs) {
|
||||
if (count($urls)) {
|
||||
$this->response->method("getBody")->willReturnOnConsecutiveCalls(...$htmls);
|
||||
$this->response->method('getBody')->willReturnOnConsecutiveCalls(...$htmls);
|
||||
$this->client
|
||||
->expects($this->exactly(count($urls)))
|
||||
->method("get")
|
||||
->method('get')
|
||||
->withConsecutive(...array_map(function ($a) {
|
||||
return [$a];
|
||||
}, $urls))
|
||||
|
|
|
@ -60,14 +60,14 @@ class XingProviderTest extends TestCase {
|
|||
public function dataProviderSupportsContact() {
|
||||
$contactWithSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "username1", "type" => "xing"],
|
||||
["value" => "username2", "type" => "xing"]
|
||||
['value' => 'username1', 'type' => 'xing'],
|
||||
['value' => 'username2', 'type' => 'xing']
|
||||
]
|
||||
];
|
||||
|
||||
$contactWithoutSocial = [
|
||||
'X-SOCIALPROFILE' => [
|
||||
["value" => "one", "type" => "social2"],
|
||||
['value' => 'one', "type" => "social2"],
|
||||
["value" => "two", "type" => "social1"]
|
||||
]
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue