Passed
Push — master ( e1cdef...b5d003 )
by Nicolaas
09:26
created
src/Api/ShareThisSimpleProvider.php 1 patch
Spacing   +22 added lines, -34 removed lines patch added patch discarded remove patch
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
             $className = str_replace('ShareLink', '', (string) $option);
196 196
             $className = strtolower($className);
197 197
             $icon = '';
198
-            if (! empty($icons[$className])) {
198
+            if (!empty($icons[$className])) {
199 199
                 $urlLink = $icons[$className];
200 200
                 $url = ModuleResourceLoader::resourceURL($urlLink);
201
-                $icon = DBField::create_field('HTMLText', '<img src="' . $url . '" alt="' . $option . '" />');
201
+                $icon = DBField::create_field('HTMLText', '<img src="'.$url.'" alt="'.$option.'" />');
202 202
             }
203
-            $method = 'get' . $option;
203
+            $method = 'get'.$option;
204 204
             $arrayList->push(
205 205
                 ArrayData::create(
206 206
                     [
@@ -232,8 +232,7 @@  discard block
 block discarded – undo
232 232
     {
233 233
         $this->getShareThisArray($customDescription);
234 234
 
235
-        return '' === $this->pageURL ? '' :
236
-            'https://www.facebook.com/sharer/sharer.php?u=' . $this->pageURL;
235
+        return '' === $this->pageURL ? '' : 'https://www.facebook.com/sharer/sharer.php?u='.$this->pageURL;
237 236
     }
238 237
 
239 238
 
@@ -251,8 +250,7 @@  discard block
 block discarded – undo
251 250
     {
252 251
         $this->getShareThisArray($customDescription);
253 252
 
254
-        return '' === $this->pageURL ? '' :
255
-            'https://bsky.app/intent/compose?text=' . ($this->titleFull) . '&url=' . $this->pageURL;
253
+        return '' === $this->pageURL ? '' : 'https://bsky.app/intent/compose?text='.($this->titleFull).'&url='.$this->pageURL;
256 254
     }
257 255
 
258 256
     /**
@@ -269,8 +267,7 @@  discard block
 block discarded – undo
269 267
     {
270 268
         $this->getShareThisArray($customDescription);
271 269
 
272
-        return '' === $this->pageURL ? '' :
273
-            'https://x.com/intent/tweet?text=' . ($this->titleFull) . '&url=' . $this->pageURL;
270
+        return '' === $this->pageURL ? '' : 'https://x.com/intent/tweet?text='.($this->titleFull).'&url='.$this->pageURL;
274 271
     }
275 272
 
276 273
 
@@ -286,8 +283,7 @@  discard block
 block discarded – undo
286 283
     {
287 284
         $this->getShareThisArray($customDescription);
288 285
 
289
-        return '' === $this->pageURL ? '' :
290
-            'https://www.tumblr.com/share/link?url=' . ($this->pageURL) . '&name=' . ($this->title) . '&description=' . ($this->description);
286
+        return '' === $this->pageURL ? '' : 'https://www.tumblr.com/share/link?url='.($this->pageURL).'&name='.($this->title).'&description='.($this->description);
291 287
     }
292 288
 
293 289
 
@@ -301,8 +297,7 @@  discard block
 block discarded – undo
301 297
     {
302 298
         $this->getShareThisArray($customDescription);
303 299
 
304
-        return '' === $this->pageURL ? '' :
305
-            'https://pinterest.com/pin/create/button/?url=' . $this->pageURL . '&description=' . $this->description . '&media=' . $this->media . '';
300
+        return '' === $this->pageURL ? '' : 'https://pinterest.com/pin/create/button/?url='.$this->pageURL.'&description='.$this->description.'&media='.$this->media.'';
306 301
     }
307 302
 
308 303
 
@@ -317,8 +312,7 @@  discard block
 block discarded – undo
317 312
     {
318 313
         $this->getShareThisArray($customDescription);
319 314
 
320
-        return '' === $this->pageURL ? '' :
321
-            'https://reddit.com/submit?url=' . $this->pageURL . '&title=' . $this->title;
315
+        return '' === $this->pageURL ? '' : 'https://reddit.com/submit?url='.$this->pageURL.'&title='.$this->title;
322 316
     }
323 317
 
324 318
     /**
@@ -333,8 +327,7 @@  discard block
 block discarded – undo
333 327
     {
334 328
         $this->getShareThisArray($customDescription);
335 329
 
336
-        return '' === $this->pageURL ? '' :
337
-            'https://www.linkedin.com/shareArticle?mini=true&url=' . $this->pageURL . '&summary=' . $this->titleFull . '';
330
+        return '' === $this->pageURL ? '' : 'https://www.linkedin.com/shareArticle?mini=true&url='.$this->pageURL.'&summary='.$this->titleFull.'';
338 331
     }
339 332
 
340 333
     /**
@@ -346,8 +339,7 @@  discard block
 block discarded – undo
346 339
     {
347 340
         $this->getShareThisArray($customDescription);
348 341
 
349
-        return '' === $this->pageURL ? '' :
350
-            'mailto:?subject=' . $this->title . '&body=' . $this->pageURL;
342
+        return '' === $this->pageURL ? '' : 'mailto:?subject='.$this->title.'&body='.$this->pageURL;
351 343
     }
352 344
 
353 345
     /**
@@ -359,8 +351,7 @@  discard block
 block discarded – undo
359 351
     {
360 352
         $this->getShareThisArray($customDescription);
361 353
 
362
-        return '' === $this->pageURL ? '' :
363
-            'sms:?body=' . ($this->titleFull . urlencode(' ') . $this->pageURL);
354
+        return '' === $this->pageURL ? '' : 'sms:?body='.($this->titleFull.urlencode(' ').$this->pageURL);
364 355
     }
365 356
     /**
366 357
      * Generate a URL to share this content on WhatsApp.
@@ -371,8 +362,7 @@  discard block
 block discarded – undo
371 362
     {
372 363
         $this->getShareThisArray($customDescription);
373 364
 
374
-        return '' === $this->pageURL ? '' :
375
-            'https://api.whatsapp.com/send?text=' . ($this->titleFull . urlencode(' ') . $this->pageURL);
365
+        return '' === $this->pageURL ? '' : 'https://api.whatsapp.com/send?text='.($this->titleFull.urlencode(' ').$this->pageURL);
376 366
     }
377 367
 
378 368
     /**
@@ -384,8 +374,7 @@  discard block
 block discarded – undo
384 374
     {
385 375
         $this->getShareThisArray($customDescription);
386 376
 
387
-        return '' === $this->pageURL ? '' :
388
-            'https://www.snapchat.com/share?url=' . $this->pageURL . '&text=' . $this->titleFull;
377
+        return '' === $this->pageURL ? '' : 'https://www.snapchat.com/share?url='.$this->pageURL.'&text='.$this->titleFull;
389 378
     }
390 379
 
391 380
 
@@ -399,8 +388,7 @@  discard block
 block discarded – undo
399 388
     {
400 389
         $this->getShareThisArray($customDescription);
401 390
 
402
-        return '' === $this->pageURL ? '' :
403
-            'https://signal.me/#p/' . ($this->titleFull . urlencode(' ') . $this->pageURL);
391
+        return '' === $this->pageURL ? '' : 'https://signal.me/#p/'.($this->titleFull.urlencode(' ').$this->pageURL);
404 392
     }
405 393
 
406 394
 
@@ -415,8 +403,8 @@  discard block
 block discarded – undo
415 403
      */
416 404
     public function getShareThisArray(?string $customDescription = ''): array
417 405
     {
418
-        $cacheKey = $this->object->ID . '_' . preg_replace('#[^A-Za-z0-9]#', '_', $customDescription);
419
-        if (! isset(self::$cacheGetShareThisArray[$cacheKey])) {
406
+        $cacheKey = $this->object->ID.'_'.preg_replace('#[^A-Za-z0-9]#', '_', $customDescription);
407
+        if (!isset(self::$cacheGetShareThisArray[$cacheKey])) {
420 408
             //1. link
421 409
             $this->link = $this->shareThisLinkField();
422 410
 
@@ -429,8 +417,8 @@  discard block
 block discarded – undo
429 417
             $this->hashTags = $this->getValuesFromArrayToString('hashTagsArray', 'hash_tags', '#');
430 418
             $this->mentions = $this->getValuesFromArrayToString('mentionsArray', 'mentions');
431 419
             $this->vias = $this->getValuesFromArrayToString('viasArray', 'vias');
432
-            $this->titleFull = trim($this->mentions . ' ' . $this->title . ' ' . $this->hashTags . ' ' . $this->vias);
433
-            $this->descriptionFull = trim($this->mentions . ' ' . $this->description . ' ' . $this->hashTags . ' ' . $this->vias);
420
+            $this->titleFull = trim($this->mentions.' '.$this->title.' '.$this->hashTags.' '.$this->vias);
421
+            $this->descriptionFull = trim($this->mentions.' '.$this->description.' '.$this->hashTags.' '.$this->vias);
434 422
 
435 423
             //return ...
436 424
             self::$cacheGetShareThisArray[$cacheKey] = [
@@ -459,7 +447,7 @@  discard block
 block discarded – undo
459 447
         $a = empty($this->{$variable}) ? $this->Config()->get($staticVariable) : $this->{$variable};
460 448
         $str = '';
461 449
         if (is_array($a) && count($a)) {
462
-            $str = $prepender . implode(' ' . $prepender, $a);
450
+            $str = $prepender.implode(' '.$prepender, $a);
463 451
         }
464 452
 
465 453
         return trim($str);
@@ -503,7 +491,7 @@  discard block
 block discarded – undo
503 491
         if (is_array($imageMethods) && count($imageMethods)) {
504 492
             foreach ($imageMethods as $imageMethod) {
505 493
                 if ($this->object->hasMethod($imageMethod)) {
506
-                    $imageField = $imageMethod . 'ID';
494
+                    $imageField = $imageMethod.'ID';
507 495
                     if ($this->{$imageField}) {
508 496
                         $image = $this->object->{$imageMethod}();
509 497
                         if ($image && $image->exists()) {
@@ -526,7 +514,7 @@  discard block
 block discarded – undo
526 514
         } else {
527 515
             $description = '';
528 516
             $descriptionMethod = $this->descriptionMethod;
529
-            if (! $descriptionMethod) {
517
+            if (!$descriptionMethod) {
530 518
                 $descriptionMethod = Config::inst()->get(
531 519
                     'ShareThisSimpleProvider',
532 520
                     'description_method'
Please login to merge, or discard this patch.