Completed
Pull Request — master (#61)
by
unknown
02:49
created
src/VCard.php 1 patch
Spacing   +28 added lines, -28 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 : ''),
92
+            'ADR'.(($type != '') ? ';'.$type : ''),
93 93
             $value
94 94
         );
95 95
 
@@ -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
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             $value = base64_encode($value);
193 193
 
194 194
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
195
-            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,' . $value);
195
+            $mimetype = finfo_file($finfo, 'data://application/octet-stream;base64,'.$value);
196 196
             finfo_close($finfo);
197 197
 
198 198
             if (preg_match('/^image\//', $mimetype) !== 1) {
@@ -201,20 +201,20 @@  discard block
 block discarded – undo
201 201
 
202 202
             $type = strtoupper(str_replace('image/', '', $mimetype));
203 203
 
204
-            $property .= ";ENCODING=b;TYPE=" . $type;
204
+            $property .= ";ENCODING=b;TYPE=".$type;
205 205
         } else {
206 206
 
207 207
             $propertySuffix = ';VALUE=URL';
208 208
 
209 209
             $headers = get_headers($url);
210 210
             $imageTypeMatched = preg_match('/Content-Type:\simage\/([a-z]+)/i', $headers[8], $m);
211
-            if(!$imageTypeMatched) {
211
+            if (!$imageTypeMatched) {
212 212
                 throw new VCardMediaException('Returned data isn\'t an image.');
213 213
             }
214 214
 
215
-            $propertySuffix .= ';TYPE=' . strtoupper($m[1]);
215
+            $propertySuffix .= ';TYPE='.strtoupper($m[1]);
216 216
 
217
-            $property = $property . $propertySuffix;
217
+            $property = $property.$propertySuffix;
218 218
             $value = $url;
219 219
 
220 220
         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         $this->setFilename($values);
257 257
 
258 258
         // set property
259
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
259
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
260 260
         $this->setProperty(
261 261
             'name',
262 262
             'N',
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     {
308 308
         $this->setProperty(
309 309
             'phoneNumber',
310
-            'TEL' . (($type != '') ? ';' . $type : ''),
310
+            'TEL'.(($type != '') ? ';'.$type : ''),
311 311
             $number
312 312
         );
313 313
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
     {
345 345
         $this->setProperty(
346 346
             'url',
347
-            'URL' . (($type != '') ? ';' . $type : ''),
347
+            'URL'.(($type != '') ? ';'.$type : ''),
348 348
             $url
349 349
         );
350 350
 
@@ -361,13 +361,13 @@  discard block
 block discarded – undo
361 361
         // init string
362 362
         $string = "BEGIN:VCARD\r\n";
363 363
         $string .= "VERSION:3.0\r\n";
364
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
364
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
365 365
 
366 366
         // loop all properties
367 367
         $properties = $this->getProperties();
368 368
         foreach ($properties as $property) {
369 369
             // add to string
370
-            $string .= $this->fold($property['key'] . ':' . $property['value'] . "\r\n");
370
+            $string .= $this->fold($property['key'].':'.$property['value']."\r\n");
371 371
         }
372 372
 
373 373
         // add to string
@@ -385,19 +385,19 @@  discard block
 block discarded – undo
385 385
     public function buildVCalendar()
386 386
     {
387 387
         // init dates
388
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
389
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
388
+        $dtstart = date("Ymd")."T".date("Hi")."00";
389
+        $dtend = date("Ymd")."T".date("Hi")."01";
390 390
 
391 391
         // init string
392 392
         $string = "BEGIN:VCALENDAR\n";
393 393
         $string .= "VERSION:2.0\n";
394 394
         $string .= "BEGIN:VEVENT\n";
395
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
396
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
395
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
396
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
397 397
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
398
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
398
+        $string .= "DTSTAMP:".$dtstart."Z\n";
399 399
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
400
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
400
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
401 401
 
402 402
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
403 403
         $b64vcard = base64_encode($this->buildVCard());
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
      */
541 541
     public function getHeaders($asAssociative)
542 542
     {
543
-        $contentType        = $this->getContentType() . '; charset=' . $this->getCharset();
544
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
543
+        $contentType        = $this->getContentType().'; charset='.$this->getCharset();
544
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
545 545
         $contentLength      = strlen($this->getOutput());
546 546
         $connection         = 'close';
547 547
 
@@ -555,10 +555,10 @@  discard block
 block discarded – undo
555 555
         }
556 556
 
557 557
         return array(
558
-            'Content-type: ' . $contentType,
559
-            'Content-Disposition: ' . $contentDisposition,
560
-            'Content-Length: ' . $contentLength,
561
-            'Connection: ' . $connection,
558
+            'Content-type: '.$contentType,
559
+            'Content-Disposition: '.$contentDisposition,
560
+            'Content-Length: '.$contentLength,
561
+            'Connection: '.$connection,
562 562
         );
563 563
     }
564 564
 
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
      */
642 642
     public function save()
643 643
     {
644
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
644
+        $file = $this->getFilename().'.'.$this->getFileExtension();
645 645
 
646 646
         file_put_contents(
647 647
             $file,
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 
695 695
         // overwrite filename or add to filename using a prefix in between
696 696
         $this->filename = ($overwrite) ?
697
-            $value : $this->filename . $separator . $value;
697
+            $value : $this->filename.$separator.$value;
698 698
     }
699 699
 
700 700
     /**
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
         if (!in_array($element, $this->multiplePropertiesForElementAllowed)
711 711
             && isset($this->definedElements[$element])
712 712
         ) {
713
-            throw new Exception('You can only set "' . $element . '" once.');
713
+            throw new Exception('You can only set "'.$element.'" once.');
714 714
         }
715 715
 
716 716
         // we define that we set this element
Please login to merge, or discard this patch.