Completed
Push — master ( 80ae61...4726ae )
by Jeroen
8s
created
examples/example.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
  * @author Jeroen Desloovere <[email protected]>
7 7
  */
8 8
 
9
-require_once __DIR__ . '/../vendor/autoload.php';
10
-require_once __DIR__ . '/../src/VCard.php';
9
+require_once __DIR__.'/../vendor/autoload.php';
10
+require_once __DIR__.'/../src/VCard.php';
11 11
 
12 12
 use JeroenDesloovere\VCard\VCard;
13 13
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 $vcard->addAddress(null, null, 'street', 'worktown', null, 'workpostcode', 'Belgium');
34 34
 $vcard->addURL('http://www.jeroendesloovere.be');
35 35
 
36
-$vcard->addPhoto(__DIR__ . '/assets/landscape.jpeg');
36
+$vcard->addPhoto(__DIR__.'/assets/landscape.jpeg');
37 37
 
38 38
 // return vcard as a string
39 39
 //return $vcard->getOutput();
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 return $vcard->download();
43 43
 
44 44
 // echo message
45
-echo 'A personal vCard is saved in this folder: ' . __DIR__;
45
+echo 'A personal vCard is saved in this folder: '.__DIR__;
46 46
 
47 47
 // or
48 48
 
Please login to merge, or discard this patch.
src/VCard.php 1 patch
Spacing   +31 added lines, -31 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
 
@@ -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,7 +201,7 @@  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
             $value = $url;
207 207
         }
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
         $this->setFilename($values);
244 244
 
245 245
         // set property
246
-        $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix;
246
+        $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix;
247 247
         $this->setProperty(
248 248
             'name',
249
-            'N' . $this->getCharsetString(),
249
+            'N'.$this->getCharsetString(),
250 250
             $property
251 251
         );
252 252
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             // set property
256 256
             $this->setProperty(
257 257
                 'fullname',
258
-                'FN' . $this->getCharsetString(),
258
+                'FN'.$this->getCharsetString(),
259 259
                 trim(implode(' ', $values))
260 260
             );
