Passed
Push — master ( d52e8c...6f57e9 )
by Nicolaas
03:52
created
src/Api/ShareThisSimpleProvider.php 1 patch
Spacing   +22 added lines, -34 removed lines patch added patch discarded remove patch
@@ -200,12 +200,12 @@  discard block
 block discarded – undo
200 200
             $className = str_replace('ShareLink', '', (string) $option);
201 201
             $className = strtolower($className);
202 202
             $icon = '';
203
-            if (! empty($icons[$className])) {
203
+            if (!empty($icons[$className])) {
204 204
                 $urlLink = $icons[$className];
205 205
                 $url = ModuleResourceLoader::resourceURL($urlLink);
206
-                $icon = DBField::create_field('HTMLText', '<img src="' . $url . '" alt="' . $option . '" />');
206
+                $icon = DBField::create_field('HTMLText', '<img src="'.$url.'" alt="'.$option.'" />');
207 207
             }
208
-            $method = 'get' . $option;
208
+            $method = 'get'.$option;
209 209
             $arrayList->push(
210 210
                 ArrayData::create(
211 211
                     [
@@ -237,8 +237,7 @@  discard block
 block discarded – undo
237 237
     {
238 238
         $this->getShareThisArray($customDescription);
239 239
 
240
-        return '' === $this->pageURL ? '' :
241
-            'https://www.facebook.com/sharer/sharer.php?u=' . $this->pageURL;
240
+        return '' === $this->pageURL ? '' : 'https://www.facebook.com/sharer/sharer.php?u='.$this->pageURL;
242 241
     }
243 242
 
244 243
 
@@ -256,8 +255,7 @@  discard block
 block discarded – undo
256 255
     {
257 256
         $this->getShareThisArray($customDescription);
258 257
 
259
-        return '' === $this->pageURL ? '' :
260
-            'https://bsky.app/intent/compose?text=' . ($this->titleFull) . '&url=' . $this->pageURL;
258
+        return '' === $this->pageURL ? '' : 'https://bsky.app/intent/compose?text='.($this->titleFull).'&url='.$this->pageURL;
261 259
     }
262 260
 
263 261
     /**
@@ -274,8 +272,7 @@  discard block
 block discarded – undo
274 272
     {
275 273
         $this->getShareThisArray($customDescription);
276 274
 
277
-        return '' === $this->pageURL ? '' :
278
-            'https://x.com/intent/tweet?text=' . ($this->titleFull) . '&url=' . $this->pageURL;
275
+        return '' === $this->pageURL ? '' : 'https://x.com/intent/tweet?text='.($this->titleFull).'&url='.$this->pageURL;
279 276
     }
280 277
 
281 278
 
@@ -291,8 +288,7 @@  discard block
 block discarded – undo
291 288
     {
292 289
         $this->getShareThisArray($customDescription);
293 290
 
294
-        return '' === $this->pageURL ? '' :
295
-            'https://www.tumblr.com/share/link?url=' . ($this->pageURL) . '&name=' . ($this->title) . '&description=' . ($this->description);
291
+        return '' === $this->pageURL ? '' : 'https://www.tumblr.com/share/link?url='.($this->pageURL).'&name='.($this->title).'&description='.($this->description);
296 292
     }
297 293
 
298 294
 
@@ -306,8 +302,7 @@  discard block
 block discarded – undo
306 302
     {
307 303
         $this->getShareThisArray($customDescription);
308 304
 
309
-        return '' === $this->pageURL ? '' :
310
-            'https://pinterest.com/pin/create/button/?url=' . $this->pageURL . '&description=' . $this->description . '&media=' . $this->media . '';
305
+        return '' === $this->pageURL ? '' : 'https://pinterest.com/pin/create/button/?url='.$this->pageURL.'&description='.$this->description.'&media='.$this->media.'';
311 306
     }
312 307
 
313 308
 
@@ -322,8 +317,7 @@  discard block
 block discarded – undo
322 317
     {
323 318
         $this->getShareThisArray($customDescription);
324 319
 
325
-        return '' === $this->pageURL ? '' :
326
-            'https://reddit.com/submit?url=' . $this->pageURL . '&title=' . $this->title;
320
+        return '' === $this->pageURL ? '' : 'https://reddit.com/submit?url='.$this->pageURL.'&title='.$this->title;
327 321
     }
328 322
 
329 323
     /**
@@ -338,8 +332,7 @@  discard block
 block discarded – undo
338 332
     {
339 333
         $this->getShareThisArray($customDescription);
340 334
 
341
-        return '' === $this->pageURL ? '' :
342
-            'https://www.linkedin.com/shareArticle?mini=true&url=' . $this->pageURL . '&summary=' . $this->titleFull . '';
335
+        return '' === $this->pageURL ? '' : 'https://www.linkedin.com/shareArticle?mini=true&url='.$this->pageURL.'&summary='.$this->titleFull.'';
343 336
     }
344 337
 
345 338
     /**
@@ -351,8 +344,7 @@  discard block
 block discarded – undo
351 344
     {
352 345
         $this->getShareThisArray($customDescription);
353 346
 
354
-        return '' === $this->pageURL ? '' :
355
-            'mailto:?subject=' . $this->title . ': ' . $this->pageURL  . '&body=' . $this->pageURL;
347
+        return '' === $this->pageURL ? '' : 'mailto:?subject='.$this->title.': '.$this->pageURL.'&body='.$this->pageURL;
356 348
     }
357 349
 
358 350
     /**
@@ -364,8 +356,7 @@  discard block
 block discarded – undo
364 356
     {
365 357
         $this->getShareThisArray($customDescription);
366 358
 
367
-        return '' === $this->pageURL ? '' :
368
-            'sms:?body=' . ($this->titleFull . ' ' . $this->pageURL);
359
+        return '' === $this->pageURL ? '' : 'sms:?body='.($this->titleFull.' '.$this->pageURL);
369 360
     }
370 361
     /**
371 362
      * Generate a URL to share this content on WhatsApp.
@@ -376,8 +367,7 @@  discard block
 block discarded – undo
376 367
     {
377 368
         $this->getShareThisArray($customDescription);
378 369
 
379
-        return '' === $this->pageURL ? '' :
380
-            'https://api.whatsapp.com/send?text=' . ($this->titleFull . ' ' . $this->pageURL);
370
+        return '' === $this->pageURL ? '' : 'https://api.whatsapp.com/send?text='.($this->titleFull.' '.$this->pageURL);
381 371
     }
382 372
 
383 373
     /**
@@ -389,8 +379,7 @@  discard block
 block discarded – undo
389 379
     {
390 380
         $this->getShareThisArray($customDescription);
391 381
 
392
-        return '' === $this->pageURL ? '' :
393
-            'https://www.snapchat.com/share?url=' . $this->pageURL . '&text=' . $this->titleFull;
382
+        return '' === $this->pageURL ? '' : 'https://www.snapchat.com/share?url='.$this->pageURL.'&text='.$this->titleFull;
394 383
     }
395 384
 
396 385
 
@@ -404,8 +393,7 @@  discard block
 block discarded – undo
404 393
     {
405 394
         $this->getShareThisArray($customDescription);
406 395
 
407
-        return '' === $this->pageURL ? '' :
408
-            'https://signal.me/#p/' . ($this->titleFull . ' ' . $this->pageURL);
396
+        return '' === $this->pageURL ? '' : 'https://signal.me/#p/'.($this->titleFull.' '.$this->pageURL);
409 397
     }
410 398
 
411 399
 
@@ -420,8 +408,8 @@  discard block
 block discarded – undo
420 408
      */
421 409
     public function getShareThisArray(?string $customDescription = ''): array
422 410
     {
423
-        $cacheKey = $this->object->ID . '_' . preg_replace('#[^A-Za-z0-9]#', '_', $customDescription);
424
-        if (! isset(self::$cacheGetShareThisArray[$cacheKey])) {
411
+        $cacheKey = $this->object->ID.'_'.preg_replace('#[^A-Za-z0-9]#', '_', $customDescription);
412
+        if (!isset(self::$cacheGetShareThisArray[$cacheKey])) {
425 413
             //1. link
426 414
             $this->link = $this->shareThisLinkField();
427 415
 
@@ -434,8 +422,8 @@  discard block
 block discarded – undo
434 422
             $this->hashTags = $this->getValuesFromArrayToString('hashTagsArray', 'hash_tags', '#');
435 423
             $this->mentions = $this->getValuesFromArrayToString('mentionsArray', 'mentions');
436 424
             $this->vias = $this->getValuesFromArrayToString('viasArray', 'vias');
437
-            $this->titleFull = trim($this->mentions . ' ' . $this->title . ' ' . $this->hashTags . ' ' . $this->vias);
438
-            $this->descriptionFull = trim($this->mentions . ' ' . $this->description . ' ' . $this->hashTags . ' ' . $this->vias);
425
+            $this->titleFull = trim($this->mentions.' '.$this->title.' '.$this->hashTags.' '.$this->vias);
426
+            $this->descriptionFull = trim($this->mentions.' '.$this->description.' '.$this->hashTags.' '.$this->vias);
439 427
 
440 428
             //return ...
441 429
             self::$cacheGetShareThisArray[$cacheKey] = [
@@ -464,7 +452,7 @@  discard block
 block discarded – undo
464 452
         $a = empty($this->{$variable}) ? $this->Config()->get($staticVariable) : $this->{$variable};
465 453
         $str = '';
466 454
         if (is_array($a) && count($a)) {
467
-            $str = $prepender . implode(' ' . $prepender, $a);
455
+            $str = $prepender.implode(' '.$prepender, $a);
468 456
         }
469 457
 
470 458
         return trim($str);
@@ -508,7 +496,7 @@  discard block
 block discarded – undo
508 496
         if (is_array($imageMethods) && count($imageMethods)) {
509 497
             foreach ($imageMethods as $imageMethod) {
510 498
                 if ($this->object->hasMethod($imageMethod)) {
511
-                    $imageField = $imageMethod . 'ID';
499
+                    $imageField = $imageMethod.'ID';
512 500
                     if ($this->{$imageField}) {
513 501
                         $image = $this->object->{$imageMethod}();
514 502
                         if ($image && $image->exists()) {
@@ -531,7 +519,7 @@  discard block
 block discarded – undo
531 519
         } else {
532 520
             $description = '';
533 521
             $descriptionMethod = $this->descriptionMethod;
534
-            if (! $descriptionMethod) {
522
+            if (!$descriptionMethod) {
535 523
                 $descriptionMethod = Config::inst()->get(
536 524
                     'ShareThisSimpleProvider',
537 525
                     'description_method'
Please login to merge, or discard this patch.