Completed
Pull Request — master (#101)
by
unknown
03:39
created
src/VCard.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -548,7 +548,7 @@
 block discarded – undo
548 548
      *
549 549
      * @link http://tools.ietf.org/html/rfc2425#section-5.8.1
550 550
      * @param  string $text
551
-     * @return mixed
551
+     * @return string
552 552
      */
553 553
     protected function fold($text)
554 554
     {
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         $type = 'WORK;POSTAL'
101 101
     ) {
102 102
         // init value
103
-        $value = $name . ';' . $extended . ';' . $street . ';' . $city . ';' . $region . ';' . $zip . ';' . $country;
103
+        $value = $name.';'.$extended.';'.$street.';'.$city.';'.$region.';'.$zip.';'.$country;
104 104
 
105 105
         // set property
106 106
         $this->setProperty(
107 107
             'address',
108
-            'ADR' . (($type != '') ? ';' . $type : '') . $this->getCharsetString(),
108
+            'ADR'.(($type != '') ? ';'.$type : '').$this->getCharsetString(),
109 109
             $value
110 110
         );
111 111
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $this->setProperty(
142 142
             'company',
143
-            'ORG' . $this->getCharsetString(),
143
+            'ORG'.$this->getCharsetString(),
144 144
             $company
145
-            . ($department != '' ? ';' . $department : '')
145
+            . ($department != '' ? ';'.$department : '')
146 146
         );
147 147
 
148 148
         // if filename is empty, add to filename
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     {
167 167
         $this->setProperty(
168 168
             'email',
169
-            'EMAIL;INTERNET' . (($type != '') ? ';' . $type : ''),
169
+            'EMAIL;INTERNET'.(($type != '') ? ';'.$type : ''),
170 170
             $address
171 171
         );
172 172
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     {
184 184
         $this->setProperty(
185 185
             'jobtitle',
186
-            'TITLE' . $this->getCharsetString(),
186
+            'TITLE'.$this->getCharsetString(),
187 187
             $jobtitle
188 188
         );
189 189
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     {
201 201
         $this->setProperty(
202 202
             'role',
203
-            'ROLE' . $this->getCharsetString(),
203
+            'ROLE'.$this->getCharsetString(),
204 204
             $role
205 205
         );
206 206
 
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
             }
247 247
 
248 248
             $value = base64_encode($value);
249
-            $property .= ";ENCODING=b;TYPE=" . $fileType;
249
+            $property .= ";ENCODING=b;TYPE=".$fileType;
250 250
         } else {
251 251
             if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
252 252
                 $propertySuffix = ';VALUE=URL';
253
-                $propertySuffix .= ';TYPE=' . strtoupper($fileType);
253
+                $propertySuffix .= ';TYPE='.strtoupper($fileType);
254 254
 
255
-                $property = $property . $propertySuffix;
255
+                $property = $property.$propertySuffix;
256 256
                 $value = $url;
257 257
             } else {
258 258
                 $value = $url;
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
         $this->setFilename($values);
297 297
 
298 298
         // set property
299
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
299
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
300 300
         $this->setProperty(
301 301
             'name',
302
-            'N' . $this->getCharsetString(),
302
+            'N'.$this->getCharsetString(),
303 303
             $property
304 304
         );
305 305
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             // set property
309 309
             $this->setProperty(
310 310
                 'fullname',
311
-                'FN' . $this->getCharsetString(),
311
+                'FN'.$this->getCharsetString(),
312 312
                 trim(implode(' ', $values))
313 313
             );
314 314
         }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
     {
327 327
         $this->setProperty(
328 328
             'note',
329
-            'NOTE' . $this->getCharsetString(),
329
+            'NOTE'.$this->getCharsetString(),
330 330
             $note
331 331
         );
332 332
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
     {
344 344
         $this->setProperty(
345 345
             'categories',
346
-            'CATEGORIES' . $this->getCharsetString(),
346
+            'CATEGORIES'.$this->getCharsetString(),
347 347
             trim(implode(',', $categories))
348 348
         );
349 349
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     {
365 365
         $this->setProperty(
366 366
             'phoneNumber',
367
-            'TEL' . (($type != '') ? ';' . $type : ''),
367
+            'TEL'.(($type != '') ? ';'.$type : ''),
368 368
             $number
369 369
         );
370 370
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
     {
421 421
         $this->setProperty(
422 422
             'url',
423
-            'URL' . (($type != '') ? ';' . $type : ''),
423
+            'URL'.(($type != '') ? ';'.$type : ''),
424 424
             $url
425 425
         );
426 426
 
@@ -436,18 +436,18 @@  discard block
 block discarded – undo
436 436
     {
437 437
         $properties = $this->getProperties();
438 438
 
439
-        for($i = 0;$i < count($properties);$i++) {
439
+        for ($i = 0; $i < count($properties); $i++) {
440 440
             // init string
441 441
             (empty($string)) ? $string = "BEGIN:VCARD\r\n" : $string .= "BEGIN:VCARD\r\n";
442 442
             
443 443
             $string .= "VERSION:3.0\r\n";
444
-            $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
444
+            $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
445 445
 
446 446
             // loop all properties
447 447
             $property = $this->getProperty($i);
448 448
             foreach ($property as $data) {
449 449
                 // add to string
450
-                $string .= $this->fold($data['key'] . ':' . $this->escape($data['value']) . "\r\n");
450
+                $string .= $this->fold($data['key'].':'.$this->escape($data['value'])."\r\n");
451 451
             }
452 452
 
453 453
             // add to string
@@ -466,19 +466,19 @@  discard block
 block discarded – undo
466 466
     public function buildVCalendar()
467 467
     {
468 468
         // init dates
469
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
470
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
469
+        $dtstart = date("Ymd")."T".date("Hi")."00";
470
+        $dtend = date("Ymd")."T".date("Hi")."01";
471 471
 
472 472
         // init string
473 473
         $string = "BEGIN:VCALENDAR\n";
474 474
         $string .= "VERSION:2.0\n";
475 475
         $string .= "BEGIN:VEVENT\n";
476
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
477
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
476
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
477
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
478 478
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
479
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
479
+        $string .= "DTSTAMP:".$dtstart."Z\n";
480 480
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
481
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
481
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
482 482
 
483 483
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
484 484
         $b64vcard = base64_encode($this->buildVCard());
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
     {
606 606
         $charsetString = '';
607 607
         if ($this->charset == 'utf-8') {
608
-            $charsetString = ';CHARSET=' . $this->charset;
608
+            $charsetString = ';CHARSET='.$this->charset;
609 609
         }
610 610
 
611 611
         return $charsetString;
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
      */
656 656
     public function getHeaders($asAssociative)
657 657
     {
658
-        $contentType = $this->getContentType() . '; charset=' . $this->getCharset();
659
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
658
+        $contentType = $this->getContentType().'; charset='.$this->getCharset();
659
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
660 660
         $contentLength = mb_strlen($this->getOutput(), $this->getCharset());
661 661
         $connection = 'close';
662 662
 
663
-        if ((bool)$asAssociative) {
663
+        if ((bool) $asAssociative) {
664 664
             return [
665 665
                 'Content-type' => $contentType,
666 666
                 'Content-Disposition' => $contentDisposition,
@@ -670,10 +670,10 @@  discard block
 block discarded – undo
670 670
         }
671 671
 
672 672
         return [
673
-            'Content-type: ' . $contentType,
674
-            'Content-Disposition: ' . $contentDisposition,
675
-            'Content-Length: ' . $contentLength,
676
-            'Connection: ' . $connection,
673
+            'Content-type: '.$contentType,
674
+            'Content-Disposition: '.$contentDisposition,
675
+            'Content-Length: '.$contentLength,
676
+            'Connection: '.$connection,
677 677
         ];
678 678
     }
679 679
 
@@ -763,11 +763,11 @@  discard block
 block discarded – undo
763 763
      */
764 764
     public function save()
765 765
     {
766
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
766
+        $file = $this->getFilename().'.'.$this->getFileExtension();
767 767
 
768 768
         // Add save path if given
769 769
         if (null !== $this->savePath) {
770
-            $file = $this->savePath . $file;
770
+            $file = $this->savePath.$file;
771 771
         }
772 772
 
773 773
         file_put_contents(
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 
822 822
         // overwrite filename or add to filename using a prefix in between
823 823
         $this->filename = ($overwrite) ?
824
-            $value : $this->filename . $separator . $value;
824
+            $value : $this->filename.$separator.$value;
825 825
     }
826 826
 
827 827
     /**
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 
882 882
         $matches = [];
883 883
         preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches);
884
-        $version = isset($matches[1]) ? ((int)$matches[1]) : 999;
884
+        $version = isset($matches[1]) ? ((int) $matches[1]) : 999;
885 885
 
886 886
         return ($version < 8);
887 887
     }
Please login to merge, or discard this patch.
examples/example_multiple.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
  * VCard generator test - can save to file or output as a download
5 5
  */
6 6
 
7
-require_once __DIR__ . '/../vendor/autoload.php';
8
-require_once __DIR__ . '/../src/VCard.php';
7
+require_once __DIR__.'/../vendor/autoload.php';
8
+require_once __DIR__.'/../src/VCard.php';
9 9
 
10 10
 use JeroenDesloovere\VCard\VCard;
11 11
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 return $vcard->download();
67 67
 
68 68
 // echo message
69
-echo 'A personal vCard is saved in this folder: ' . __DIR__;
69
+echo 'A personal vCard is saved in this folder: '.__DIR__;
70 70
 
71 71
 // or
72 72
 
Please login to merge, or discard this patch.