Completed
Pull Request — master (#90)
by
unknown
03:55
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
 
@@ -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());
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
             preg_split("//u", $body, -1, PREG_SPLIT_NO_EMPTY), $chunklen);
565 565
         $body = "";
566 566
         foreach ($array as $item) {
567
-            $body .= join("", $item) . $end;
567
+            $body .= join("", $item).$end;
568 568
         }
569 569
         return $body;
570 570
     }
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
     {
615 615
         $charsetString = '';
616 616
         if ($this->charset == 'utf-8') {
617
-            $charsetString = ';CHARSET=' . $this->charset;
617
+            $charsetString = ';CHARSET='.$this->charset;
618 618
         }
619 619
 
620 620
         return $charsetString;
@@ -664,12 +664,12 @@  discard block
 block discarded – undo
664 664
      */
665 665
     public function getHeaders($asAssociative)
666 666
     {
667
-        $contentType = $this->getContentType() . '; charset=' . $this->getCharset();
668
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
667
+        $contentType = $this->getContentType().'; charset='.$this->getCharset();
668
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
669 669
         $contentLength = mb_strlen($this->getOutput(), $this->getCharset());
670 670
         $connection = 'close';
671 671
 
672
-        if ((bool)$asAssociative) {
672
+        if ((bool) $asAssociative) {
673 673
             return array(
674 674
                 'Content-type' => $contentType,
675 675
                 'Content-Disposition' => $contentDisposition,
@@ -679,10 +679,10 @@  discard block
 block discarded – undo
679 679
         }
680 680
 
681 681
         return array(
682
-            'Content-type: ' . $contentType,
683
-            'Content-Disposition: ' . $contentDisposition,
684
-            'Content-Length: ' . $contentLength,
685
-            'Connection: ' . $connection,
682
+            'Content-type: '.$contentType,
683
+            'Content-Disposition: '.$contentDisposition,
684
+            'Content-Length: '.$contentLength,
685
+            'Connection: '.$connection,
686 686
         );
687 687
     }
688 688
 
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
      */
761 761
     public function save()
762 762
     {
763
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
763
+        $file = $this->getFilename().'.'.$this->getFileExtension();
764 764
 
765 765
         // Add save path if given
766 766
         if (null !== $this->savePath) {
767
-            $file = $this->savePath . $file;
767
+            $file = $this->savePath.$file;
768 768
         }
769 769
 
770 770
         file_put_contents(
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 
819 819
         // overwrite filename or add to filename using a prefix in between
820 820
         $this->filename = ($overwrite) ?
821
-            $value : $this->filename . $separator . $value;
821
+            $value : $this->filename.$separator.$value;
822 822
     }
823 823
 
824 824
     /**
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
         if (!in_array($element, $this->multiplePropertiesForElementAllowed)
855 855
             && isset($this->definedElements[$element])
856 856
         ) {
857
-            throw new Exception('You can only set "' . $element . '" once.');
857
+            throw new Exception('You can only set "'.$element.'" once.');
858 858
         }
859 859
 
860 860
         // we define that we set this element
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 
879 879
         $matches = array();
880 880
         preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches);
881
-        $version = isset($matches[1]) ? ((int)$matches[1]) : 999;
881
+        $version = isset($matches[1]) ? ((int) $matches[1]) : 999;
882 882
 
883 883
         return ($version < 8);
884 884
     }
Please login to merge, or discard this patch.