@@ -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; |
@@ -433,10 +433,10 @@ |
||
| 433 | 433 | $method_handler = $class_handler->getMethod('chunk_split_unicode'); |
| 434 | 434 | $method_handler->setAccessible(true); |
| 435 | 435 | |
| 436 | - $ascii_input="Lorem ipsum dolor sit amet,"; |
|
| 437 | - $ascii_output = $method_handler->invokeArgs(new VCard(), [$ascii_input,10,'|']); |
|
| 438 | - $unicode_input='Τη γλώσσα μου έδωσαν ελληνική το σπίτι φτωχικό στις αμμουδιές του Ομήρου.'; |
|
| 439 | - $unicode_output = $method_handler->invokeArgs(new VCard(), [$unicode_input,10,'|']); |
|
| 436 | + $ascii_input = "Lorem ipsum dolor sit amet,"; |
|
| 437 | + $ascii_output = $method_handler->invokeArgs(new VCard(), [$ascii_input, 10, '|']); |
|
| 438 | + $unicode_input = 'Τη γλώσσα μου έδωσαν ελληνική το σπίτι φτωχικό στις αμμουδιές του Ομήρου.'; |
|
| 439 | + $unicode_output = $method_handler->invokeArgs(new VCard(), [$unicode_input, 10, '|']); |
|
| 440 | 440 | |
| 441 | 441 | $this->assertEquals( |
| 442 | 442 | "Lorem ipsu|m dolor si|t amet,|", |
@@ -78,17 +78,17 @@ |
||
| 78 | 78 | public function testAddAddress() |
| 79 | 79 | { |
| 80 | 80 | $this->assertEquals($this->vcard, $this->vcard->addAddress( |
| 81 | - '', |
|
| 82 | - '88th Floor', |
|
| 83 | - '555 East Flours Street', |
|
| 84 | - 'Los Angeles', |
|
| 85 | - 'CA', |
|
| 86 | - '55555', |
|
| 87 | - 'USA' |
|
| 81 | + '', |
|
| 82 | + '88th Floor', |
|
| 83 | + '555 East Flours Street', |
|
| 84 | + 'Los Angeles', |
|
| 85 | + 'CA', |
|
| 86 | + '55555', |
|
| 87 | + 'USA' |
|
| 88 | 88 | )); |
| 89 | - $this->assertContains('ADR;WORK;POSTAL;CHARSET=utf-8:;88th Floor;555 East Flours Street;Los Angele', $this->vcard->getOutput()); |
|
| 90 | - // Should fold on row 75, so we should not see the full address. |
|
| 91 | - $this->assertNotContains('ADR;WORK;POSTAL;CHARSET=utf-8:;88th Floor;555 East Flours Street;Los Angeles;CA;55555;', $this->vcard->getOutput()); |
|
| 89 | + $this->assertContains('ADR;WORK;POSTAL;CHARSET=utf-8:;88th Floor;555 East Flours Street;Los Angele', $this->vcard->getOutput()); |
|
| 90 | + // Should fold on row 75, so we should not see the full address. |
|
| 91 | + $this->assertNotContains('ADR;WORK;POSTAL;CHARSET=utf-8:;88th Floor;555 East Flours Street;Los Angeles;CA;55555;', $this->vcard->getOutput()); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public function testAddBirthday() |
@@ -13,7 +13,7 @@ |
||
| 13 | 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'); |
@@ -639,7 +639,7 @@ |
||
| 639 | 639 | // The chunk_split_unicode creates a huge memory footprint when used on long strings (EG photos are base64 10MB results in > 1GB memory usage) |
| 640 | 640 | // So check if the string is ASCII (7 bit) and if it is use the built in way RE: https://github.com/jeroendesloovere/vcard/issues/153 |
| 641 | 641 | if ($this->is_ascii($text)) { |
| 642 | - return substr(chunk_split($text, 75, "\r\n "), 0, -3); |
|
| 642 | + return substr(chunk_split($text, 75, "\r\n "), 0, -3); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | // split, wrap and trim trailing separator |
@@ -654,10 +654,10 @@ discard block |
||
| 654 | 654 | * @param string $string |
| 655 | 655 | * @return bool |
| 656 | 656 | */ |
| 657 | - protected function is_ascii($string = '' ) { |
|
| 657 | + protected function is_ascii($string = '') { |
|
| 658 | 658 | $num = 0; |
| 659 | - while( isset( $string[$num] ) ) { |
|
| 660 | - if( ord( $string[$num] ) & 0x80 ) { |
|
| 659 | + while (isset($string[$num])) { |
|
| 660 | + if (ord($string[$num]) & 0x80) { |
|
| 661 | 661 | return false; |
| 662 | 662 | } |
| 663 | 663 | $num++; |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | $contentLength = mb_strlen($this->getOutput(), '8bit'); |
| 781 | 781 | $connection = 'close'; |
| 782 | 782 | |
| 783 | - if ((bool)$asAssociative) { |
|
| 783 | + if ((bool) $asAssociative) { |
|
| 784 | 784 | return [ |
| 785 | 785 | 'Content-type' => $contentType, |
| 786 | 786 | 'Content-Disposition' => $contentDisposition, |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | |
| 990 | 990 | $matches = []; |
| 991 | 991 | preg_match('/os (\d+)_(\d+)\s+/', $browser, $matches); |
| 992 | - $version = isset($matches[1]) ? ((int)$matches[1]) : 999; |
|
| 992 | + $version = isset($matches[1]) ? ((int) $matches[1]) : 999; |
|
| 993 | 993 | |
| 994 | 994 | return ($version < 8); |
| 995 | 995 | } |