Completed
Pull Request — master (#80)
by Rouven Alexander
05:07
created
src/VCard.php 1 patch
Spacing   +35 added lines, -35 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,7 +130,7 @@  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 135
         );
136 136
 
@@ -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
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             $value = base64_encode($value);
217 217
 
218 218
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
219
-            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,' . $value);
219
+            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,'.$value);
220 220
             finfo_close($finfo);
221 221
 
222 222
             if (preg_match('/^image\//', $mimetype) !== 1) {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
             $type = strtoupper(str_replace('image/', '', $mimetype));
227 227
 
228
-            $property .= ";ENCODING=b;TYPE=" . $type;
228
+            $property .= ";ENCODING=b;TYPE=".$type;
229 229
         } else {
230 230
             if (filter_var($url, FILTER_VALIDATE_URL) !== FALSE) {
231 231
                 $propertySuffix = ';VALUE=URL';
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
                     throw new VCardMediaException('Returned data isn\'t an image.');
247 247
                 }
248 248
 
249
-                $propertySuffix .= ';TYPE=' . strtoupper($fileType);
249
+                $propertySuffix .= ';TYPE='.strtoupper($fileType);
250 250
 
251
-                $property = $property . $propertySuffix;
251
+                $property = $property.$propertySuffix;
252 252
                 $value = $url;
253 253
             } else {
254 254
                 $value = $url;
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
         $this->setFilename($values);
293 293
 
294 294
         // set property
295
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
295
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
296 296
         $this->setProperty(
297 297
             'name',
298
-            'N' . $this->getCharsetString(),
298
+            'N'.$this->getCharsetString(),
299 299
             $property
300 300
         );
301 301
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             // set property
305 305
             $this->setProperty(
306 306
                 'fullname',
307
-                'FN' . $this->getCharsetString(),
307
+                'FN'.$this->getCharsetString(),
308 308
                 trim(implode(' ', $values))
309 309
             );
310 310
         }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
     {
323 323
         $this->setProperty(
324 324
             'note',
325
-            'NOTE' . $this->getCharsetString(),
325
+            'NOTE'.$this->getCharsetString(),
326 326
             $note
327 327
         );
328 328
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
     {
344 344
         $this->setProperty(
345 345
             'phoneNumber',
346
-            'TEL' . (($type != '') ? ';' . $type : ''),
346
+            'TEL'.(($type != '') ? ';'.$type : ''),
347 347
             $number
348 348
         );
349 349
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     {
400 400
         $this->setProperty(
401 401
             'url',
402
-            'URL' . (($type != '') ? ';' . $type : ''),
402
+            'URL'.(($type != '') ? ';'.$type : ''),
403 403
             $url
404 404
         );
405 405
 
@@ -416,13 +416,13 @@  discard block
 block discarded – undo
416 416
         // init string
417 417
         $string = "BEGIN:VCARD\r\n";
418 418
         $string .= "VERSION:3.0\r\n";
419
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
419
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
420 420
 
421 421
         // loop all properties
422 422
         $properties = $this->getProperties();
423 423
         foreach ($properties as $property) {
424 424
             // add to string
425
-            $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n");
425
+            $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n");
426 426
         }
427 427
 
428 428
         // add to string
@@ -440,19 +440,19 @@  discard block
 block discarded – undo
440 440
     public function buildVCalendar()
441 441
     {
442 442
         // init dates
443
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
444
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
443
+        $dtstart = date("Ymd")."T".date("Hi")."00";
444
+        $dtend = date("Ymd")."T".date("Hi")."01";
445 445
 
446 446
         // init string
447 447
         $string = "BEGIN:VCALENDAR\n";
448 448
         $string .= "VERSION:2.0\n";
449 449
         $string .= "BEGIN:VEVENT\n";
450
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
451
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
450
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
451
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
452 452
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
453
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
453
+        $string .= "DTSTAMP:".$dtstart."Z\n";
454 454
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
455
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
455
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
456 456
 
457 457
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
458 458
         $b64vcard = base64_encode($this->buildVCard());
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
     {
580 580
         $charsetString = '';
581 581
         if ($this->charset == 'utf-8') {
582
-            $charsetString = ';CHARSET=' . $this->charset;
582
+            $charsetString = ';CHARSET='.$this->charset;
583 583
         }
584 584
         return $charsetString;
585 585
     }
@@ -627,8 +627,8 @@  discard block
 block discarded – undo
627 627
      */
628 628
     public function getHeaders($asAssociative)
629 629
     {
630
-        $contentType        = $this->getContentType() . '; charset=' . $this->getCharset();
631
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
630
+        $contentType        = $this->getContentType().'; charset='.$this->getCharset();
631
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
632 632
         $contentLength      = strlen($this->getOutput());
633 633
         $connection         = 'close';
634 634
 
@@ -642,10 +642,10 @@  discard block
 block discarded – undo
642 642
         }
643 643
 
644 644
         return array(
645
-            'Content-type: ' . $contentType,
646
-            'Content-Disposition: ' . $contentDisposition,
647
-            'Content-Length: ' . $contentLength,
648
-            'Connection: ' . $connection,
645
+            'Content-type: '.$contentType,
646
+            'Content-Disposition: '.$contentDisposition,
647
+            'Content-Length: '.$contentLength,
648
+            'Connection: '.$connection,
649 649
         );
650 650
     }
651 651
 
@@ -723,11 +723,11 @@  discard block
 block discarded – undo
723 723
      */
724 724
     public function save()
725 725
     {
726
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
726
+        $file = $this->getFilename().'.'.$this->getFileExtension();
727 727
 
728 728
         // Add save path if given
729 729
         if (null !== $this->savePath) {
730
-            $file = $this->savePath . $file;
730
+            $file = $this->savePath.$file;
731 731
         }
732 732
 
733 733
         file_put_contents(
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 
782 782
         // overwrite filename or add to filename using a prefix in between
783 783
         $this->filename = ($overwrite) ?
784
-            $value : $this->filename . $separator . $value;
784
+            $value : $this->filename.$separator.$value;
785 785
     }
786 786
 
787 787
     /**
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
         if (!in_array($element, $this->multiplePropertiesForElementAllowed)
818 818
             && isset($this->definedElements[$element])
819 819
         ) {
820
-            throw new Exception('You can only set "' . $element . '" once.');
820
+            throw new Exception('You can only set "'.$element.'" once.');
821 821
         }
822 822
 
823 823
         // we define that we set this element
Please login to merge, or discard this patch.