261 261
         }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     {
274 274
         $this->setProperty(
275 275
             'note',
276
-            'NOTE' . $this->getCharsetString(),
276
+            'NOTE'.$this->getCharsetString(),
277 277
             $note
278 278
         );
279 279
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     {
295 295
         $this->setProperty(
296 296
             'phoneNumber',
297
-            'TEL' . (($type != '') ? ';' . $type : ''),
297
+            'TEL'.(($type != '') ? ';'.$type : ''),
298 298
             $number
299 299
         );
300 300
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
     {
332 332
         $this->setProperty(
333 333
             'url',
334
-            'URL' . (($type != '') ? ';' . $type : ''),
334
+            'URL'.(($type != '') ? ';'.$type : ''),
335 335
             $url
336 336
         );
337 337
 
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
         // init string
349 349
         $string = "BEGIN:VCARD\r\n";
350 350
         $string .= "VERSION:3.0\r\n";
351
-        $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n";
351
+        $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
352 352
 
353 353
         // loop all properties
354 354
         $properties = $this->getProperties();
355 355
         foreach ($properties as $property) {
356 356
             // add to string
357
-            $string .= $this->fold($property['key'] . ':' . $property['value'] . "\r\n");
357
+            $string .= $this->fold($property['key'].':'.$property['value']."\r\n");
358 358
         }
359 359
 
360 360
         // add to string
@@ -372,19 +372,19 @@  discard block
 block discarded – undo
372 372
     public function buildVCalendar()
373 373
     {
374 374
         // init dates
375
-        $dtstart = date("Ymd") . "T" . date("Hi") . "00";
376
-        $dtend = date("Ymd") . "T" . date("Hi") . "01";
375
+        $dtstart = date("Ymd")."T".date("Hi")."00";
376
+        $dtend = date("Ymd")."T".date("Hi")."01";
377 377
 
378 378
         // init string
379 379
         $string = "BEGIN:VCALENDAR\n";
380 380
         $string .= "VERSION:2.0\n";
381 381
         $string .= "BEGIN:VEVENT\n";
382
-        $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n";
383
-        $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n";
382
+        $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n";
383
+        $string .= "DTEND;TZID=Europe/London:".$dtend."\n";
384 384
         $string .= "SUMMARY:Click attached contact below to save to your contacts\n";
385
-        $string .= "DTSTAMP:" . $dtstart . "Z\n";
385
+        $string .= "DTSTAMP:".$dtstart."Z\n";
386 386
         $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n";
387
-        $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n";
387
+        $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n";
388 388
 
389 389
         // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment
390 390
         $b64vcard = base64_encode($this->buildVCard());
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     {
497 497
         $charsetString = '';
498 498
         if ($this->charset == 'utf-8') {
499
-            $charsetString = ';CHARSET=' . $this->charset;
499
+            $charsetString = ';CHARSET='.$this->charset;
500 500
         }
501 501
         return $charsetString;
502 502
     }
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
      */
542 542
     public function getHeaders($asAssociative)
543 543
     {
544
-        $contentType        = $this->getContentType() . '; charset=' . $this->getCharset();
545
-        $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension();
544
+        $contentType        = $this->getContentType().'; charset='.$this->getCharset();
545
+        $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension();
546 546
         $contentLength      = strlen($this->getOutput());
547 547
         $connection         = 'close';
548 548
 
@@ -556,10 +556,10 @@  discard block
 block discarded – undo
556 556
         }
557 557
 
558 558
         return array(
559
-            'Content-type: ' . $contentType,
560
-            'Content-Disposition: ' . $contentDisposition,
561
-            'Content-Length: ' . $contentLength,
562
-            'Connection: ' . $connection,
559
+            'Content-type: '.$contentType,
560
+            'Content-Disposition: '.$contentDisposition,
561
+            'Content-Length: '.$contentLength,
562
+            'Connection: '.$connection,
563 563
         );
564 564
     }
565 565
 
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
      */
638 638
     public function save()
639 639
     {
640
-        $file = $this->getFilename() . '.' . $this->getFileExtension();
640
+        $file = $this->getFilename().'.'.$this->getFileExtension();
641 641
 
642 642
         file_put_contents(
643 643
             $file,
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 
691 691
         // overwrite filename or add to filename using a prefix in between
692 692
         $this->filename = ($overwrite) ?
693
-            $value : $this->filename . $separator . $value;
693
+            $value : $this->filename.$separator.$value;
694 694
     }
695 695
 
696 696
     /**
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
         if (!in_array($element, $this->multiplePropertiesForElementAllowed)
707 707
             && isset($this->definedElements[$element])
708 708
         ) {
709
-            throw new Exception('You can only set "' . $element . '" once.');
709
+            throw new Exception('You can only set "'.$element.'" once.');
710 710
         }
711 711
 
712 712
         // we define that we set this element
Please login to merge, or discard this patch.
src/VCardParser.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @param string $filename
56 56
      *
57
-     * @return JeroenDesloovere\VCard\VCardParser
57
+     * @return VCardParser
58 58
      */
59 59
     public static function parseFromFile($filename)
60 60
     {
@@ -65,6 +65,9 @@  discard block
 block discarded – undo
65 65
         }
66 66
     }
67 67
 
68
+    /**
69
+     * @param string $content
70
+     */
68 71
     public function __construct($content)
69 72
     {
70 73
         $this->content = $content;
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
     /**
39 39
      * The raw VCard content.
40
-    *
40
+     *
41 41
      * @var string
42 42
      */
43 43
     protected $content;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@
 block discarded – undo
154 154
                         $cardData->fullname = $value;
155 155
                         break;
156 156
                     case 'N':
157
-                        foreach($this->parseName($value) as $key => $val) {
157
+                        foreach ($this->parseName($value) as $key => $val) {
158 158
                             $cardData->{$key} = $val;
159 159
                         }
160 160
                         break;
Please login to merge, or discard this patch.