Completed
Push — master ( 0bef36...c10cae )
by Jeroen
02:11
created
src/VCard.php 1 patch
Spacing   +39 added lines, -39 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
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             $value = base64_encode($value);
218 218
 
219 219
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
220
-            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,' . $value);
220
+            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,'.$value);
221 221
             finfo_close($finfo);
222 222
 
223 223
             if (preg_match('/^image\//', $mimetype) !== 1) {
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
             $type = strtoupper(str_replace('image/', '', $mimetype));
228 228
 
229
-            $property .= ";ENCODING=b;TYPE=" . $type;
229
+            $property .= ";ENCODING=b;TYPE=".$type;
230 230
         } else {
231 231
             if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
232 232
                 $propertySuffix = ';VALUE=URL';
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
                     throw new VCardMediaException('Returned data isn\'t an image.');
248 248
                 }
249 249
 
250
-                $propertySuffix .= ';TYPE=' . strtoupper($fileType);
250
+                $propertySuffix .= ';TYPE='.strtoupper($fileType);
251 251
 
252
-                $property = $property . $propertySuffix;
252
+                $property = $property.$propertySuffix;
253 253
                 $value = $url;
254 254
             } else {
255 255
                 $value = $url;
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
         $this->setFilename($values);
294 294
 
295 295
         // set property
296
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
296
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
297 297
         $this->setProperty(
298 298
             'name',
299
-            'N' . $this->getCharsetString(),
299
+            'N'.$this->getCharsetString(),
300 300
             $property
301 301
         );
302 302
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             // set property
306 306
             $this->setProperty(
307 307
                 'fullname',
308
-                'FN' . $this->getCharsetString(),
308
+                'FN'.$this->getCharsetString(),
309 309
                 trim(implode(' ', $values))
310 310
             );
311 311
         }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     {
324 324
         $this->setProperty(
325 325
             'note',
326
-            'NOTE' . $this->getCharsetString(),
326
+            'NOTE'.$this->getCharsetString(),
327 327
             $note
328 328
         );
329 329
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     {
341 341
         $this->setProperty(
342 342
             'categories',
343
-            'CATEGORIES' . $this->getCharsetString(),
343
+            'CATEGORIES'.$this->getCharsetString(),
344 344
             trim(implode(',', $categories))
345 345
         );
346 346
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     {
362 362
         $this->setProperty(
363 363
             'phoneNumber',
364
-            'TEL' . (($type != '') ? ';' . $type : ''),
364
+            'TEL'.(($type != '') ? ';'.$type : ''),
365 365
             $number
366 366
         );
367 367
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
     {
418 418
         $this->setProperty(
419 419
             'url',
420
-            'URL' . (($type != '') ? ';' . $type : ''),
420
+            'URL'.(($type != '') ? ';'.$type : ''),
421 421
             $url
422 422
         );
423 423
 
@@ -434,13 +434,13 @@  discard block
 block discarded – undo
434 434
         // init string
435 435
         $string = "BEGIN:VCARD\r\n";
436 436
         $string .= "VERSION:3.0\r\n";
437
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
437
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
438 438
 
439 439
         // loop all properties
440 440
         $properties = $this->getProperties();
441 441
         foreach ($properties as $property) {
442 442
             // add to string
443
-            $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n");
443
+            $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n");
444 444
         }
445 445
 
446 446
         // add to string
@@ -458,19 +458,19 @@  discard block
 block discarded – undo
458 458
     public function buildVCalendar()
459 459
     {
460 460
         // init dates
461
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
462
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
461
+        $dtstart = date("Ymd")."T".date("Hi")."00";
462
+        $dtend = date("Ymd")."T".date("Hi")."01";
463 463
 
464 464
         // init string
465 465
         $string = "BEGIN:VCALENDAR\n";
466 466
         $string .= "VERSION:2.0\n";
467 467
         $string .= "BEGIN:VEVENT\n";
468
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
469
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
468
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
469
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
470 470
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
471
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
471
+        $string .= "DTSTAMP:".$dtstart."Z\n";
472 472
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
473
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
473
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
474 474
 
475 475
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
476 476
         $b64vcard = base64_encode($this->buildVCard());
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
     {
598 598
         $charsetString = '';
599 599
         if ($this->charset == 'utf-8') {
600
-            $charsetString = ';CHARSET=' . $this->charset;
600
+            $charsetString = ';CHARSET='.$this->charset;
601 601
         }
602 602
 
603 603
         return $charsetString;
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
      */
648 648
     public function getHeaders($asAssociative)
649 649
     {
650
-        $contentType = $this->getContentType() . '; charset=' . $this->getCharset();
651
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
650
+        $contentType = $this->getContentType().'; charset='.$this->getCharset();
651
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
652 652
         $contentLength = mb_strlen($this->getOutput(), $this->getCharset());
653 653
         $connection = 'close';
654 654
 
655
-        if ((bool)$asAssociative) {
655
+        if ((bool) $asAssociative) {
656 656
             return array(
657 657
                 'Content-type' => $contentType,
658 658
                 'Content-Disposition' => $contentDisposition,
@@ -662,10 +662,10 @@  discard block
 block discarded – undo
662 662
         }
663 663
 
664 664
         return array(
665
-            'Content-type: ' . $contentType,
666
-            'Content-Disposition: ' . $contentDisposition,
667
-            'Content-Length: ' . $contentLength,
668
-            'Connection: ' . $connection,
665
+            'Content-type: '.$contentType,
666
+            'Content-Disposition: '.$contentDisposition,
667
+            'Content-Length: '.$contentLength,
668
+            'Connection: '.$connection,
669 669
         );
670 670
     }
671 671
 
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
      */
744 744
     public function save()
745 745
     {
746
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
746
+        $file = $this->getFilename().'.'.$this->getFileExtension();
747 747
 
748 748
         // Add save path if given
749 749
         if (null !== $this->savePath) {
750
-            $file = $this->savePath . $file;
750
+            $file = $this->savePath.$file;
751 751
         }
752 752
 
753 753
         file_put_contents(
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 
802 802
         // overwrite filename or add to filename using a prefix in between
803 803
         $this->filename = ($overwrite) ?
804
-            $value : $this->filename . $separator . $value;
804
+            $value : $this->filename.$separator.$value;
805 805
     }
806 806
 
807 807
     /**
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
         if (!in_array($element, $this->multiplePropertiesForElementAllowed)
838 838
             && isset($this->definedElements[$element])
839 839
         ) {
840
-            throw new Exception('You can only set "' . $element . '" once.');
840
+            throw new Exception('You can only set "'.$element.'" once.');
841 841
         }
842 842
 
843 843
         // we define that we set this element
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 
862 862
         $matches = array();
863 863
         preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches);
864
-        $version = isset($matches[1]) ? ((int)$matches[1]) : 999;
864
+        $version = isset($matches[1]) ? ((int) $matches[1]) : 999;
865 865
 
866 866
         return ($version < 8);
867 867
     }
Please login to merge, or discard this patch.