Completed
Push — master ( 8be1cb...ad2bb7 )
by Jeroen
25:07 queued 22:29
created
src/VCard.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
         $type = 'WORK;POSTAL'
90 90
     ) {
91 91
         // init value
92
-        $value = $name . ';' . $extended . ';' . $street . ';' . $city . ';' . $region . ';' . $zip . ';' . $country;
92
+        $value = $name.';'.$extended.';'.$street.';'.$city.';'.$region.';'.$zip.';'.$country;
93 93
 
94 94
         // set property
95 95
         $this->setProperty(
96 96
             'address',
97
-            'ADR' . (($type != '') ? ';' . $type : '') . $this->getCharsetString(),
97
+            'ADR'.(($type != '') ? ';'.$type : '').$this->getCharsetString(),
98 98
             $value
99 99
         );
100 100
 
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
     {
130 130
         $this->setProperty(
131 131
             'company',
132
-            'ORG' . $this->getCharsetString(),
132
+            'ORG'.$this->getCharsetString(),
133 133
             $company
134
-            . ($department != '' ? ';' . $department : '')
134
+            . ($department != '' ? ';'.$department : '')
135 135
         );
136 136
 
137 137
         // if filename is empty, add to filename
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $this->setProperty(
157 157
             'email',
158
-            'EMAIL;INTERNET' . (($type != '') ? ';' . $type : ''),
158
+            'EMAIL;INTERNET'.(($type != '') ? ';'.$type : ''),
159 159
             $address
160 160
         );
161 161
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     {
173 173
         $this->setProperty(
174 174
             'jobtitle',
175
-            'TITLE' . $this->getCharsetString(),
175
+            'TITLE'.$this->getCharsetString(),
176 176
             $jobtitle
177 177
         );
178 178
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         $this->setProperty(
191 191
             'role',
192
-            'ROLE' . $this->getCharsetString(),
192
+            'ROLE'.$this->getCharsetString(),
193 193
             $role
194 194
         );
195 195
 
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
             }
239 239
 
240 240
             $value = base64_encode($value);
241
-            $property .= ";ENCODING=b;TYPE=" . $fileType;
241
+            $property .= ";ENCODING=b;TYPE=".$fileType;
242 242
         } else {
243 243
             if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
244 244
                 $propertySuffix = ';VALUE=URL';
245
-                $propertySuffix .= ';TYPE=' . strtoupper($fileType);
245
+                $propertySuffix .= ';TYPE='.strtoupper($fileType);
246 246
 
247
-                $property = $property . $propertySuffix;
247
+                $property = $property.$propertySuffix;
248 248
                 $value = $url;
249 249
             } else {
250 250
                 $value = $url;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         $fileType = strtoupper(substr($mimeType, 6));
280 280
 
281 281
         $content = base64_encode($content);
282
-        $property .= ";ENCODING=b;TYPE=" . $fileType;
282
+        $property .= ";ENCODING=b;TYPE=".$fileType;
283 283
 
284 284
         $this->setProperty(
285 285
             $element,
@@ -318,10 +318,10 @@  discard block
 block discarded – undo
318 318
         $this->setFilename($values);
319 319
 
320 320
         // set property
321
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
321
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
322 322
         $this->setProperty(
323 323
             'name',
324
-            'N' . $this->getCharsetString(),
324
+            'N'.$this->getCharsetString(),
325 325
             $property
326 326
         );
327 327
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             // set property
331 331
             $this->setProperty(
332 332
                 'fullname',
333
-                'FN' . $this->getCharsetString(),
333
+                'FN'.$this->getCharsetString(),
334 334
                 trim(implode(' ', $values))
335 335
             );
336 336
         }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     {
349 349
         $this->setProperty(
350 350
             'note',
351
-            'NOTE' . $this->getCharsetString(),
351
+            'NOTE'.$this->getCharsetString(),
352 352
             $note
353 353
         );
354 354
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     {
366 366
         $this->setProperty(
367 367
             'categories',
368
-            'CATEGORIES' . $this->getCharsetString(),
368
+            'CATEGORIES'.$this->getCharsetString(),
369 369
             trim(implode(',', $categories))
370 370
         );
371 371
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     {
387 387
         $this->setProperty(
388 388
             'phoneNumber',
389
-            'TEL' . (($type != '') ? ';' . $type : ''),
389
+            'TEL'.(($type != '') ? ';'.$type : ''),
390 390
             $number
391 391
         );
392 392
 
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
     {
477 477
         $this->setProperty(
478 478
             'url',
479
-            'URL' . (($type != '') ? ';' . $type : ''),
479
+            'URL'.(($type != '') ? ';'.$type : ''),
480 480
             $url
481 481
         );
482 482
 
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
         // init string
494 494
         $string = "BEGIN:VCARD\r\n";
495 495
         $string .= "VERSION:3.0\r\n";
496
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
496
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
497 497
 
498 498
         // loop all properties
499 499
         $properties = $this->getProperties();
500 500
         foreach ($properties as $property) {
501 501
             // add to string
502
-            $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n");
502
+            $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n");
503 503
         }
504 504
 
505 505
         // add to string
@@ -517,19 +517,19 @@  discard block
 block discarded – undo
517 517
     public function buildVCalendar()
518 518
     {
519 519
         // init dates
520
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
521
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
520
+        $dtstart = date("Ymd")."T".date("Hi")."00";
521
+        $dtend = date("Ymd")."T".date("Hi")."01";
522 522
 
523 523
         // init string
524 524
         $string = "BEGIN:VCALENDAR\n";
525 525
         $string .= "VERSION:2.0\n";
526 526
         $string .= "BEGIN:VEVENT\n";
527
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
528
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
527
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
528
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
529 529
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
530
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
530
+        $string .= "DTSTAMP:".$dtstart."Z\n";
531 531
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
532
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
532
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
533 533
 
534 534
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
535 535
         $b64vcard = base64_encode($this->buildVCard());
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
             preg_split("//u", $body, -1, PREG_SPLIT_NO_EMPTY), $chunklen);
627 627
         $body = "";
628 628
         foreach ($array as $item) {
629
-            $body .= join("", $item) . $end;
629
+            $body .= join("", $item).$end;
630 630
         }
631 631
         return $body;
632 632
     }
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
     {
677 677
         $charsetString = '';
678 678
         if ($this->charset == 'utf-8') {
679
-            $charsetString = ';CHARSET=' . $this->charset;
679
+            $charsetString = ';CHARSET='.$this->charset;
680 680
         }
681 681
 
682 682
         return $charsetString;
@@ -726,12 +726,12 @@  discard block
 block discarded – undo
726 726
      */
727 727
     public function getHeaders($asAssociative)
728 728
     {
729
-        $contentType = $this->getContentType() . '; charset=' . $this->getCharset();
730
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
729
+        $contentType = $this->getContentType().'; charset='.$this->getCharset();
730
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
731 731
         $contentLength = mb_strlen($this->getOutput(), $this->getCharset());
732 732
         $connection = 'close';
733 733
 
734
-        if ((bool)$asAssociative) {
734
+        if ((bool) $asAssociative) {
735 735
             return [
736 736
                 'Content-type' => $contentType,
737 737
                 'Content-Disposition' => $contentDisposition,
@@ -741,10 +741,10 @@  discard block
 block discarded – undo
741 741
         }
742 742
 
743 743
         return [
744
-            'Content-type: ' . $contentType,
745
-            'Content-Disposition: ' . $contentDisposition,
746
-            'Content-Length: ' . $contentLength,
747
-            'Connection: ' . $connection,
744
+            'Content-type: '.$contentType,
745
+            'Content-Disposition: '.$contentDisposition,
746
+            'Content-Length: '.$contentLength,
747
+            'Connection: '.$connection,
748 748
         ];
749 749
     }
750 750
 
@@ -822,11 +822,11 @@  discard block
 block discarded – undo
822 822
      */
823 823
     public function save()
824 824
     {
825
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
825
+        $file = $this->getFilename().'.'.$this->getFileExtension();
826 826
 
827 827
         // Add save path if given
828 828
         if (null !== $this->savePath) {
829
-            $file = $this->savePath . $file;
829
+            $file = $this->savePath.$file;
830 830
         }
831 831
 
832 832
         file_put_contents(
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 
881 881
         // overwrite filename or add to filename using a prefix in between
882 882
         $this->filename = ($overwrite) ?
883
-            $value : $this->filename . $separator . $value;
883
+            $value : $this->filename.$separator.$value;
884 884
     }
885 885
 
886 886
     /**
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 
941 941
         $matches = [];
942 942
         preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches);
943
-        $version = isset($matches[1]) ? ((int)$matches[1]) : 999;
943
+        $version = isset($matches[1]) ? ((int) $matches[1]) : 999;
944 944
 
945 945
         return ($version < 8);
946 946
     }
Please login to merge, or discard this patch.