Completed
Push — master ( 76cf21...f8444d )
by Jeroen
01:30
created
src/VCardParser.php 1 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.
src/VCard.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
         $type = 'WORK;POSTAL'
92 92
     ) {
93 93
         // init value
94
-        $value = $name . ';' . $extended . ';' . $street . ';' . $city . ';' . $region . ';' . $zip . ';' . $country;
94
+        $value = $name.';'.$extended.';'.$street.';'.$city.';'.$region.';'.$zip.';'.$country;
95 95
 
96 96
         // set property
97 97
         $this->setProperty(
98 98
             'address',
99
-            'ADR' . (($type != '') ? ';' . $type : '') . $this->getCharsetString(),
99
+            'ADR'.(($type != '') ? ';'.$type : '').$this->getCharsetString(),
100 100
             $value
101 101
         );
102 102
 
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $this->setProperty(
133 133
             'company',
134
-            'ORG' . $this->getCharsetString(),
134
+            'ORG'.$this->getCharsetString(),
135 135
             $company
136
-            . ($department != '' ? ';' . $department : '')
136
+            . ($department != '' ? ';'.$department : '')
137 137
         );
138 138
 
139 139
         // if filename is empty, add to filename
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $this->setProperty(
159 159
             'email',
160
-            'EMAIL;INTERNET' . (($type != '') ? ';' . $type : ''),
160
+            'EMAIL;INTERNET'.(($type != '') ? ';'.$type : ''),
161 161
             $address
162 162
         );
163 163
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     {
175 175
         $this->setProperty(
176 176
             'jobtitle',
177
-            'TITLE' . $this->getCharsetString(),
177
+            'TITLE'.$this->getCharsetString(),
178 178
             $jobtitle
179 179
         );
180 180
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     {
192 192
         $this->setProperty(
193 193
             'role',
194
-            'ROLE' . $this->getCharsetString(),
194
+            'ROLE'.$this->getCharsetString(),
195 195
             $role
196 196
         );
197 197
 
@@ -237,13 +237,13 @@  discard block
 block discarded – undo
237 237
             }
238 238
 
239 239
             $value = base64_encode($value);
240
-            $property .= ";ENCODING=b;TYPE=" . $fileType;
240
+            $property .= ";ENCODING=b;TYPE=".$fileType;
241 241
         } else {
242 242
             if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
243 243
                 $propertySuffix = ';VALUE=URL';
244
-                $propertySuffix .= ';TYPE=' . strtoupper($fileType);
244
+                $propertySuffix .= ';TYPE='.strtoupper($fileType);
245 245
 
246
-                $property = $property . $propertySuffix;
246
+                $property = $property.$propertySuffix;
247 247
                 $value = $url;
248 248
             } else {
249 249
                 $value = $url;
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
         $this->setFilename($values);
288 288
 
289 289
         // set property
290
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
290
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
291 291
         $this->setProperty(
292 292
             'name',
293
-            'N' . $this->getCharsetString(),
293
+            'N'.$this->getCharsetString(),
294 294
             $property
295 295
         );
296 296
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             // set property
300 300
             $this->setProperty(
301 301
                 'fullname',
302
-                'FN' . $this->getCharsetString(),
302
+                'FN'.$this->getCharsetString(),
303 303
                 trim(implode(' ', $values))
304 304
             );
305 305
         }
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     {
318 318
         $this->setProperty(
319 319
             'note',
320
-            'NOTE' . $this->getCharsetString(),
320
+            'NOTE'.$this->getCharsetString(),
321 321
             $note
322 322
         );
323 323
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     {
335 335
         $this->setProperty(
336 336
             'categories',
337
-            'CATEGORIES' . $this->getCharsetString(),
337
+            'CATEGORIES'.$this->getCharsetString(),
338 338
             trim(implode(',', $categories))
339 339
         );
340 340
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     {
356 356
         $this->setProperty(
357 357
             'phoneNumber',
358
-            'TEL' . (($type != '') ? ';' . $type : ''),
358
+            'TEL'.(($type != '') ? ';'.$type : ''),
359 359
             $number
360 360
         );
361 361
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
     {
412 412
         $this->setProperty(
413 413
             'url',
414
-            'URL' . (($type != '') ? ';' . $type : ''),
414
+            'URL'.(($type != '') ? ';'.$type : ''),
415 415
             $url
416 416
         );
417 417
 
@@ -428,13 +428,13 @@  discard block
 block discarded – undo
428 428
         // init string
429 429
         $string = "BEGIN:VCARD\r\n";
430 430
         $string .= "VERSION:3.0\r\n";
431
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
431
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
432 432
 
433 433
         // loop all properties
434 434
         $properties = $this->getProperties();
435 435
         foreach ($properties as $property) {
436 436
             // add to string
437
-            $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n");
437
+            $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n");
438 438
         }
439 439
 
440 440
         // add to string
@@ -452,19 +452,19 @@  discard block
 block discarded – undo
452 452
     public function buildVCalendar()
453 453
     {
454 454
         // init dates
455
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
456
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
455
+        $dtstart = date("Ymd")."T".date("Hi")."00";
456
+        $dtend = date("Ymd")."T".date("Hi")."01";
457 457
 
458 458
         // init string
459 459
         $string = "BEGIN:VCALENDAR\n";
460 460
         $string .= "VERSION:2.0\n";
461 461
         $string .= "BEGIN:VEVENT\n";
462
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
463
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
462
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
463
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
464 464
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
465
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
465
+        $string .= "DTSTAMP:".$dtstart."Z\n";
466 466
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
467
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
467
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
468 468
 
469 469
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
470 470
         $b64vcard = base64_encode($this->buildVCard());
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
     {
592 592
         $charsetString = '';
593 593
         if ($this->charset == 'utf-8') {
594
-            $charsetString = ';CHARSET=' . $this->charset;
594
+            $charsetString = ';CHARSET='.$this->charset;
595 595
         }
596 596
 
597 597
         return $charsetString;
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
      */
642 642
     public function getHeaders($asAssociative)
643 643
     {
644
-        $contentType = $this->getContentType() . '; charset=' . $this->getCharset();
645
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
644
+        $contentType = $this->getContentType().'; charset='.$this->getCharset();
645
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
646 646
         $contentLength = mb_strlen($this->getOutput(), $this->getCharset());
647 647
         $connection = 'close';
648 648
 
649
-        if ((bool)$asAssociative) {
649
+        if ((bool) $asAssociative) {
650 650
             return [
651 651
                 'Content-type' => $contentType,
652 652
                 'Content-Disposition' => $contentDisposition,
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
         }
657 657
 
658 658
         return [
659
-            'Content-type: ' . $contentType,
660
-            'Content-Disposition: ' . $contentDisposition,
661
-            'Content-Length: ' . $contentLength,
662
-            'Connection: ' . $connection,
659
+            'Content-type: '.$contentType,
660
+            'Content-Disposition: '.$contentDisposition,
661
+            'Content-Length: '.$contentLength,
662
+            'Connection: '.$connection,
663 663
         ];
664 664
     }
665 665
 
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
      */
738 738
     public function save()
739 739
     {
740
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
740
+        $file = $this->getFilename().'.'.$this->getFileExtension();
741 741
 
742 742
         // Add save path if given
743 743
         if (null !== $this->savePath) {
744
-            $file = $this->savePath . $file;
744
+            $file = $this->savePath.$file;
745 745
         }
746 746
 
747 747
         file_put_contents(
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 
796 796
         // overwrite filename or add to filename using a prefix in between
797 797
         $this->filename = ($overwrite) ?
798
-            $value : $this->filename . $separator . $value;
798
+            $value : $this->filename.$separator.$value;
799 799
     }
800 800
 
801 801
     /**
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 
856 856
         $matches = [];
857 857
         preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches);
858
-        $version = isset($matches[1]) ? ((int)$matches[1]) : 999;
858
+        $version = isset($matches[1]) ? ((int) $matches[1]) : 999;
859 859
 
860 860
         return ($version < 8);
861 861
     }
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.