Passed
Push — master ( e38c1b...d52e8c )
by Nicolaas
03:43
created
src/Api/ShareThisSimpleProvider.php 1 patch
Spacing   +25 added lines, -37 removed lines patch added patch discarded remove patch
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
             $className = str_replace('ShareLink', '', (string) $option);
205 205
             $className = strtolower($className);
206 206
             $icon = '';
207
-            if (! empty($icons[$className])) {
207
+            if (!empty($icons[$className])) {
208 208
                 $urlLink = $icons[$className];
209 209
                 $url = ModuleResourceLoader::resourceURL($urlLink);
210
-                $icon = DBField::create_field('HTMLText', '<img src="' . $url . '" alt="' . $option . '" />');
210
+                $icon = DBField::create_field('HTMLText', '<img src="'.$url.'" alt="'.$option.'" />');
211 211
             }
212
-            $method = 'get' . $option;
212
+            $method = 'get'.$option;
213 213
             $arrayList->push(
214 214
                 ArrayData::create(
215 215
                     [
@@ -241,8 +241,7 @@  discard block
 block discarded – undo
241 241
     {
242 242
         $this->getShareThisArray($customDescription);
243 243
 
244
-        return '' === $this->pageURL ? '' :
245
-            'https://www.facebook.com/sharer/sharer.php?u=' . $this->pageURL;
244
+        return '' === $this->pageURL ? '' : 'https://www.facebook.com/sharer/sharer.php?u='.$this->pageURL;
246 245
     }
247 246
 
248 247
 
@@ -260,8 +259,7 @@  discard block
 block discarded – undo
260 259
     {
261 260
         $this->getShareThisArray($customDescription);
262 261
 
263
-        return '' === $this->pageURL ? '' :
264
-            'https://bsky.app/intent/compose?text=' . ($this->titleFull) . '&url=' . $this->pageURL;
262
+        return '' === $this->pageURL ? '' : 'https://bsky.app/intent/compose?text='.($this->titleFull).'&url='.$this->pageURL;
265 263
     }
266 264
 
267 265
     /**
@@ -278,8 +276,7 @@  discard block
 block discarded – undo
278 276
     {
279 277
         $this->getShareThisArray($customDescription);
280 278
 
281
-        return '' === $this->pageURL ? '' :
282
-            'https://x.com/intent/tweet?text=' . ($this->titleFull) . '&url=' . $this->pageURL;
279
+        return '' === $this->pageURL ? '' : 'https://x.com/intent/tweet?text='.($this->titleFull).'&url='.$this->pageURL;
283 280
     }
284 281
 
285 282
 
@@ -295,8 +292,7 @@  discard block
 block discarded – undo
295 292
     {
296 293
         $this->getShareThisArray($customDescription);
297 294
 
298
-        return '' === $this->pageURL ? '' :
299
-            'https://www.tumblr.com/share/link?url=' . ($this->pageURL) . '&name=' . ($this->title) . '&description=' . ($this->description);
295
+        return '' === $this->pageURL ? '' : 'https://www.tumblr.com/share/link?url='.($this->pageURL).'&name='.($this->title).'&description='.($this->description);
300 296
     }
301 297
 
302 298
 
@@ -310,8 +306,7 @@  discard block
 block discarded – undo
310 306
     {
311 307
         $this->getShareThisArray($customDescription);
312 308
 
313
-        return '' === $this->pageURL ? '' :
314
-            'https://pinterest.com/pin/create/button/?url=' . $this->pageURL . '&description=' . $this->description . '&media=' . $this->media . '';
309
+        return '' === $this->pageURL ? '' : 'https://pinterest.com/pin/create/button/?url='.$this->pageURL.'&description='.$this->description.'&media='.$this->media.'';
315 310
     }
316 311
 
317 312
 
@@ -326,8 +321,7 @@  discard block
 block discarded – undo
326 321
     {
327 322
         $this->getShareThisArray($customDescription);
328 323
 
329
-        return '' === $this->pageURL ? '' :
330
-            'https://reddit.com/submit?url=' . $this->pageURL . '&title=' . $this->title;
324
+        return '' === $this->pageURL ? '' : 'https://reddit.com/submit?url='.$this->pageURL.'&title='.$this->title;
331 325
     }
332 326
 
333 327
     /**
@@ -342,8 +336,7 @@  discard block
 block discarded – undo
342 336
     {
343 337
         $this->getShareThisArray($customDescription);
344 338
 
345
-        return '' === $this->pageURL ? '' :
346
-            'https://www.linkedin.com/shareArticle?mini=true&url=' . $this->pageURL . '&summary=' . $this->titleFull . '';
339
+        return '' === $this->pageURL ? '' : 'https://www.linkedin.com/shareArticle?mini=true&url='.$this->pageURL.'&summary='.$this->titleFull.'';
347 340
     }
348 341
 
349 342
     /**
@@ -355,8 +348,7 @@  discard block
 block discarded – undo
355 348
     {
356 349
         $this->getShareThisArray($customDescription);
357 350
 
358
-        return '' === $this->pageURL ? '' :
359
-            'mailto:?subject=' . $this->title . ': ' . $this->pageURL  . '&body=' . $this->pageURL;
351
+        return '' === $this->pageURL ? '' : 'mailto:?subject='.$this->title.': '.$this->pageURL.'&body='.$this->pageURL;
360 352
     }
361 353
 
362 354
     /**
@@ -368,8 +360,7 @@  discard block
 block discarded – undo
368 360
     {
369 361
         $this->getShareThisArray($customDescription);
370 362
 
371
-        return '' === $this->pageURL ? '' :
372
-            'sms:?body=' . ($this->titleFull . ' ' . $this->pageURL);
363
+        return '' === $this->pageURL ? '' : 'sms:?body='.($this->titleFull.' '.$this->pageURL);
373 364
     }
374 365
     /**
375 366
      * Generate a URL to share this content on WhatsApp.
@@ -380,8 +371,7 @@  discard block
 block discarded – undo
380 371
     {
381 372
         $this->getShareThisArray($customDescription);
382 373
 
383
-        return '' === $this->pageURL ? '' :
384
-            'https://api.whatsapp.com/send?text=' . ($this->titleFull . ' ' . $this->pageURL);
374
+        return '' === $this->pageURL ? '' : 'https://api.whatsapp.com/send?text='.($this->titleFull.' '.$this->pageURL);
385 375
     }
386 376
 
387 377
     /**
@@ -393,8 +383,7 @@  discard block
 block discarded – undo
393 383
     {
394 384
         $this->getShareThisArray($customDescription);
395 385
 
396
-        return '' === $this->pageURL ? '' :
397
-            'https://www.snapchat.com/share?url=' . $this->pageURL . '&text=' . $this->titleFull;
386
+        return '' === $this->pageURL ? '' : 'https://www.snapchat.com/share?url='.$this->pageURL.'&text='.$this->titleFull;
398 387
     }
399 388
 
400 389
 
@@ -408,8 +397,7 @@  discard block
 block discarded – undo
408 397
     {
409 398
         $this->getShareThisArray($customDescription);
410 399
 
411
-        return '' === $this->pageURL ? '' :
412
-            'https://signal.me/#p/' . ($this->titleFull . ' ' . $this->pageURL);
400
+        return '' === $this->pageURL ? '' : 'https://signal.me/#p/'.($this->titleFull.' '.$this->pageURL);
413 401
     }
414 402
 
415 403
 
@@ -425,9 +413,9 @@  discard block
 block discarded – undo
425 413
             if ($image && $image->exists()) {
426 414
                 $imageTitle = $useImageTitle ? $image->Title : $this->object->Title;
427 415
 
428
-                return 'https://pinterest.com/pin/create/button/?url=' . ($this->object->AbsoluteLink()) . '&amp;'
429
-                    . 'description=' . ($imageTitle) . '&amp;'
430
-                    . 'media=' . ($image->AbsoluteLink());
416
+                return 'https://pinterest.com/pin/create/button/?url='.($this->object->AbsoluteLink()).'&amp;'
417
+                    . 'description='.($imageTitle).'&amp;'
418
+                    . 'media='.($image->AbsoluteLink());
431 419
             }
432 420
         }
433 421
 
@@ -440,8 +428,8 @@  discard block
 block discarded – undo
440 428
      */
441 429
     public function getShareThisArray(?string $customDescription = ''): array
442 430
     {
443
-        $cacheKey = $this->object->ID . '_' . preg_replace('#[^A-Za-z0-9]#', '_', $customDescription);
444
-        if (! isset(self::$cacheGetShareThisArray[$cacheKey])) {
431
+        $cacheKey = $this->object->ID.'_'.preg_replace('#[^A-Za-z0-9]#', '_', $customDescription);
432
+        if (!isset(self::$cacheGetShareThisArray[$cacheKey])) {
445 433
             //1. link
446 434
             $this->link = $this->shareThisLinkField();
447 435
 
@@ -454,8 +442,8 @@  discard block
 block discarded – undo
454 442
             $this->hashTags = $this->getValuesFromArrayToString('hashTagsArray', 'hash_tags', '#');
455 443
             $this->mentions = $this->getValuesFromArrayToString('mentionsArray', 'mentions');
456 444
             $this->vias = $this->getValuesFromArrayToString('viasArray', 'vias');
457
-            $this->titleFull = trim($this->mentions . ' ' . $this->title . ' ' . $this->hashTags . ' ' . $this->vias);
458
-            $this->descriptionFull = trim($this->mentions . ' ' . $this->description . ' ' . $this->hashTags . ' ' . $this->vias);
445
+            $this->titleFull = trim($this->mentions.' '.$this->title.' '.$this->hashTags.' '.$this->vias);
446
+            $this->descriptionFull = trim($this->mentions.' '.$this->description.' '.$this->hashTags.' '.$this->vias);
459 447
 
460 448
             //return ...
461 449
             self::$cacheGetShareThisArray[$cacheKey] = [
@@ -484,7 +472,7 @@  discard block
 block discarded – undo
484 472
         $a = empty($this->{$variable}) ? $this->Config()->get($staticVariable) : $this->{$variable};
485 473
         $str = '';
486 474
         if (is_array($a) && count($a)) {
487
-            $str = $prepender . implode(' ' . $prepender, $a);
475
+            $str = $prepender.implode(' '.$prepender, $a);
488 476
         }
489 477
 
490 478
         return trim($str);
@@ -528,7 +516,7 @@  discard block
 block discarded – undo
528 516
         if (is_array($imageMethods) && count($imageMethods)) {
529 517
             foreach ($imageMethods as $imageMethod) {
530 518
                 if ($this->object->hasMethod($imageMethod)) {
531
-                    $imageField = $imageMethod . 'ID';
519
+                    $imageField = $imageMethod.'ID';
532 520
                     if ($this->{$imageField}) {
533 521
                         $image = $this->object->{$imageMethod}();
534 522
                         if ($image && $image->exists()) {
@@ -551,7 +539,7 @@  discard block
 block discarded – undo
551 539
         } else {
552 540
             $description = '';
553 541
             $descriptionMethod = $this->descriptionMethod;
554
-            if (! $descriptionMethod) {
542
+            if (!$descriptionMethod) {
555 543
                 $descriptionMethod = Config::inst()->get(
556 544
                     'ShareThisSimpleProvider',
557 545
                     'description_method'
Please login to merge, or discard this patch.