@@ -14,31 +14,31 @@ discard block |
||
14 | 14 | class VCard{ |
15 | 15 | |
16 | 16 | /** |
17 | - * existsElements |
|
18 | - * |
|
19 | - * @var array |
|
20 | - */ |
|
17 | + * existsElements |
|
18 | + * |
|
19 | + * @var array |
|
20 | + */ |
|
21 | 21 | private $existsElements; |
22 | 22 | |
23 | 23 | /** |
24 | - * charset |
|
25 | - * |
|
26 | - * @var string |
|
27 | - */ |
|
24 | + * charset |
|
25 | + * |
|
26 | + * @var string |
|
27 | + */ |
|
28 | 28 | private $charset = 'UTF-8'; |
29 | 29 | |
30 | 30 | /** |
31 | - * filename |
|
32 | - * |
|
33 | - * @var string |
|
34 | - */ |
|
31 | + * filename |
|
32 | + * |
|
33 | + * @var string |
|
34 | + */ |
|
35 | 35 | private $filename; |
36 | 36 | |
37 | 37 | /** |
38 | - * properties |
|
39 | - * |
|
40 | - * @var array |
|
41 | - */ |
|
38 | + * properties |
|
39 | + * |
|
40 | + * @var array |
|
41 | + */ |
|
42 | 42 | private $properties; |
43 | 43 | |
44 | 44 | /** |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | private $savePath = null; |
50 | 50 | |
51 | 51 | /** |
52 | - * multipleAllowed |
|
53 | - * |
|
54 | - * @var array |
|
55 | - */ |
|
52 | + * multipleAllowed |
|
53 | + * |
|
54 | + * @var array |
|
55 | + */ |
|
56 | 56 | |
57 | 57 | private $multipleAllowed; |
58 | 58 | |
59 | 59 | /** |
60 | - * Construct method |
|
61 | - * |
|
62 | - * Set filename on init and difine the multiple properties allowed |
|
63 | - * |
|
64 | - * @return string |
|
65 | - */ |
|
60 | + * Construct method |
|
61 | + * |
|
62 | + * Set filename on init and difine the multiple properties allowed |
|
63 | + * |
|
64 | + * @return string |
|
65 | + */ |
|
66 | 66 | |
67 | 67 | public function __construct() |
68 | 68 | { |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | - * Add names method |
|
84 | - * |
|
85 | - * @param string [optional] $lastName |
|
86 | - * @param string [optional] $firstName |
|
87 | - * @param string [optional] $additional |
|
88 | - * @param string [optional] $prefix |
|
89 | - * @param string [optional] $suffix |
|
90 | - * @return $this |
|
91 | - */ |
|
83 | + * Add names method |
|
84 | + * |
|
85 | + * @param string [optional] $lastName |
|
86 | + * @param string [optional] $firstName |
|
87 | + * @param string [optional] $additional |
|
88 | + * @param string [optional] $prefix |
|
89 | + * @param string [optional] $suffix |
|
90 | + * @return $this |
|
91 | + */ |
|
92 | 92 | |
93 | 93 | public function addNames( |
94 | 94 | $lastName = '', |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
112 | - * Add phone number |
|
113 | - * |
|
114 | - * @param string $number |
|
115 | - * @param string [optional] $type |
|
116 | - * TYPES = PREF | WORK | HOME | VOICE | FAX | MSG | |
|
117 | - * CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO |
|
118 | - * @return $this |
|
119 | - */ |
|
112 | + * Add phone number |
|
113 | + * |
|
114 | + * @param string $number |
|
115 | + * @param string [optional] $type |
|
116 | + * TYPES = PREF | WORK | HOME | VOICE | FAX | MSG | |
|
117 | + * CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO |
|
118 | + * @return $this |
|
119 | + */ |
|
120 | 120 | public function addPhone($number, $type = '') |
121 | 121 | { |
122 | 122 | $this->setProperty( |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | - * Add role |
|
133 | - * |
|
134 | - * @param string $role. |
|
135 | - * @return $this |
|
136 | - */ |
|
132 | + * Add role |
|
133 | + * |
|
134 | + * @param string $role. |
|
135 | + * @return $this |
|
136 | + */ |
|
137 | 137 | public function addRole($role) |
138 | 138 | { |
139 | 139 | $this->setProperty( |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
168 | - * Add company |
|
169 | - * |
|
170 | - * @param string $company |
|
171 | - * @param string $department |
|
172 | - * @return $this |
|
173 | - */ |
|
168 | + * Add company |
|
169 | + * |
|
170 | + * @param string $company |
|
171 | + * @param string $department |
|
172 | + * @return $this |
|
173 | + */ |
|
174 | 174 | public function addCompany($company, $department = '') |
175 | 175 | { |
176 | 176 | $this->setProperty( |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
187 | - * Add note |
|
188 | - * |
|
189 | - * @param string $note |
|
190 | - * @return $this |
|
191 | - */ |
|
187 | + * Add note |
|
188 | + * |
|
189 | + * @param string $note |
|
190 | + * @return $this |
|
191 | + */ |
|
192 | 192 | public function addNote($note) |
193 | 193 | { |
194 | 194 | $this->setProperty( |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
204 | - * Add Photo |
|
205 | - * |
|
206 | - * @param string $path image url or path |
|
207 | - * @return $this |
|
208 | - */ |
|
204 | + * Add Photo |
|
205 | + * |
|
206 | + * @param string $path image url or path |
|
207 | + * @return $this |
|
208 | + */ |
|
209 | 209 | public function addPhoto($path) |
210 | 210 | { |
211 | 211 | $mimeType = null; |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
263 | - * Add URL |
|
264 | - * |
|
265 | - * @param string $url |
|
266 | - * @param string [optional] $type Type may be WORK | HOME |
|
267 | - * @return $this |
|
268 | - */ |
|
263 | + * Add URL |
|
264 | + * |
|
265 | + * @param string $url |
|
266 | + * @param string [optional] $type Type may be WORK | HOME |
|
267 | + * @return $this |
|
268 | + */ |
|
269 | 269 | public function addURL($url, $type = '') |
270 | 270 | { |
271 | 271 | $this->setProperty( |
@@ -278,13 +278,13 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
281 | - * Add address |
|
282 | - * |
|
283 | - * @param string [optional] $socialProfile |
|
284 | - * @param string [optional] $type |
|
285 | - * TYPES = facebook | twitter | instagram | linkedin |
|
286 | - * @return $this |
|
287 | - */ |
|
281 | + * Add address |
|
282 | + * |
|
283 | + * @param string [optional] $socialProfile |
|
284 | + * @param string [optional] $type |
|
285 | + * TYPES = facebook | twitter | instagram | linkedin |
|
286 | + * @return $this |
|
287 | + */ |
|
288 | 288 | public function addSocialProfile($socialProfile, $type) |
289 | 289 | { |
290 | 290 | $this->setProperty( |
@@ -297,19 +297,19 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
300 | - * Add address |
|
301 | - * |
|
302 | - * @param string [optional] $name |
|
303 | - * @param string [optional] $extended |
|
304 | - * @param string [optional] $street |
|
305 | - * @param string [optional] $city |
|
306 | - * @param string [optional] $region |
|
307 | - * @param string [optional] $zip |
|
308 | - * @param string [optional] $country |
|
309 | - * @param string [optional] $type |
|
310 | - * TYPES = DOM | INTL | POSTAL | PARCEL | HOME | WORK |
|
311 | - * @return $this |
|
312 | - */ |
|
300 | + * Add address |
|
301 | + * |
|
302 | + * @param string [optional] $name |
|
303 | + * @param string [optional] $extended |
|
304 | + * @param string [optional] $street |
|
305 | + * @param string [optional] $city |
|
306 | + * @param string [optional] $region |
|
307 | + * @param string [optional] $zip |
|
308 | + * @param string [optional] $country |
|
309 | + * @param string [optional] $type |
|
310 | + * TYPES = DOM | INTL | POSTAL | PARCEL | HOME | WORK |
|
311 | + * @return $this |
|
312 | + */ |
|
313 | 313 | public function addAddress( |
314 | 314 | $name = '', |
315 | 315 | $extended = '', |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
336 | - * Add custom |
|
337 | - * |
|
338 | - * @param string [optional] $custom |
|
339 | - * @return $this |
|
340 | - */ |
|
336 | + * Add custom |
|
337 | + * |
|
338 | + * @param string [optional] $custom |
|
339 | + * @return $this |
|
340 | + */ |
|
341 | 341 | public function addCustom($custom) |
342 | 342 | { |
343 | 343 | $this->setProperty( |
@@ -349,41 +349,41 @@ discard block |
||
349 | 349 | return $this; |
350 | 350 | } |
351 | 351 | /** |
352 | - * Set charset string |
|
353 | - */ |
|
352 | + * Set charset string |
|
353 | + */ |
|
354 | 354 | public function setCharset($charset) |
355 | 355 | { |
356 | 356 | $this->charset = $charset; |
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
360 | - * Get charset in vCard |
|
361 | - * |
|
362 | - * @return string |
|
363 | - */ |
|
360 | + * Get charset in vCard |
|
361 | + * |
|
362 | + * @return string |
|
363 | + */ |
|
364 | 364 | public function getCharsetInVCard() |
365 | 365 | { |
366 | 366 | return ';CHARSET=' . $this->charset; |
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
370 | - * Get charset string |
|
371 | - * |
|
372 | - * @return string |
|
373 | - */ |
|
370 | + * Get charset string |
|
371 | + * |
|
372 | + * @return string |
|
373 | + */ |
|
374 | 374 | public function getCharset() |
375 | 375 | { |
376 | 376 | return $this->charset; |
377 | 377 | } |
378 | 378 | |
379 | 379 | /** |
380 | - * Set property |
|
381 | - * |
|
382 | - * @param string $element |
|
383 | - * @param string $key |
|
384 | - * @param string $value |
|
385 | - * @throws VCardException |
|
386 | - */ |
|
380 | + * Set property |
|
381 | + * |
|
382 | + * @param string $element |
|
383 | + * @param string $key |
|
384 | + * @param string $value |
|
385 | + * @throws VCardException |
|
386 | + */ |
|
387 | 387 | public function setFilename($value, $overwrite = true) |
388 | 388 | { |
389 | 389 | $value = trim($value); |
@@ -401,10 +401,10 @@ discard block |
||
401 | 401 | } |
402 | 402 | |
403 | 403 | /** |
404 | - * Get filename |
|
405 | - * |
|
406 | - * @return string |
|
407 | - */ |
|
404 | + * Get filename |
|
405 | + * |
|
406 | + * @return string |
|
407 | + */ |
|
408 | 408 | public function getFilename() |
409 | 409 | { |
410 | 410 | if (!$this->filename) { |
@@ -415,13 +415,13 @@ discard block |
||
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
418 | - * Set property |
|
419 | - * |
|
420 | - * @param string $element |
|
421 | - * @param string $key |
|
422 | - * @param string $value |
|
423 | - * @throws VCardException |
|
424 | - */ |
|
418 | + * Set property |
|
419 | + * |
|
420 | + * @param string $element |
|
421 | + * @param string $key |
|
422 | + * @param string $value |
|
423 | + * @throws VCardException |
|
424 | + */ |
|
425 | 425 | |
426 | 426 | private function setProperty($element, $key, $value) |
427 | 427 | { |
@@ -473,11 +473,11 @@ discard block |
||
473 | 473 | } |
474 | 474 | |
475 | 475 | /** |
476 | - * Set the save path directory |
|
477 | - * |
|
478 | - * @param string $savePath Save Path |
|
479 | - * @throws VCardException |
|
480 | - */ |
|
476 | + * Set the save path directory |
|
477 | + * |
|
478 | + * @param string $savePath Save Path |
|
479 | + * @throws VCardException |
|
480 | + */ |
|
481 | 481 | public function setSavePath($savePath) |
482 | 482 | { |
483 | 483 | if (!is_dir($savePath)) { |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | |
516 | 516 | |
517 | 517 | /** |
518 | - * Fold a line according to RFC2425 section 5.8.1. |
|
519 | - * |
|
520 | - * @link http://tools.ietf.org/html/rfc2425#section-5.8.1 |
|
521 | - * @param string $text |
|
522 | - * @return mixed |
|
523 | - */ |
|
518 | + * Fold a line according to RFC2425 section 5.8.1. |
|
519 | + * |
|
520 | + * @link http://tools.ietf.org/html/rfc2425#section-5.8.1 |
|
521 | + * @param string $text |
|
522 | + * @return mixed |
|
523 | + */ |
|
524 | 524 | protected function fold($text) |
525 | 525 | { |
526 | 526 | if (strlen($text) <= 75) { |
@@ -532,14 +532,14 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | /** |
535 | - * multibyte word chunk split |
|
536 | - * @link http://php.net/manual/en/function.chunk-split.php#107711 |
|
537 | - * |
|
538 | - * @param string $body The string to be chunked. |
|
539 | - * @param integer $chunklen The chunk length. |
|
540 | - * @param string $end The line ending sequence. |
|
541 | - * @return string Chunked string |
|
542 | - */ |
|
535 | + * multibyte word chunk split |
|
536 | + * @link http://php.net/manual/en/function.chunk-split.php#107711 |
|
537 | + * |
|
538 | + * @param string $body The string to be chunked. |
|
539 | + * @param integer $chunklen The chunk length. |
|
540 | + * @param string $end The line ending sequence. |
|
541 | + * @return string Chunked string |
|
542 | + */ |
|
543 | 543 | protected function chunk_split_unicode($body, $chunklen = 76, $end = "\r\n") |
544 | 544 | { |
545 | 545 | $array = array_chunk( |
@@ -552,12 +552,12 @@ discard block |
||
552 | 552 | } |
553 | 553 | |
554 | 554 | /** |
555 | - * Escape newline characters according to RFC2425 section 5.8.4. |
|
556 | - * |
|
557 | - * @link http://tools.ietf.org/html/rfc2425#section-5.8.4 |
|
558 | - * @param string $text |
|
559 | - * @return string |
|
560 | - */ |
|
555 | + * Escape newline characters according to RFC2425 section 5.8.4. |
|
556 | + * |
|
557 | + * @link http://tools.ietf.org/html/rfc2425#section-5.8.4 |
|
558 | + * @param string $text |
|
559 | + * @return string |
|
560 | + */ |
|
561 | 561 | protected function escape($text) |
562 | 562 | { |
563 | 563 | $text = str_replace("\r\n", "\\n", $text); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Rogers Corrêa |
12 | 12 | */ |
13 | 13 | |
14 | -class VCard{ |
|
14 | +class VCard { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * existsElements |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $additional = '', |
97 | 97 | $prefix = '', |
98 | 98 | $suffix = '' |
99 | - ){ |
|
99 | + ) { |
|
100 | 100 | // set property |
101 | 101 | $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix; |
102 | 102 | $this->setProperty( |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | { |
290 | 290 | $this->setProperty( |
291 | 291 | 'social', |
292 | - 'X-SOCIALPROFILE;type='. $type, |
|
292 | + 'X-SOCIALPROFILE;type=' . $type, |
|
293 | 293 | $socialProfile |
294 | 294 | ); |
295 | 295 |