@@ -11,31 +11,31 @@ discard block |
||
| 11 | 11 | class VCard{ |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * existsElements |
|
| 15 | - * |
|
| 16 | - * @var array |
|
| 17 | - */ |
|
| 14 | + * existsElements |
|
| 15 | + * |
|
| 16 | + * @var array |
|
| 17 | + */ |
|
| 18 | 18 | private $existsElements; |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * charset |
|
| 22 | - * |
|
| 23 | - * @var string |
|
| 24 | - */ |
|
| 21 | + * charset |
|
| 22 | + * |
|
| 23 | + * @var string |
|
| 24 | + */ |
|
| 25 | 25 | private $charset = 'UTF-8'; |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * filename |
|
| 29 | - * |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 28 | + * filename |
|
| 29 | + * |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | 32 | private $filename; |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * properties |
|
| 36 | - * |
|
| 37 | - * @var array |
|
| 38 | - */ |
|
| 35 | + * properties |
|
| 36 | + * |
|
| 37 | + * @var array |
|
| 38 | + */ |
|
| 39 | 39 | private $properties; |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -46,20 +46,20 @@ discard block |
||
| 46 | 46 | private $savePath = null; |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * multipleAllowed |
|
| 50 | - * |
|
| 51 | - * @var array |
|
| 52 | - */ |
|
| 49 | + * multipleAllowed |
|
| 50 | + * |
|
| 51 | + * @var array |
|
| 52 | + */ |
|
| 53 | 53 | |
| 54 | 54 | private $multipleAllowed; |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * Construct method |
|
| 58 | - * |
|
| 59 | - * Set filename on init and difine the multiple properties allowed |
|
| 60 | - * |
|
| 61 | - * @return string |
|
| 62 | - */ |
|
| 57 | + * Construct method |
|
| 58 | + * |
|
| 59 | + * Set filename on init and difine the multiple properties allowed |
|
| 60 | + * |
|
| 61 | + * @return string |
|
| 62 | + */ |
|
| 63 | 63 | |
| 64 | 64 | public function __construct() |
| 65 | 65 | { |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * Add names method |
|
| 81 | - * |
|
| 82 | - * @param string [optional] $lastName |
|
| 83 | - * @param string [optional] $firstName |
|
| 84 | - * @param string [optional] $additional |
|
| 85 | - * @param string [optional] $prefix |
|
| 86 | - * @param string [optional] $suffix |
|
| 87 | - * @return $this |
|
| 88 | - */ |
|
| 80 | + * Add names method |
|
| 81 | + * |
|
| 82 | + * @param string [optional] $lastName |
|
| 83 | + * @param string [optional] $firstName |
|
| 84 | + * @param string [optional] $additional |
|
| 85 | + * @param string [optional] $prefix |
|
| 86 | + * @param string [optional] $suffix |
|
| 87 | + * @return $this |
|
| 88 | + */ |
|
| 89 | 89 | |
| 90 | 90 | public function addNames( |
| 91 | 91 | $lastName = '', |
@@ -123,14 +123,14 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | - * Add phone number |
|
| 127 | - * |
|
| 128 | - * @param string $number |
|
| 129 | - * @param string $type |
|
| 130 | - * TYPES = PREF | WORK | HOME | VOICE | FAX | MSG | |
|
| 131 | - * CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO |
|
| 132 | - * @return $this |
|
| 133 | - */ |
|
| 126 | + * Add phone number |
|
| 127 | + * |
|
| 128 | + * @param string $number |
|
| 129 | + * @param string $type |
|
| 130 | + * TYPES = PREF | WORK | HOME | VOICE | FAX | MSG | |
|
| 131 | + * CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO |
|
| 132 | + * @return $this |
|
| 133 | + */ |
|
| 134 | 134 | public function addPhone($number, $type = '') |
| 135 | 135 | { |
| 136 | 136 | $this->setProperty( |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | - * Add role |
|
| 147 | - * |
|
| 148 | - * @param string $role |
|
| 149 | - * @return $this |
|
| 150 | - */ |
|
| 146 | + * Add role |
|
| 147 | + * |
|
| 148 | + * @param string $role |
|
| 149 | + * @return $this |
|
| 150 | + */ |
|
| 151 | 151 | public function addRole($role) |
| 152 | 152 | { |
| 153 | 153 | $this->setProperty( |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | - * Add jobtitle |
|
| 164 | - * |
|
| 165 | - * @param string $jobtitle |
|
| 166 | - * @return $this |
|
| 167 | - */ |
|
| 163 | + * Add jobtitle |
|
| 164 | + * |
|
| 165 | + * @param string $jobtitle |
|
| 166 | + * @return $this |
|
| 167 | + */ |
|
| 168 | 168 | public function addJobtitle($jobtitle) |
| 169 | 169 | { |
| 170 | 170 | $this->setProperty( |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | - * Add birthday |
|
| 180 | - * |
|
| 181 | - * @param string $date - YYYY-MM-DD |
|
| 182 | - * @return $this |
|
| 183 | - */ |
|
| 179 | + * Add birthday |
|
| 180 | + * |
|
| 181 | + * @param string $date - YYYY-MM-DD |
|
| 182 | + * @return $this |
|
| 183 | + */ |
|
| 184 | 184 | public function addBirthday($date) |
| 185 | 185 | { |
| 186 | 186 | $this->setProperty( |
@@ -211,12 +211,12 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | - * Add company |
|
| 215 | - * |
|
| 216 | - * @param string $company |
|
| 217 | - * @param string $department |
|
| 218 | - * @return $this |
|
| 219 | - */ |
|
| 214 | + * Add company |
|
| 215 | + * |
|
| 216 | + * @param string $company |
|
| 217 | + * @param string $department |
|
| 218 | + * @return $this |
|
| 219 | + */ |
|
| 220 | 220 | public function addCompany($company, $department = '') |
| 221 | 221 | { |
| 222 | 222 | $this->setProperty( |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | - * Add note |
|
| 234 | - * |
|
| 235 | - * @param string $note |
|
| 236 | - * @return $this |
|
| 237 | - */ |
|
| 233 | + * Add note |
|
| 234 | + * |
|
| 235 | + * @param string $note |
|
| 236 | + * @return $this |
|
| 237 | + */ |
|
| 238 | 238 | public function addNote($note) |
| 239 | 239 | { |
| 240 | 240 | $this->setProperty( |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | - * Add Photo |
|
| 251 | - * |
|
| 252 | - * @param string $path image url or path |
|
| 253 | - * @return $this |
|
| 254 | - */ |
|
| 250 | + * Add Photo |
|
| 251 | + * |
|
| 252 | + * @param string $path image url or path |
|
| 253 | + * @return $this |
|
| 254 | + */ |
|
| 255 | 255 | public function addPhoto($path) |
| 256 | 256 | { |
| 257 | 257 | $mimeType = null; |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | - * Add URL |
|
| 310 | - * |
|
| 311 | - * @param string $url |
|
| 312 | - * @param string [optional] $type Type may be WORK | HOME |
|
| 313 | - * @return $this |
|
| 314 | - */ |
|
| 309 | + * Add URL |
|
| 310 | + * |
|
| 311 | + * @param string $url |
|
| 312 | + * @param string [optional] $type Type may be WORK | HOME |
|
| 313 | + * @return $this |
|
| 314 | + */ |
|
| 315 | 315 | public function addURL($url, $type = '') |
| 316 | 316 | { |
| 317 | 317 | $this->setProperty( |
@@ -324,13 +324,13 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
| 327 | - * Add address |
|
| 328 | - * |
|
| 329 | - * @param string [optional] $socialProfile |
|
| 330 | - * @param string [optional] $type |
|
| 331 | - * TYPES = facebook | twitter | instagram | linkedin |
|
| 332 | - * @return $this |
|
| 333 | - */ |
|
| 327 | + * Add address |
|
| 328 | + * |
|
| 329 | + * @param string [optional] $socialProfile |
|
| 330 | + * @param string [optional] $type |
|
| 331 | + * TYPES = facebook | twitter | instagram | linkedin |
|
| 332 | + * @return $this |
|
| 333 | + */ |
|
| 334 | 334 | public function addSocialProfile($socialProfile, $type) |
| 335 | 335 | { |
| 336 | 336 | $this->setProperty( |
@@ -343,19 +343,19 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /** |
| 346 | - * Add address |
|
| 347 | - * |
|
| 348 | - * @param string [optional] $name |
|
| 349 | - * @param string [optional] $extended |
|
| 350 | - * @param string [optional] $street |
|
| 351 | - * @param string [optional] $city |
|
| 352 | - * @param string [optional] $region |
|
| 353 | - * @param string [optional] $zip |
|
| 354 | - * @param string [optional] $country |
|
| 355 | - * @param string [optional] $type |
|
| 356 | - * TYPES = DOM | INTL | POSTAL | PARCEL | HOME | WORK |
|
| 357 | - * @return $this |
|
| 358 | - */ |
|
| 346 | + * Add address |
|
| 347 | + * |
|
| 348 | + * @param string [optional] $name |
|
| 349 | + * @param string [optional] $extended |
|
| 350 | + * @param string [optional] $street |
|
| 351 | + * @param string [optional] $city |
|
| 352 | + * @param string [optional] $region |
|
| 353 | + * @param string [optional] $zip |
|
| 354 | + * @param string [optional] $country |
|
| 355 | + * @param string [optional] $type |
|
| 356 | + * TYPES = DOM | INTL | POSTAL | PARCEL | HOME | WORK |
|
| 357 | + * @return $this |
|
| 358 | + */ |
|
| 359 | 359 | public function addAddress( |
| 360 | 360 | $name = '', |
| 361 | 361 | $extended = '', |
@@ -379,12 +379,12 @@ discard block |
||
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
| 382 | - * Add custom |
|
| 383 | - * |
|
| 384 | - * @param string $param |
|
| 385 | - * @param string $custom |
|
| 386 | - * @return $this |
|
| 387 | - */ |
|
| 382 | + * Add custom |
|
| 383 | + * |
|
| 384 | + * @param string $param |
|
| 385 | + * @param string $custom |
|
| 386 | + * @return $this |
|
| 387 | + */ |
|
| 388 | 388 | public function addCustom($param, $custom) |
| 389 | 389 | { |
| 390 | 390 | $this->setProperty( |
@@ -396,41 +396,41 @@ discard block |
||
| 396 | 396 | return $this; |
| 397 | 397 | } |
| 398 | 398 | /** |
| 399 | - * Set charset string |
|
| 400 | - */ |
|
| 399 | + * Set charset string |
|
| 400 | + */ |
|
| 401 | 401 | public function setCharset($charset) |
| 402 | 402 | { |
| 403 | 403 | $this->charset = $charset; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
| 407 | - * Get charset in vCard |
|
| 408 | - * |
|
| 409 | - * @return string |
|
| 410 | - */ |
|
| 407 | + * Get charset in vCard |
|
| 408 | + * |
|
| 409 | + * @return string |
|
| 410 | + */ |
|
| 411 | 411 | public function getCharsetInVCard() |
| 412 | 412 | { |
| 413 | 413 | return ';CHARSET=' . $this->charset; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /** |
| 417 | - * Get charset string |
|
| 418 | - * |
|
| 419 | - * @return string |
|
| 420 | - */ |
|
| 417 | + * Get charset string |
|
| 418 | + * |
|
| 419 | + * @return string |
|
| 420 | + */ |
|
| 421 | 421 | public function getCharset() |
| 422 | 422 | { |
| 423 | 423 | return $this->charset; |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | /** |
| 427 | - * Set property |
|
| 428 | - * |
|
| 429 | - * @param string $element |
|
| 430 | - * @param string $key |
|
| 431 | - * @param string $value |
|
| 432 | - * @throws VCardException |
|
| 433 | - */ |
|
| 427 | + * Set property |
|
| 428 | + * |
|
| 429 | + * @param string $element |
|
| 430 | + * @param string $key |
|
| 431 | + * @param string $value |
|
| 432 | + * @throws VCardException |
|
| 433 | + */ |
|
| 434 | 434 | public function setFilename($value, $overwrite = true) |
| 435 | 435 | { |
| 436 | 436 | $value = trim($value); |
@@ -448,10 +448,10 @@ discard block |
||
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
| 451 | - * Get filename |
|
| 452 | - * |
|
| 453 | - * @return string |
|
| 454 | - */ |
|
| 451 | + * Get filename |
|
| 452 | + * |
|
| 453 | + * @return string |
|
| 454 | + */ |
|
| 455 | 455 | public function getFilename() |
| 456 | 456 | { |
| 457 | 457 | if (!$this->filename) { |
@@ -462,13 +462,13 @@ discard block |
||
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | - * Set property |
|
| 466 | - * |
|
| 467 | - * @param string $element |
|
| 468 | - * @param string $key |
|
| 469 | - * @param string $value |
|
| 470 | - * @throws VCardException |
|
| 471 | - */ |
|
| 465 | + * Set property |
|
| 466 | + * |
|
| 467 | + * @param string $element |
|
| 468 | + * @param string $key |
|
| 469 | + * @param string $value |
|
| 470 | + * @throws VCardException |
|
| 471 | + */ |
|
| 472 | 472 | |
| 473 | 473 | private function setProperty($element, $key, $value) |
| 474 | 474 | { |
@@ -520,11 +520,11 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | /** |
| 523 | - * Set the save path directory |
|
| 524 | - * |
|
| 525 | - * @param string $savePath Save Path |
|
| 526 | - * @throws VCardException |
|
| 527 | - */ |
|
| 523 | + * Set the save path directory |
|
| 524 | + * |
|
| 525 | + * @param string $savePath Save Path |
|
| 526 | + * @throws VCardException |
|
| 527 | + */ |
|
| 528 | 528 | public function setSavePath($savePath) |
| 529 | 529 | { |
| 530 | 530 | if (!is_dir($savePath)) { |
@@ -562,12 +562,12 @@ discard block |
||
| 562 | 562 | |
| 563 | 563 | |
| 564 | 564 | /** |
| 565 | - * Fold a line according to RFC2425 section 5.8.1. |
|
| 566 | - * |
|
| 567 | - * @link http://tools.ietf.org/html/rfc2425#section-5.8.1 |
|
| 568 | - * @param string $text |
|
| 569 | - * @return mixed |
|
| 570 | - */ |
|
| 565 | + * Fold a line according to RFC2425 section 5.8.1. |
|
| 566 | + * |
|
| 567 | + * @link http://tools.ietf.org/html/rfc2425#section-5.8.1 |
|
| 568 | + * @param string $text |
|
| 569 | + * @return mixed |
|
| 570 | + */ |
|
| 571 | 571 | protected function fold($text) |
| 572 | 572 | { |
| 573 | 573 | if (strlen($text) <= 75) { |
@@ -579,14 +579,14 @@ discard block |
||
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | /** |
| 582 | - * multibyte word chunk split |
|
| 583 | - * @link http://php.net/manual/en/function.chunk-split.php#107711 |
|
| 584 | - * |
|
| 585 | - * @param string $body The string to be chunked. |
|
| 586 | - * @param integer $chunklen The chunk length. |
|
| 587 | - * @param string $end The line ending sequence. |
|
| 588 | - * @return string Chunked string |
|
| 589 | - */ |
|
| 582 | + * multibyte word chunk split |
|
| 583 | + * @link http://php.net/manual/en/function.chunk-split.php#107711 |
|
| 584 | + * |
|
| 585 | + * @param string $body The string to be chunked. |
|
| 586 | + * @param integer $chunklen The chunk length. |
|
| 587 | + * @param string $end The line ending sequence. |
|
| 588 | + * @return string Chunked string |
|
| 589 | + */ |
|
| 590 | 590 | protected function chunk_split_unicode($body, $chunklen = 76, $end = "\r\n") |
| 591 | 591 | { |
| 592 | 592 | $array = array_chunk( |
@@ -599,12 +599,12 @@ discard block |
||
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | /** |
| 602 | - * Escape newline characters according to RFC2425 section 5.8.4. |
|
| 603 | - * |
|
| 604 | - * @link http://tools.ietf.org/html/rfc2425#section-5.8.4 |
|
| 605 | - * @param string $text |
|
| 606 | - * @return string |
|
| 607 | - */ |
|
| 602 | + * Escape newline characters according to RFC2425 section 5.8.4. |
|
| 603 | + * |
|
| 604 | + * @link http://tools.ietf.org/html/rfc2425#section-5.8.4 |
|
| 605 | + * @param string $text |
|
| 606 | + * @return string |
|
| 607 | + */ |
|
| 608 | 608 | protected function escape($text) |
| 609 | 609 | { |
| 610 | 610 | $text = str_replace("\r\n", "\\n", $text); |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @author Rogers Corrêa |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -class VCard{ |
|
| 11 | +class VCard { |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * existsElements |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $prefix = '', |
| 95 | 95 | $suffix = '', |
| 96 | 96 | $fullName = false |
| 97 | - ){ |
|
| 97 | + ) { |
|
| 98 | 98 | // set property |
| 99 | 99 | $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix; |
| 100 | 100 | $this->setProperty( |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $property |
| 104 | 104 | ); |
| 105 | 105 | |
| 106 | - if($fullName === true) { |
|
| 106 | + if ($fullName === true) { |
|
| 107 | 107 | $values = array_filter([ |
| 108 | 108 | $prefix, |
| 109 | 109 | $firstName, |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | { |
| 336 | 336 | $this->setProperty( |
| 337 | 337 | 'social', |
| 338 | - 'X-SOCIALPROFILE;type='. $type, |
|
| 338 | + 'X-SOCIALPROFILE;type=' . $type, |
|
| 339 | 339 | $socialProfile |
| 340 | 340 | ); |
| 341 | 341 | |