Completed
Push — master ( c10cae...ea119a )
by Jeroen
02:17
created
src/VCard.php 1 patch
Spacing   +38 added lines, -38 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
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
     {
131 131
         $this->setProperty(
132 132
             'company',
133
-            'ORG' . $this->getCharsetString(),
133
+            'ORG'.$this->getCharsetString(),
134 134
             $company
135
-            . ($department != '' ? ';' . $department : '')
135
+            . ($department != '' ? ';'.$department : '')
136 136
         );
137 137
 
138 138
         // if filename is empty, add to filename
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     {
157 157
         $this->setProperty(
158 158
             'email',
159
-            'EMAIL;INTERNET' . (($type != '') ? ';' . $type : ''),
159
+            'EMAIL;INTERNET'.(($type != '') ? ';'.$type : ''),
160 160
             $address
161 161
         );
162 162
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     {
174 174
         $this->setProperty(
175 175
             'jobtitle',
176
-            'TITLE' . $this->getCharsetString(),
176
+            'TITLE'.$this->getCharsetString(),
177 177
             $jobtitle
178 178
         );
179 179
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     {
191 191
         $this->setProperty(
192 192
             'role',
193
-            'ROLE' . $this->getCharsetString(),
193
+            'ROLE'.$this->getCharsetString(),
194 194
             $role
195 195
         );
196 196
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
             $type = strtoupper(str_replace('image/', '', $mimetype));
225 225
 
226
-            $property .= ";ENCODING=b;TYPE=" . $type;
226
+            $property .= ";ENCODING=b;TYPE=".$type;
227 227
         } else {
228 228
             if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
229 229
                 $propertySuffix = ';VALUE=URL';
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
                     throw new VCardMediaException('Returned data isn\'t an image.');
245 245
                 }
246 246
 
247
-                $propertySuffix .= ';TYPE=' . strtoupper($fileType);
247
+                $propertySuffix .= ';TYPE='.strtoupper($fileType);
248 248
 
249
-                $property = $property . $propertySuffix;
249
+                $property = $property.$propertySuffix;
250 250
                 $value = $url;
251 251
             } else {
252 252
                 $value = $url;
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
         $this->setFilename($values);
291 291
 
292 292
         // set property
293
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
293
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
294 294
         $this->setProperty(
295 295
             'name',
296
-            'N' . $this->getCharsetString(),
296
+            'N'.$this->getCharsetString(),
297 297
             $property
298 298
         );
299 299
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             // set property
303 303
             $this->setProperty(
304 304
                 'fullname',
305
-                'FN' . $this->getCharsetString(),
305
+                'FN'.$this->getCharsetString(),
306 306
                 trim(implode(' ', $values))
307 307
             );
308 308
         }
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     {
321 321
         $this->setProperty(
322 322
             'note',
323
-            'NOTE' . $this->getCharsetString(),
323
+            'NOTE'.$this->getCharsetString(),
324 324
             $note
325 325
         );
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
     {
338 338
         $this->setProperty(
339 339
             'categories',
340
-            'CATEGORIES' . $this->getCharsetString(),
340
+            'CATEGORIES'.$this->getCharsetString(),
341 341
             trim(implode(',', $categories))
342 342
         );
343 343
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     {
359 359
         $this->setProperty(
360 360
             'phoneNumber',
361
-            'TEL' . (($type != '') ? ';' . $type : ''),
361
+            'TEL'.(($type != '') ? ';'.$type : ''),
362 362
             $number
363 363
         );
364 364
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
     {
415 415
         $this->setProperty(
416 416
             'url',
417
-            'URL' . (($type != '') ? ';' . $type : ''),
417
+            'URL'.(($type != '') ? ';'.$type : ''),
418 418
             $url
419 419
         );
420 420
 
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
         // init string
432 432
         $string = "BEGIN:VCARD\r\n";
433 433
         $string .= "VERSION:3.0\r\n";
434
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
434
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
435 435
 
436 436
         // loop all properties
437 437
         $properties = $this->getProperties();
438 438
         foreach ($properties as $property) {
439 439
             // add to string
440
-            $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n");
440
+            $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n");
441 441
         }
442 442
 
443 443
         // add to string
@@ -455,19 +455,19 @@  discard block
 block discarded – undo
455 455
     public function buildVCalendar()
456 456
     {
457 457
         // init dates
458
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
459
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
458
+        $dtstart = date("Ymd")."T".date("Hi")."00";
459
+        $dtend = date("Ymd")."T".date("Hi")."01";
460 460
 
461 461
         // init string
462 462
         $string = "BEGIN:VCALENDAR\n";
463 463
         $string .= "VERSION:2.0\n";
464 464
         $string .= "BEGIN:VEVENT\n";
465
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
466
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
465
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
466
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
467 467
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
468
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
468
+        $string .= "DTSTAMP:".$dtstart."Z\n";
469 469
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
470
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
470
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
471 471
 
472 472
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
473 473
         $b64vcard = base64_encode($this->buildVCard());
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     {
595 595
         $charsetString = '';
596 596
         if ($this->charset == 'utf-8') {
597
-            $charsetString = ';CHARSET=' . $this->charset;
597
+            $charsetString = ';CHARSET='.$this->charset;
598 598
         }
599 599
 
600 600
         return $charsetString;
@@ -644,12 +644,12 @@  discard block
 block discarded – undo
644 644
      */
645 645
     public function getHeaders($asAssociative)
646 646
     {
647
-        $contentType = $this->getContentType() . '; charset=' . $this->getCharset();
648
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
647
+        $contentType = $this->getContentType().'; charset='.$this->getCharset();
648
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
649 649
         $contentLength = mb_strlen($this->getOutput(), $this->getCharset());
650 650
         $connection = 'close';
651 651
 
652
-        if ((bool)$asAssociative) {
652
+        if ((bool) $asAssociative) {
653 653
             return array(
654 654
                 'Content-type' => $contentType,
655 655
                 'Content-Disposition' => $contentDisposition,
@@ -659,10 +659,10 @@  discard block
 block discarded – undo
659 659
         }
660 660
 
661 661
         return array(
662
-            'Content-type: ' . $contentType,
663
-            'Content-Disposition: ' . $contentDisposition,
664
-            'Content-Length: ' . $contentLength,
665
-            'Connection: ' . $connection,
662
+            'Content-type: '.$contentType,
663
+            'Content-Disposition: '.$contentDisposition,
664
+            'Content-Length: '.$contentLength,
665
+            'Connection: '.$connection,
666 666
         );
667 667
     }
668 668
 
@@ -740,11 +740,11 @@  discard block
 block discarded – undo
740 740
      */
741 741
     public function save()
742 742
     {
743
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
743
+        $file = $this->getFilename().'.'.$this->getFileExtension();
744 744
 
745 745
         // Add save path if given
746 746
         if (null !== $this->savePath) {
747
-            $file = $this->savePath . $file;
747
+            $file = $this->savePath.$file;
748 748
         }
749 749
 
750 750
         file_put_contents(
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 
799 799
         // overwrite filename or add to filename using a prefix in between
800 800
         $this->filename = ($overwrite) ?
801
-            $value : $this->filename . $separator . $value;
801
+            $value : $this->filename.$separator.$value;
802 802
     }
803 803
 
804 804
     /**
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
         if (!in_array($element, $this->multiplePropertiesForElementAllowed)
835 835
             && isset($this->definedElements[$element])
836 836
         ) {
837
-            throw new Exception('You can only set "' . $element . '" once.');
837
+            throw new Exception('You can only set "'.$element.'" once.');
838 838
         }
839 839
 
840 840
         // we define that we set this element
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
 
859 859
         $matches = array();
860 860
         preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches);
861
-        $version = isset($matches[1]) ? ((int)$matches[1]) : 999;
861
+        $version = isset($matches[1]) ? ((int) $matches[1]) : 999;
862 862
 
863 863
         return ($version < 8);
864 864
     }
Please login to merge, or discard this patch.