Completed
Pull Request — master (#103)
by
unknown
01:35
created
src/VCardParser.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 {
39 39
     /**
40 40
      * The raw VCard content.
41
-    *
41
+     *
42 42
      * @var string
43 43
      */
44 44
     protected $content;
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -72,6 +72,9 @@
 block discarded – undo
72 72
         }
73 73
     }
74 74
 
75
+    /**
76
+     * @param string $content
77
+     */
75 78
     public function __construct($content)
76 79
     {
77 80
         $this->content = $content;
Please login to merge, or discard this patch.
examples/example.php 1 patch
Spacing   +4 added lines, -4 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
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 $vcard->addAddress(null, null, 'street', 'worktown', null, 'workpostcode', 'Belgium');
32 32
 $vcard->addURL('http://www.jeroendesloovere.be');
33 33
 
34
-$vcard->addPhoto(__DIR__ . '/assets/landscape.jpeg');
34
+$vcard->addPhoto(__DIR__.'/assets/landscape.jpeg');
35 35
 //$vcard->addPhoto('https://raw.githubusercontent.com/jeroendesloovere/vcard/master/tests/image.jpg');
36 36
 
37 37
 // return vcard as a string
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 return $vcard->download();
42 42
 
43 43
 // echo message
44
-echo 'A personal vCard is saved in this folder: ' . __DIR__;
44
+echo 'A personal vCard is saved in this folder: '.__DIR__;
45 45
 
46 46
 // or
47 47
 
Please login to merge, or discard this patch.
examples/example_parsing.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@
 block discarded – undo
4 4
  * VCardParser test - can parse bundled VCF file into CSV
5 5
  */
6 6
 
7
-require_once __DIR__ . '/../vendor/autoload.php';
8
-require_once __DIR__ . '/../src/VCardParser.php';
7
+require_once __DIR__.'/../vendor/autoload.php';
8
+require_once __DIR__.'/../src/VCardParser.php';
9 9
 
10 10
 // load VCardParser classes
11 11
 use JeroenDesloovere\VCard\VCardParser;
12 12
 
13
-$pathToVCardExample = __DIR__ . '/assets/contacts.vcf';
13
+$pathToVCardExample = __DIR__.'/assets/contacts.vcf';
14 14
 $parser = VCardParser::parseFromFile($pathToVCardExample);
15 15
 
16
-foreach($parser as $vcard) {
16
+foreach ($parser as $vcard) {
17 17
     $lastname = $vcard->lastname;
18 18
     $firstname = $vcard->firstname;
19 19
     $birthday = $vcard->birthday->format('Y-m-d');
Please login to merge, or discard this patch.
src/VCardException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 {
19 19
     public static function elementAlreadyExists($element)
20 20
     {
21
-        return new self('You can only set "' . $element . '" once.');
21
+        return new self('You can only set "'.$element.'" once.');
22 22
     }
23 23
 
24 24
     public static function emptyURL()
Please login to merge, or discard this patch.
src/VCard.php 1 patch
Spacing   +38 added lines, -38 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
 
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
             }
236 236
 
237 237
             $value = base64_encode($value);
238
-            $property .= ";ENCODING=b;TYPE=" . $fileType;
238
+            $property .= ";ENCODING=b;TYPE=".$fileType;
239 239
         } else {
240 240
             if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
241 241
                 $propertySuffix = ';VALUE=URL';
242
-                $propertySuffix .= ';TYPE=' . strtoupper($fileType);
242
+                $propertySuffix .= ';TYPE='.strtoupper($fileType);
243 243
 
244
-                $property = $property . $propertySuffix;
244
+                $property = $property.$propertySuffix;
245 245
                 $value = $url;
246 246
             } else {
247 247
                 $value = $url;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         $fileType = strtoupper(substr($mimeType, 6));
277 277
 
278 278
         $content = base64_encode($content);
279
-        $property .= ";ENCODING=b;TYPE=" . $fileType;
279
+        $property .= ";ENCODING=b;TYPE=".$fileType;
280 280
 
281 281
         $this->setProperty(
282 282
             $element,
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
         $this->setFilename($values);
316 316
 
317 317
         // set property
318
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
318
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
319 319
         $this->setProperty(
320 320
             'name',
321
-            'N' . $this->getCharsetString(),
321
+            'N'.$this->getCharsetString(),
322 322
             $property
323 323
         );
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             // set property
328 328
             $this->setProperty(
329 329
                 'fullname',
330
-                'FN' . $this->getCharsetString(),
330
+                'FN'.$this->getCharsetString(),
331 331
                 trim(implode(' ', $values))
332 332
             );
333 333
         }
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     {
346 346
         $this->setProperty(
347 347
             'note',
348
-            'NOTE' . $this->getCharsetString(),
348
+            'NOTE'.$this->getCharsetString(),
349 349
             $note
350 350
         );
351 351
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
     {
363 363
         $this->setProperty(
364 364
             'categories',
365
-            'CATEGORIES' . $this->getCharsetString(),
365
+            'CATEGORIES'.$this->getCharsetString(),
366 366
             trim(implode(',', $categories))
367 367
         );
368 368
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
     {
384 384
         $this->setProperty(
385 385
             'phoneNumber',
386
-            'TEL' . (($type != '') ? ';' . $type : ''),
386
+            'TEL'.(($type != '') ? ';'.$type : ''),
387 387
             $number
388 388
         );
389 389
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
     {
474 474
         $this->setProperty(
475 475
             'url',
476
-            'URL' . (($type != '') ? ';' . $type : ''),
476
+            'URL'.(($type != '') ? ';'.$type : ''),
477 477
             $url
478 478
         );
479 479
 
@@ -490,13 +490,13 @@  discard block
 block discarded – undo
490 490
         // init string
491 491
         $string = "BEGIN:VCARD\r\n";
492 492
         $string .= "VERSION:3.0\r\n";
493
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
493
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
494 494
 
495 495
         // loop all properties
496 496
         $properties = $this->getProperties();
497 497
         foreach ($properties as $property) {
498 498
             // add to string
499
-            $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n");
499
+            $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n");
500 500
         }
501 501
 
502 502
         // add to string
@@ -514,19 +514,19 @@  discard block
 block discarded – undo
514 514
     public function buildVCalendar()
515 515
     {
516 516
         // init dates
517
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
518
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
517
+        $dtstart = date("Ymd")."T".date("Hi")."00";
518
+        $dtend = date("Ymd")."T".date("Hi")."01";
519 519
 
520 520
         // init string
521 521
         $string = "BEGIN:VCALENDAR\n";
522 522
         $string .= "VERSION:2.0\n";
523 523
         $string .= "BEGIN:VEVENT\n";
524
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
525
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
524
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
525
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
526 526
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
527
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
527
+        $string .= "DTSTAMP:".$dtstart."Z\n";
528 528
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
529
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
529
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
530 530
 
531 531
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
532 532
         $b64vcard = base64_encode($this->buildVCard());
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     {
654 654
         $charsetString = '';
655 655
         if ($this->charset == 'utf-8') {
656
-            $charsetString = ';CHARSET=' . $this->charset;
656
+            $charsetString = ';CHARSET='.$this->charset;
657 657
         }
658 658
 
659 659
         return $charsetString;
@@ -703,12 +703,12 @@  discard block
 block discarded – undo
703 703
      */
704 704
     public function getHeaders($asAssociative)
705 705
     {
706
-        $contentType = $this->getContentType() . '; charset=' . $this->getCharset();
707
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
706
+        $contentType = $this->getContentType().'; charset='.$this->getCharset();
707
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
708 708
         $contentLength = mb_strlen($this->getOutput(), $this->getCharset());
709 709
         $connection = 'close';
710 710
 
711
-        if ((bool)$asAssociative) {
711
+        if ((bool) $asAssociative) {
712 712
             return [
713 713
                 'Content-type' => $contentType,
714 714
                 'Content-Disposition' => $contentDisposition,
@@ -718,10 +718,10 @@  discard block
 block discarded – undo
718 718
         }
719 719
 
720 720
         return [
721
-            'Content-type: ' . $contentType,
722
-            'Content-Disposition: ' . $contentDisposition,
723
-            'Content-Length: ' . $contentLength,
724
-            'Connection: ' . $connection,
721
+            'Content-type: '.$contentType,
722
+            'Content-Disposition: '.$contentDisposition,
723
+            'Content-Length: '.$contentLength,
724
+            'Connection: '.$connection,
725 725
         ];
726 726
     }
727 727
 
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
      */
800 800
     public function save()
801 801
     {
802
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
802
+        $file = $this->getFilename().'.'.$this->getFileExtension();
803 803
 
804 804
         // Add save path if given
805 805
         if (null !== $this->savePath) {
806
-            $file = $this->savePath . $file;
806
+            $file = $this->savePath.$file;
807 807
         }
808 808
 
809 809
         file_put_contents(
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 
858 858
         // overwrite filename or add to filename using a prefix in between
859 859
         $this->filename = ($overwrite) ?
860
-            $value : $this->filename . $separator . $value;
860
+            $value : $this->filename.$separator.$value;
861 861
     }
862 862
 
863 863
     /**
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 
918 918
         $matches = [];
919 919
         preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches);
920
-        $version = isset($matches[1]) ? ((int)$matches[1]) : 999;
920
+        $version = isset($matches[1]) ? ((int) $matches[1]) : 999;
921 921
 
922 922
         return ($version < 8);
923 923
     }
Please login to merge, or discard this patch.