@@ -38,7 +38,7 @@ |
||
| 38 | 38 | { |
| 39 | 39 | /** |
| 40 | 40 | * The raw VCard content. |
| 41 | - * |
|
| 41 | + * |
|
| 42 | 42 | * @var string |
| 43 | 43 | */ |
| 44 | 44 | protected $content; |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | * VCard generator test - can save to file or output as a download |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 8 | -require_once __DIR__ . '/../src/VCard.php'; |
|
| 7 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 8 | +require_once __DIR__.'/../src/VCard.php'; |
|
| 9 | 9 | |
| 10 | 10 | use JeroenDesloovere\VCard\VCard; |
| 11 | 11 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $vcard->addAddress(null, null, 'street', 'worktown', null, 'workpostcode', 'Belgium'); |
| 32 | 32 | $vcard->addURL('http://www.jeroendesloovere.be'); |
| 33 | 33 | |
| 34 | -$vcard->addPhoto(__DIR__ . '/assets/landscape.jpeg'); |
|
| 34 | +$vcard->addPhoto(__DIR__.'/assets/landscape.jpeg'); |
|
| 35 | 35 | //$vcard->addPhoto('https://raw.githubusercontent.com/jeroendesloovere/vcard/master/tests/image.jpg'); |
| 36 | 36 | |
| 37 | 37 | // return vcard as a string |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | return $vcard->download(); |
| 42 | 42 | |
| 43 | 43 | // echo message |
| 44 | -echo 'A personal vCard is saved in this folder: ' . __DIR__; |
|
| 44 | +echo 'A personal vCard is saved in this folder: '.__DIR__; |
|
| 45 | 45 | |
| 46 | 46 | // or |
| 47 | 47 | |
@@ -4,16 +4,16 @@ |
||
| 4 | 4 | * VCardParser test - can parse bundled VCF file into CSV |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 8 | -require_once __DIR__ . '/../src/VCardParser.php'; |
|
| 7 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 8 | +require_once __DIR__.'/../src/VCardParser.php'; |
|
| 9 | 9 | |
| 10 | 10 | // load VCardParser classes |
| 11 | 11 | use JeroenDesloovere\VCard\VCardParser; |
| 12 | 12 | |
| 13 | -$pathToVCardExample = __DIR__ . '/assets/contacts.vcf'; |
|
| 13 | +$pathToVCardExample = __DIR__.'/assets/contacts.vcf'; |
|
| 14 | 14 | $parser = VCardParser::parseFromFile($pathToVCardExample); |
| 15 | 15 | |
| 16 | -foreach($parser as $vcard) { |
|
| 16 | +foreach ($parser as $vcard) { |
|
| 17 | 17 | $lastname = $vcard->lastname; |
| 18 | 18 | $firstname = $vcard->firstname; |
| 19 | 19 | $birthday = $vcard->birthday->format('Y-m-d'); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | public static function elementAlreadyExists($element) |
| 20 | 20 | { |
| 21 | - return new self('You can only set "' . $element . '" once.'); |
|
| 21 | + return new self('You can only set "'.$element.'" once.'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public static function emptyURL() |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | $type = 'WORK;POSTAL' |
| 90 | 90 | ) { |
| 91 | 91 | // init value |
| 92 | - $value = $name . ';' . $extended . ';' . $street . ';' . $city . ';' . $region . ';' . $zip . ';' . $country; |
|
| 92 | + $value = $name.';'.$extended.';'.$street.';'.$city.';'.$region.';'.$zip.';'.$country; |
|
| 93 | 93 | |
| 94 | 94 | // set property |
| 95 | 95 | $this->setProperty( |
| 96 | 96 | 'address', |
| 97 | - 'ADR' . (($type != '') ? ';' . $type : '') . $this->getCharsetString(), |
|
| 97 | + 'ADR'.(($type != '') ? ';'.$type : '').$this->getCharsetString(), |
|
| 98 | 98 | $value |
| 99 | 99 | ); |
| 100 | 100 | |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | { |
| 130 | 130 | $this->setProperty( |
| 131 | 131 | 'company', |
| 132 | - 'ORG' . $this->getCharsetString(), |
|
| 132 | + 'ORG'.$this->getCharsetString(), |
|
| 133 | 133 | $company |
| 134 | - . ($department != '' ? ';' . $department : '') |
|
| 134 | + . ($department != '' ? ';'.$department : '') |
|
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | 137 | // if filename is empty, add to filename |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | $this->setProperty( |
| 157 | 157 | 'email', |
| 158 | - 'EMAIL;INTERNET' . (($type != '') ? ';' . $type : ''), |
|
| 158 | + 'EMAIL;INTERNET'.(($type != '') ? ';'.$type : ''), |
|
| 159 | 159 | $address |
| 160 | 160 | ); |
| 161 | 161 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | { |
| 173 | 173 | $this->setProperty( |
| 174 | 174 | 'jobtitle', |
| 175 | - 'TITLE' . $this->getCharsetString(), |
|
| 175 | + 'TITLE'.$this->getCharsetString(), |
|
| 176 | 176 | $jobtitle |
| 177 | 177 | ); |
| 178 | 178 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | { |
| 190 | 190 | $this->setProperty( |
| 191 | 191 | 'role', |
| 192 | - 'ROLE' . $this->getCharsetString(), |
|
| 192 | + 'ROLE'.$this->getCharsetString(), |
|
| 193 | 193 | $role |
| 194 | 194 | ); |
| 195 | 195 | |
@@ -238,13 +238,13 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $value = base64_encode($value); |
| 241 | - $property .= ";ENCODING=b;TYPE=" . $fileType; |
|
| 241 | + $property .= ";ENCODING=b;TYPE=".$fileType; |
|
| 242 | 242 | } else { |
| 243 | 243 | if (filter_var($url, FILTER_VALIDATE_URL) !== false) { |
| 244 | 244 | $propertySuffix = ';VALUE=URL'; |
| 245 | - $propertySuffix .= ';TYPE=' . strtoupper($fileType); |
|
| 245 | + $propertySuffix .= ';TYPE='.strtoupper($fileType); |
|
| 246 | 246 | |
| 247 | - $property = $property . $propertySuffix; |
|
| 247 | + $property = $property.$propertySuffix; |
|
| 248 | 248 | $value = $url; |
| 249 | 249 | } else { |
| 250 | 250 | $value = $url; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $fileType = strtoupper(substr($mimeType, 6)); |
| 280 | 280 | |
| 281 | 281 | $content = base64_encode($content); |
| 282 | - $property .= ";ENCODING=b;TYPE=" . $fileType; |
|
| 282 | + $property .= ";ENCODING=b;TYPE=".$fileType; |
|
| 283 | 283 | |
| 284 | 284 | $this->setProperty( |
| 285 | 285 | $element, |
@@ -318,10 +318,10 @@ discard block |
||
| 318 | 318 | $this->setFilename($values); |
| 319 | 319 | |
| 320 | 320 | // set property |
| 321 | - $property = $lastName . ';' . $firstName . ';' . $additional . ';' . $prefix . ';' . $suffix; |
|
| 321 | + $property = $lastName.';'.$firstName.';'.$additional.';'.$prefix.';'.$suffix; |
|
| 322 | 322 | $this->setProperty( |
| 323 | 323 | 'name', |
| 324 | - 'N' . $this->getCharsetString(), |
|
| 324 | + 'N'.$this->getCharsetString(), |
|
| 325 | 325 | $property |
| 326 | 326 | ); |
| 327 | 327 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | // set property |
| 331 | 331 | $this->setProperty( |
| 332 | 332 | 'fullname', |
| 333 | - 'FN' . $this->getCharsetString(), |
|
| 333 | + 'FN'.$this->getCharsetString(), |
|
| 334 | 334 | trim(implode(' ', $values)) |
| 335 | 335 | ); |
| 336 | 336 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | { |
| 349 | 349 | $this->setProperty( |
| 350 | 350 | 'note', |
| 351 | - 'NOTE' . $this->getCharsetString(), |
|
| 351 | + 'NOTE'.$this->getCharsetString(), |
|
| 352 | 352 | $note |
| 353 | 353 | ); |
| 354 | 354 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | { |
| 366 | 366 | $this->setProperty( |
| 367 | 367 | 'categories', |
| 368 | - 'CATEGORIES' . $this->getCharsetString(), |
|
| 368 | + 'CATEGORIES'.$this->getCharsetString(), |
|
| 369 | 369 | trim(implode(',', $categories)) |
| 370 | 370 | ); |
| 371 | 371 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | { |
| 387 | 387 | $this->setProperty( |
| 388 | 388 | 'phoneNumber', |
| 389 | - 'TEL' . (($type != '') ? ';' . $type : ''), |
|
| 389 | + 'TEL'.(($type != '') ? ';'.$type : ''), |
|
| 390 | 390 | $number |
| 391 | 391 | ); |
| 392 | 392 | |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | { |
| 477 | 477 | $this->setProperty( |
| 478 | 478 | 'url', |
| 479 | - 'URL' . (($type != '') ? ';' . $type : ''), |
|
| 479 | + 'URL'.(($type != '') ? ';'.$type : ''), |
|
| 480 | 480 | $url |
| 481 | 481 | ); |
| 482 | 482 | |
@@ -493,13 +493,13 @@ discard block |
||
| 493 | 493 | // init string |
| 494 | 494 | $string = "BEGIN:VCARD\r\n"; |
| 495 | 495 | $string .= "VERSION:3.0\r\n"; |
| 496 | - $string .= "REV:" . date("Y-m-d") . "T" . date("H:i:s") . "Z\r\n"; |
|
| 496 | + $string .= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n"; |
|
| 497 | 497 | |
| 498 | 498 | // loop all properties |
| 499 | 499 | $properties = $this->getProperties(); |
| 500 | 500 | foreach ($properties as $property) { |
| 501 | 501 | // add to string |
| 502 | - $string .= $this->fold($property['key'] . ':' . $this->escape($property['value']) . "\r\n"); |
|
| 502 | + $string .= $this->fold($property['key'].':'.$this->escape($property['value'])."\r\n"); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | // add to string |
@@ -517,19 +517,19 @@ discard block |
||
| 517 | 517 | public function buildVCalendar() |
| 518 | 518 | { |
| 519 | 519 | // init dates |
| 520 | - $dtstart = date("Ymd") . "T" . date("Hi") . "00"; |
|
| 521 | - $dtend = date("Ymd") . "T" . date("Hi") . "01"; |
|
| 520 | + $dtstart = date("Ymd")."T".date("Hi")."00"; |
|
| 521 | + $dtend = date("Ymd")."T".date("Hi")."01"; |
|
| 522 | 522 | |
| 523 | 523 | // init string |
| 524 | 524 | $string = "BEGIN:VCALENDAR\n"; |
| 525 | 525 | $string .= "VERSION:2.0\n"; |
| 526 | 526 | $string .= "BEGIN:VEVENT\n"; |
| 527 | - $string .= "DTSTART;TZID=Europe/London:" . $dtstart . "\n"; |
|
| 528 | - $string .= "DTEND;TZID=Europe/London:" . $dtend . "\n"; |
|
| 527 | + $string .= "DTSTART;TZID=Europe/London:".$dtstart."\n"; |
|
| 528 | + $string .= "DTEND;TZID=Europe/London:".$dtend."\n"; |
|
| 529 | 529 | $string .= "SUMMARY:Click attached contact below to save to your contacts\n"; |
| 530 | - $string .= "DTSTAMP:" . $dtstart . "Z\n"; |
|
| 530 | + $string .= "DTSTAMP:".$dtstart."Z\n"; |
|
| 531 | 531 | $string .= "ATTACH;VALUE=BINARY;ENCODING=BASE64;FMTTYPE=text/directory;\n"; |
| 532 | - $string .= " X-APPLE-FILENAME=" . $this->getFilename() . "." . $this->getFileExtension() . ":\n"; |
|
| 532 | + $string .= " X-APPLE-FILENAME=".$this->getFilename().".".$this->getFileExtension().":\n"; |
|
| 533 | 533 | |
| 534 | 534 | // base64 encode it so that it can be used as an attachemnt to the "dummy" calendar appointment |
| 535 | 535 | $b64vcard = base64_encode($this->buildVCard()); |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | preg_split("//u", $body, -1, PREG_SPLIT_NO_EMPTY), $chunklen); |
| 627 | 627 | $body = ""; |
| 628 | 628 | foreach ($array as $item) { |
| 629 | - $body .= join("", $item) . $end; |
|
| 629 | + $body .= join("", $item).$end; |
|
| 630 | 630 | } |
| 631 | 631 | return $body; |
| 632 | 632 | } |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | { |
| 677 | 677 | $charsetString = ''; |
| 678 | 678 | if ($this->charset == 'utf-8') { |
| 679 | - $charsetString = ';CHARSET=' . $this->charset; |
|
| 679 | + $charsetString = ';CHARSET='.$this->charset; |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | return $charsetString; |
@@ -726,12 +726,12 @@ discard block |
||
| 726 | 726 | */ |
| 727 | 727 | public function getHeaders($asAssociative) |
| 728 | 728 | { |
| 729 | - $contentType = $this->getContentType() . '; charset=' . $this->getCharset(); |
|
| 730 | - $contentDisposition = 'attachment; filename=' . $this->getFilename() . '.' . $this->getFileExtension(); |
|
| 729 | + $contentType = $this->getContentType().'; charset='.$this->getCharset(); |
|
| 730 | + $contentDisposition = 'attachment; filename='.$this->getFilename().'.'.$this->getFileExtension(); |
|
| 731 | 731 | $contentLength = mb_strlen($this->getOutput(), $this->getCharset()); |
| 732 | 732 | $connection = 'close'; |
| 733 | 733 | |
| 734 | - if ((bool)$asAssociative) { |
|
| 734 | + if ((bool) $asAssociative) { |
|
| 735 | 735 | return [ |
| 736 | 736 | 'Content-type' => $contentType, |
| 737 | 737 | 'Content-Disposition' => $contentDisposition, |
@@ -741,10 +741,10 @@ discard block |
||
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | return [ |
| 744 | - 'Content-type: ' . $contentType, |
|
| 745 | - 'Content-Disposition: ' . $contentDisposition, |
|
| 746 | - 'Content-Length: ' . $contentLength, |
|
| 747 | - 'Connection: ' . $connection, |
|
| 744 | + 'Content-type: '.$contentType, |
|
| 745 | + 'Content-Disposition: '.$contentDisposition, |
|
| 746 | + 'Content-Length: '.$contentLength, |
|
| 747 | + 'Connection: '.$connection, |
|
| 748 | 748 | ]; |
| 749 | 749 | } |
| 750 | 750 | |
@@ -822,11 +822,11 @@ discard block |
||
| 822 | 822 | */ |
| 823 | 823 | public function save() |
| 824 | 824 | { |
| 825 | - $file = $this->getFilename() . '.' . $this->getFileExtension(); |
|
| 825 | + $file = $this->getFilename().'.'.$this->getFileExtension(); |
|
| 826 | 826 | |
| 827 | 827 | // Add save path if given |
| 828 | 828 | if (null !== $this->savePath) { |
| 829 | - $file = $this->savePath . $file; |
|
| 829 | + $file = $this->savePath.$file; |
|
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | file_put_contents( |
@@ -880,7 +880,7 @@ discard block |
||
| 880 | 880 | |
| 881 | 881 | // overwrite filename or add to filename using a prefix in between |
| 882 | 882 | $this->filename = ($overwrite) ? |
| 883 | - $value : $this->filename . $separator . $value; |
|
| 883 | + $value : $this->filename.$separator.$value; |
|
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | /** |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | |
| 941 | 941 | $matches = []; |
| 942 | 942 | preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches); |
| 943 | - $version = isset($matches[1]) ? ((int)$matches[1]) : 999; |
|
| 943 | + $version = isset($matches[1]) ? ((int) $matches[1]) : 999; |
|
| 944 | 944 | |
| 945 | 945 | return ($version < 8); |
| 946 | 946 | } |