Completed
Push — master ( 97f993...4db017 )
by Jeroen
02:04
created
src/VCard.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
         $type = 'WORK;POSTAL'
85 85
     ) {
86 86
         // init value
87
-        $value = $name . ';' . $extended . ';' . $street . ';' . $city . ';' . $region . ';' . $zip . ';' . $country;
87
+        $value = $name.';'.$extended.';'.$street.';'.$city.';'.$region.';'.$zip.';'.$country;
88 88
 
89 89
         // set property
90 90
         $this->setProperty(
91 91
             'address',
92
-            'ADR' . (($type != '') ? ';' . $type : '') . $this->getCharsetString(),
92
+            'ADR'.(($type != '') ? ';'.$type : '').$this->getCharsetString(),
93 93
             $value
94 94
         );
95 95
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $this->setProperty(
125 125
             'company',
126
-            'ORG' . $this->getCharsetString(),
126
+            'ORG'.$this->getCharsetString(),
127 127
             $company
128 128
         );
129 129
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $this->setProperty(
150 150
             'email',
151
-            'EMAIL;INTERNET' . (($type != '') ? ';' . $type : ''),
151
+            'EMAIL;INTERNET'.(($type != '') ? ';'.$type : ''),
152 152
             $address
153 153
         );
154 154
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $this->setProperty(
167 167
             'jobtitle',
168
-            'TITLE' . $this->getCharsetString(),
168
+            'TITLE'.$this->getCharsetString(),
169 169
             $jobtitle
170 170
         );
171 171
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     {
183 183
         $this->setProperty(
184 184
             'role',
185
-            'ROLE' . $this->getCharsetString(),
185
+            'ROLE'.$this->getCharsetString(),
186 186
             $role
187 187
         );
188 188
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             $value = base64_encode($value);
210 210
 
211 211
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
212
-            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,' . $value);
212
+            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,'.$value);
213 213
             finfo_close($finfo);
214 214
 
215 215
             if (preg_match('/^image\//', $mimetype) !== 1) {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
             $type = strtoupper(str_replace('image/', '', $mimetype));
220 220
 
221
-            $property .= ";ENCODING=b;TYPE=" . $type;
221
+            $property .= ";ENCODING=b;TYPE=".$type;
222 222
         } else {
223 223
             if (filter_var($url, FILTER_VALIDATE_URL) !== FALSE) {
224 224
                 $propertySuffix = ';VALUE=URL';
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
                     throw new VCardMediaException('Returned data isn\'t an image.');
240 240
                 }
241 241
 
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;
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
         $this->setFilename($values);
286 286
 
287 287
         // set property
288
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
288
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
289 289
         $this->setProperty(
290 290
             'name',
291
-            'N' . $this->getCharsetString(),
291
+            'N'.$this->getCharsetString(),
292 292
             $property
293 293
         );
294 294
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
             // set property
298 298
             $this->setProperty(
299 299
                 'fullname',
300
-                'FN' . $this->getCharsetString(),
300
+                'FN'.$this->getCharsetString(),
301 301
                 trim(implode(' ', $values))
302 302
             );
303 303
         }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
     {
316 316
         $this->setProperty(
317 317
             'note',
318
-            'NOTE' . $this->getCharsetString(),
318
+            'NOTE'.$this->getCharsetString(),
319 319
             $note
320 320
         );
321 321
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     {
333 333
         $this->setProperty(
334 334
             'categories',
335
-            'CATEGORIES' . $this->getCharsetString(),
335
+            'CATEGORIES'.$this->getCharsetString(),
336 336
             trim(implode(',', $categories))
337 337
         );
338 338
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     {
354 354
         $this->setProperty(
355 355
             'phoneNumber',
356
-            'TEL' . (($type != '') ? ';' . $type : ''),
356
+            'TEL'.(($type != '') ? ';'.$type : ''),
357 357
             $number
358 358
         );
359 359
 
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     {
410 410
         $this->setProperty(
411 411
             'url',
412
-            'URL' . (($type != '') ? ';' . $type : ''),
412
+            'URL'.(($type != '') ? ';'.$type : ''),
413 413
             $url
414 414
         );
415 415
 
@@ -426,13 +426,13 @@  discard block
 block discarded – undo
426 426
         // init string
427 427
         $string = "BEGIN:VCARD\r\n";
428 428
         $string .= "VERSION:3.0\r\n";
429
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
429
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
430 430
 
431 431
         // loop all properties
432 432
         $properties = $this->getProperties();
433 433
         foreach ($properties as $property) {
434 434
             // add to string
435
-            $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n");
435
+            $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n");
436 436
         }
437 437
 
438 438
         // add to string
@@ -450,19 +450,19 @@  discard block
 block discarded – undo
450 450
     public function buildVCalendar()
451 451
     {
452 452
         // init dates
453
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
454
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
453
+        $dtstart = date("Ymd")."T".date("Hi")."00";
454
+        $dtend = date("Ymd")."T".date("Hi")."01";
455 455
 
456 456
         // init string
457 457
         $string = "BEGIN:VCALENDAR\n";
458 458
         $string .= "VERSION:2.0\n";
459 459
         $string .= "BEGIN:VEVENT\n";
460
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
461
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
460
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
461
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
462 462
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
463
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
463
+        $string .= "DTSTAMP:".$dtstart."Z\n";
464 464
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
465
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
465
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
466 466
 
467 467
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
468 468
         $b64vcard = base64_encode($this->buildVCard());
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
     {
590 590
         $charsetString = '';
591 591
         if ($this->charset == 'utf-8') {
592
-            $charsetString = ';CHARSET=' . $this->charset;
592
+            $charsetString = ';CHARSET='.$this->charset;
593 593
         }
594 594
         return $charsetString;
595 595
     }
@@ -637,8 +637,8 @@  discard block
 block discarded – undo
637 637
      */
638 638
     public function getHeaders($asAssociative)
639 639
     {
640
-        $contentType        = $this->getContentType() . '; charset=' . $this->getCharset();
641
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
640
+        $contentType        = $this->getContentType().'; charset='.$this->getCharset();
641
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
642 642
         $contentLength      = mb_strlen($this->getOutput(), $this->getCharset());
643 643
         $connection         = 'close';
644 644
 
@@ -652,10 +652,10 @@  discard block
 block discarded – undo
652 652
         }
653 653
 
654 654
         return array(
655
-            'Content-type: ' . $contentType,
656
-            'Content-Disposition: ' . $contentDisposition,
657
-            'Content-Length: ' . $contentLength,
658
-            'Connection: ' . $connection,
655
+            'Content-type: '.$contentType,
656
+            'Content-Disposition: '.$contentDisposition,
657
+            'Content-Length: '.$contentLength,
658
+            'Connection: '.$connection,
659 659
         );
660 660
     }
661 661
 
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
      */
734 734
     public function save()
735 735
     {
736
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
736
+        $file = $this->getFilename().'.'.$this->getFileExtension();
737 737
 
738 738
         file_put_contents(
739 739
             $file,
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 
787 787
         // overwrite filename or add to filename using a prefix in between
788 788
         $this->filename = ($overwrite) ?
789
-            $value : $this->filename . $separator . $value;
789
+            $value : $this->filename.$separator.$value;
790 790
     }
791 791
 
792 792
     /**
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
         if (!in_array($element, $this->multiplePropertiesForElementAllowed)
803 803
             && isset($this->definedElements[$element])
804 804
         ) {
805
-            throw new Exception('You can only set "' . $element . '" once.');
805
+            throw new Exception('You can only set "'.$element.'" once.');
806 806
         }
807 807
 
808 808
         // we define that we set this element
Please login to merge, or discard this patch.