Completed
Push — master ( c77c49...0bef36 )
by Jeroen
02:12
created
src/VCard.php 1 patch
Spacing   +38 added lines, -38 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,9 +123,9 @@  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
-            . ($department != '' ? ';' . $department : '')
128
+            . ($department != '' ? ';'.$department : '')
129 129
         );
130 130
 
131 131
         // if filename is empty, add to filename
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     {
150 150
         $this->setProperty(
151 151
             'email',
152
-            'EMAIL;INTERNET' . (($type != '') ? ';' . $type : ''),
152
+            'EMAIL;INTERNET'.(($type != '') ? ';'.$type : ''),
153 153
             $address
154 154
         );
155 155
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     {
167 167
         $this->setProperty(
168 168
             'jobtitle',
169
-            'TITLE' . $this->getCharsetString(),
169
+            'TITLE'.$this->getCharsetString(),
170 170
             $jobtitle
171 171
         );
172 172
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     {
184 184
         $this->setProperty(
185 185
             'role',
186
-            'ROLE' . $this->getCharsetString(),
186
+            'ROLE'.$this->getCharsetString(),
187 187
             $role
188 188
         );
189 189
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             $value = base64_encode($value);
211 211
 
212 212
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
213
-            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,' . $value);
213
+            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,'.$value);
214 214
             finfo_close($finfo);
215 215
 
216 216
             if (preg_match('/^image\//', $mimetype) !== 1) {
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
             $type = strtoupper(str_replace('image/', '', $mimetype));
221 221
 
222
-            $property .= ";ENCODING=b;TYPE=" . $type;
222
+            $property .= ";ENCODING=b;TYPE=".$type;
223 223
         } else {
224 224
             if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
225 225
                 $propertySuffix = ';VALUE=URL';
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
                     throw new VCardMediaException('Returned data isn\'t an image.');
241 241
                 }
242 242
 
243
-                $propertySuffix .= ';TYPE=' . strtoupper($fileType);
243
+                $propertySuffix .= ';TYPE='.strtoupper($fileType);
244 244
 
245
-                $property = $property . $propertySuffix;
245
+                $property = $property.$propertySuffix;
246 246
                 $value = $url;
247 247
             } else {
248 248
                 $value = $url;
@@ -286,10 +286,10 @@  discard block
 block discarded – undo
286 286
         $this->setFilename($values);
287 287
 
288 288
         // set property
289
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
289
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
290 290
         $this->setProperty(
291 291
             'name',
292
-            'N' . $this->getCharsetString(),
292
+            'N'.$this->getCharsetString(),
293 293
             $property
294 294
         );
295 295
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             // set property
299 299
             $this->setProperty(
300 300
                 'fullname',
301
-                'FN' . $this->getCharsetString(),
301
+                'FN'.$this->getCharsetString(),
302 302
                 trim(implode(' ', $values))
303 303
             );
304 304
         }
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     {
317 317
         $this->setProperty(
318 318
             'note',
319
-            'NOTE' . $this->getCharsetString(),
319
+            'NOTE'.$this->getCharsetString(),
320 320
             $note
321 321
         );
322 322
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     {
334 334
         $this->setProperty(
335 335
             'categories',
336
-            'CATEGORIES' . $this->getCharsetString(),
336
+            'CATEGORIES'.$this->getCharsetString(),
337 337
             trim(implode(',', $categories))
338 338
         );
339 339
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     {
355 355
         $this->setProperty(
356 356
             'phoneNumber',
357
-            'TEL' . (($type != '') ? ';' . $type : ''),
357
+            'TEL'.(($type != '') ? ';'.$type : ''),
358 358
             $number
359 359
         );
360 360
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
     {
411 411
         $this->setProperty(
412 412
             'url',
413
-            'URL' . (($type != '') ? ';' . $type : ''),
413
+            'URL'.(($type != '') ? ';'.$type : ''),
414 414
             $url
415 415
         );
416 416
 
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
         // init string
428 428
         $string = "BEGIN:VCARD\r\n";
429 429
         $string .= "VERSION:3.0\r\n";
430
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
430
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
431 431
 
432 432
         // loop all properties
433 433
         $properties = $this->getProperties();
434 434
         foreach ($properties as $property) {
435 435
             // add to string
436
-            $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n");
436
+            $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n");
437 437
         }
438 438
 
439 439
         // add to string
@@ -451,19 +451,19 @@  discard block
 block discarded – undo
451 451
     public function buildVCalendar()
452 452
     {
453 453
         // init dates
454
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
455
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
454
+        $dtstart = date("Ymd")."T".date("Hi")."00";
455
+        $dtend = date("Ymd")."T".date("Hi")."01";
456 456
 
457 457
         // init string
458 458
         $string = "BEGIN:VCALENDAR\n";
459 459
         $string .= "VERSION:2.0\n";
460 460
         $string .= "BEGIN:VEVENT\n";
461
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
462
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
461
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
462
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
463 463
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
464
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
464
+        $string .= "DTSTAMP:".$dtstart."Z\n";
465 465
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
466
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
466
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
467 467
 
468 468
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
469 469
         $b64vcard = base64_encode($this->buildVCard());
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
     {
591 591
         $charsetString = '';
592 592
         if ($this->charset == 'utf-8') {
593
-            $charsetString = ';CHARSET=' . $this->charset;
593
+            $charsetString = ';CHARSET='.$this->charset;
594 594
         }
595 595
 
596 596
         return $charsetString;
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
      */
641 641
     public function getHeaders($asAssociative)
642 642
     {
643
-        $contentType = $this->getContentType() . '; charset=' . $this->getCharset();
644
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
643
+        $contentType = $this->getContentType().'; charset='.$this->getCharset();
644
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
645 645
         $contentLength = mb_strlen($this->getOutput(), $this->getCharset());
646 646
         $connection = 'close';
647 647
 
648
-        if ((bool)$asAssociative) {
648
+        if ((bool) $asAssociative) {
649 649
             return array(
650 650
                 'Content-type' => $contentType,
651 651
                 'Content-Disposition' => $contentDisposition,
@@ -655,10 +655,10 @@  discard block
 block discarded – undo
655 655
         }
656 656
 
657 657
         return array(
658
-            'Content-type: ' . $contentType,
659
-            'Content-Disposition: ' . $contentDisposition,
660
-            'Content-Length: ' . $contentLength,
661
-            'Connection: ' . $connection,
658
+            'Content-type: '.$contentType,
659
+            'Content-Disposition: '.$contentDisposition,
660
+            'Content-Length: '.$contentLength,
661
+            'Connection: '.$connection,
662 662
         );
663 663
     }
664 664
 
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
      */
737 737
     public function save()
738 738
     {
739
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
739
+        $file = $this->getFilename().'.'.$this->getFileExtension();
740 740
 
741 741
         file_put_contents(
742 742
             $file,
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 
790 790
         // overwrite filename or add to filename using a prefix in between
791 791
         $this->filename = ($overwrite) ?
792
-            $value : $this->filename . $separator . $value;
792
+            $value : $this->filename.$separator.$value;
793 793
     }
794 794
 
795 795
     /**
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
         if (!in_array($element, $this->multiplePropertiesForElementAllowed)
806 806
             && isset($this->definedElements[$element])
807 807
         ) {
808
-            throw new Exception('You can only set "' . $element . '" once.');
808
+            throw new Exception('You can only set "'.$element.'" once.');
809 809
         }
810 810
 
811 811
         // we define that we set this element
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 
830 830
         $matches = array();
831 831
         preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches);
832
-        $version = isset($matches[1]) ? ((int)$matches[1]) : 999;
832
+        $version = isset($matches[1]) ? ((int) $matches[1]) : 999;
833 833
 
834 834
         return ($version < 8);
835 835
     }
Please login to merge, or discard this patch.