Passed
Branch master (822676)
by Stefan
02:04
created
SKien/VCard/VCardContact.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
     /** @var string  role / profession  */
46 46
     protected string $strRole = '';
47 47
     /** @var array   array of VCardAddress objects  */
48
-    protected ?array $aAddress     = null;
48
+    protected ?array $aAddress = null;
49 49
     /** @var int     index of preferred address */
50 50
     protected int $iPrefAddress = 0;
51 51
     /** @var array   array of phone numbers */
52
-    protected ?array $aPhone       = null;
52
+    protected ?array $aPhone = null;
53 53
     /** @var int     index of preferred phone number    */
54 54
     protected int $iPrefPhone = 0;
55 55
     /** @var array   array of email addresses   */
56
-    protected ?array $aEMail       = null;
56
+    protected ?array $aEMail = null;
57 57
     /** @var int     index of preferred mail address    */
58 58
     protected int $iPrefEMail = 0;
59 59
     /** @var array   array of categories    */
60
-    protected ?array $aCategories  = null;
60
+    protected ?array $aCategories = null;
61 61
     /** @var string  homepage URL   */
62 62
     protected string $strHomepage = '';
63 63
     /** @var string  date of birth in format YYYY-DD-MM */
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
         $buffer .= 'VERSION:3.0' . PHP_EOL;
95 95
 
96 96
         // name properties
97
-        $strName  = $this->maskString($this->strLastName) . ';';    // family name
98
-        $strName .= $this->maskString($this->strFirstName) . ';';   // given name
99
-        $strName .= ';';                                            // additional name(s)
100
-        $strName .= $this->maskString($this->strPrefix) . ';';      // honorific prefixes
101
-        $strName .= $this->maskString($this->strSuffix);            // honorific suffixes
97
+        $strName  = $this->maskString($this->strLastName) . ';'; // family name
98
+        $strName .= $this->maskString($this->strFirstName) . ';'; // given name
99
+        $strName .= ';'; // additional name(s)
100
+        $strName .= $this->maskString($this->strPrefix) . ';'; // honorific prefixes
101
+        $strName .= $this->maskString($this->strSuffix); // honorific suffixes
102 102
 
103 103
         $buffer .= $this->buildProperty('N', $strName, false);
104 104
         $buffer .= $this->buildProperty('FN', $this->strFirstName . ' ' . $this->strLastName);
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
         $buffer .= $this->buildProperty('ROLE', $this->strRole);
114 114
 
115 115
         // addresses
116
-        foreach ($this->aAddress as $i => $oAddress ) {
116
+        foreach ($this->aAddress as $i => $oAddress) {
117 117
             $buffer .= $oAddress->buildFullAddress($i == $this->iPrefAddress);
118 118
             $buffer .= $oAddress->buildLabel($i == $this->iPrefAddress);
119 119
         }
120 120
         // set preferred address also as default postal address for MS
121
-        $buffer .= $this->buildProperty('X-MS-OL-DEFAULT-POSTAL-ADDRESS', (string)($this->iPrefAddress + 1));
121
+        $buffer .= $this->buildProperty('X-MS-OL-DEFAULT-POSTAL-ADDRESS', (string) ($this->iPrefAddress + 1));
122 122
 
123 123
         // phone numbers
124
-        foreach ($this->aPhone as $i => $aPhone ) {
124
+        foreach ($this->aPhone as $i => $aPhone) {
125 125
             $strName = 'TEL;TYPE=' . $aPhone['strType'];
126 126
             if ($i == $this->iPrefPhone) {
127 127
                 $strName .= ',PREF';
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         }
131 131
 
132 132
         // mailaddresses
133
-        foreach ($this->aEMail as $i => $strEMail ) {
133
+        foreach ($this->aEMail as $i => $strEMail) {
134 134
             $strName = 'EMAIL;TYPE=INTERNET';
135 135
             if ($i == $this->iPrefEMail) {
136 136
                 $strName .= ',PREF';
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
         // personal data
144 144
         $buffer .= $this->buildProperty('BDAY', $this->strDateOfBirth);
145 145
         if ($this->iGender > 0) {
146
-            $buffer .= $this->buildProperty('X-WAB-GENDER', (string)$this->iGender);
146
+            $buffer .= $this->buildProperty('X-WAB-GENDER', (string) $this->iGender);
147 147
         }
148 148
         // categories
149
-        if (count($this->aCategories) > 0 ) {
149
+        if (count($this->aCategories) > 0) {
150 150
             $strSep = '';
151 151
             $strValue = '';
152 152
             foreach ($this->aCategories as $strCategory) {
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
         $buffer .= $this->buildProperty('NOTE', $this->strNote);
161 161
 
162 162
         // photo
163
-        if ( strlen($this->blobPortrait) > 0) {
163
+        if (strlen($this->blobPortrait) > 0) {
164 164
             // extract image type from binary data
165 165
             $strType = '';
166 166
             $strImage = '';
167 167
             $this->parseImageData($this->blobPortrait, $strType, $strImage);
168
-            if (strlen($strType) > 0 && strlen($strImage) > 0 ) {
168
+            if (strlen($strType) > 0 && strlen($strImage) > 0) {
169 169
                 $strName = 'PHOTO;TYPE=' . $strType . ';ENCODING=B';
170 170
                 $buffer .= $this->buildProperty($strName, $strImage, false);
171 171
                 $buffer .= PHP_EOL; // even though in vcard 3.0 spec blank line after binary value no longer is requires, MS Outlook need it...
@@ -245,15 +245,15 @@  discard block
 block discarded – undo
245 245
     protected function parseName(string $strValue, array $aParams) : void
246 246
     {
247 247
         $aSplit = $this->explodeMaskedString(';', $strValue);
248
-        $this->strLastName = $this->unmaskString($aSplit[0]);       // family name
248
+        $this->strLastName = $this->unmaskString($aSplit[0]); // family name
249 249
         if (isset($aSplit[1])) {
250
-            $this->strFirstName = $this->unmaskString($aSplit[1]);  // given name
250
+            $this->strFirstName = $this->unmaskString($aSplit[1]); // given name
251 251
         }
252 252
         if (isset($aSplit[3])) {
253
-            $this->strPrefix = $this->unmaskString($aSplit[3]);     // honorific prefixes
253
+            $this->strPrefix = $this->unmaskString($aSplit[3]); // honorific prefixes
254 254
         }
255 255
         if (isset($aSplit[4])) {
256
-            $this->strSuffix = $this->unmaskString($aSplit[4]);     // honorific suffixes
256
+            $this->strSuffix = $this->unmaskString($aSplit[4]); // honorific suffixes
257 257
         }
258 258
     }
259 259
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 
453 453
             $this->blobPortrait .= base64_encode($img);
454 454
 
455
-        } elseif(file_exists($strFilename)) {
455
+        } elseif (file_exists($strFilename)) {
456 456
             switch (exif_imagetype($strFilename)) {
457 457
                 case IMAGETYPE_JPEG:
458 458
                     $this->blobPortrait = 'data:image/jpg;base64,';
@@ -575,11 +575,11 @@  discard block
 block discarded – undo
575 575
      */
576 576
     public function savePortrait(string $strFilename) : void
577 577
     {
578
-        if (strlen($this->blobPortrait) > 0 ) {
578
+        if (strlen($this->blobPortrait) > 0) {
579 579
             $strType = '';
580 580
             $strImage = '';
581 581
             $this->parseImageData($this->blobPortrait, $strType, $strImage);
582
-            if (strlen($strType) > 0 && strlen($strImage) > 0 ) {
582
+            if (strlen($strType) > 0 && strlen($strImage) > 0) {
583 583
                 $img = $this->imageFromString($strImage, $strType);
584 584
                 imagealphablending($img, true);
585 585
                 imagesavealpha($img, true);
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
                 $oAddr = $this->aAddress[$i];
634 634
             }
635 635
         } else {
636
-            foreach ($this->aAddress as $oAddr )    {
636
+            foreach ($this->aAddress as $oAddr) {
637 637
                 if (strpos($oAddr->getType(), $i) !== false) {
638 638
                     return $oAddr;
639 639
                 }
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
                 $aPhone = $this->aPhone[$i];
674 674
             }
675 675
         } else {
676
-            foreach ($this->aPhone as $aPhone ) {
676
+            foreach ($this->aPhone as $aPhone) {
677 677
                 if (strpos($aPhone['strType'], $i) !== false) {
678 678
                     return $aPhone;
679 679
                 }
Please login to merge, or discard this patch.
SKien/VCard/VCard.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
     const PARCEL    = 'PARCEL';
46 46
 
47 47
     /** max. length of line in vcard - file    */
48
-    const MAX_LINE_LENGTH   = 75;
48
+    const MAX_LINE_LENGTH = 75;
49 49
 
50 50
     /** no error    */
51
-    const OK    = 0;
51
+    const OK = 0;
52 52
 
53 53
     /** @var string  encoding for values    */
54 54
     static protected string $strEncoding = 'UTF-8';
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function write(string $strFilename, bool $bTest = false) : void
98 98
     {
99
-        $buffer  = '';
99
+        $buffer = '';
100 100
         foreach ($this->aContacts as $oContact) {
101 101
             $buffer .= $oContact->buildData();
102 102
         }
103 103
         // vcf-file generation doesn't make sense if some errormessage generated before...
104 104
         if (!$bTest && ob_get_contents() == '') {
105
-            header( 'Content-Type: text/x-vCard; name=' . $strFilename );
106
-            header( 'Content-Length: ' . strlen($buffer) );
107
-            header( 'Connection: close' );
108
-            header( 'Content-Disposition: attachment; filename=' . $strFilename );
105
+            header('Content-Type: text/x-vCard; name=' . $strFilename);
106
+            header('Content-Length: ' . strlen($buffer));
107
+            header('Connection: close');
108
+            header('Content-Disposition: attachment; filename=' . $strFilename);
109 109
         } else {
110 110
             // output for test or in case of errors
111 111
             $buffer = str_replace(PHP_EOL, '<br>', $buffer);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             // if line ends with '=', go on next line (ignore ending '=' sign!)
133 133
             if (substr($strLine, -1) == '=') {
134 134
                 while ($iLn < count($aLines) && substr($strLine, -1) == '=') {
135
-                    $strLine = rtrim($strLine, '=');  // remove ending '='
135
+                    $strLine = rtrim($strLine, '='); // remove ending '='
136 136
                     if (strlen(trim($aLines[$iLn])) == 0) {
137 137
                         break;
138 138
                     }
Please login to merge, or discard this patch.
SKien/VCard/VCardHelper.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @param bool      $bMask      have value to be masked (default: true)
30 30
      * @return string
31 31
      */
32
-    public function buildProperty(string $strName, string $strValue, bool $bMask=true) : string
32
+    public function buildProperty(string $strName, string $strValue, bool $bMask = true) : string
33 33
     {
34 34
         $buffer = '';
35 35
         if (!empty($strValue)) {
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $aParams = array();
144 144
         for ($i = 1; $i < count($aParamsIn); $i++) {
145
-            $aSplit = explode('=',$aParamsIn[$i]);
146
-            if (count($aSplit)< 2) {
145
+            $aSplit = explode('=', $aParamsIn[$i]);
146
+            if (count($aSplit) < 2) {
147 147
                 // version 2.1 allows paramvalues without paramname
148 148
                 $strName = $this->paramName($aSplit[0]);
149 149
                 $strValue = strtoupper($aSplit[0]);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     protected function paramName(string $strValue) : string
171 171
     {
172
-        static $aNames = array (
172
+        static $aNames = array(
173 173
             'INLINE'            => 'VALUE',
174 174
             'URI'               => 'VALUE',
175 175
             'URL'               => 'VALUE',
@@ -261,19 +261,19 @@  discard block
 block discarded – undo
261 261
             $y = 1;
262 262
             $img = imagecreatetruecolor($width, $height);
263 263
             $body = substr($hex, 108);
264
-            $body_size = (strlen($body) / 2);
265
-            $header_size = ($width * $height);
266
-            $usePadding = ($body_size > ($header_size * 3) + 4);
267
-            for ($i = 0; $i < $body_size; $i+=3) {
264
+            $body_size = (strlen($body)/2);
265
+            $header_size = ($width*$height);
266
+            $usePadding = ($body_size > ($header_size*3) + 4);
267
+            for ($i = 0; $i < $body_size; $i += 3) {
268 268
                 if ($x >= $width) {
269 269
                     if ($usePadding)
270
-                        $i += $width % 4;
270
+                        $i += $width%4;
271 271
                     $x = 0;
272 272
                     $y++;
273 273
                     if ($y > $height)
274 274
                         break;
275 275
                 }
276
-                $i_pos = $i * 2;
276
+                $i_pos = $i*2;
277 277
                 $r = hexdec($body[$i_pos + 4] . $body[$i_pos + 5]);
278 278
                 $g = hexdec($body[$i_pos + 2] . $body[$i_pos + 3]);
279 279
                 $b = hexdec($body[$i_pos] . $body[$i_pos + 1]);
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -266,12 +266,14 @@
 block discarded – undo
266 266
             $usePadding = ($body_size > ($header_size * 3) + 4);
267 267
             for ($i = 0; $i < $body_size; $i+=3) {
268 268
                 if ($x >= $width) {
269
-                    if ($usePadding)
270
-                        $i += $width % 4;
269
+                    if ($usePadding) {
270
+                                            $i += $width % 4;
271
+                    }
271 272
                     $x = 0;
272 273
                     $y++;
273
-                    if ($y > $height)
274
-                        break;
274
+                    if ($y > $height) {
275
+                                            break;
276
+                    }
275 277
                 }
276 278
                 $i_pos = $i * 2;
277 279
                 $r = hexdec($body[$i_pos + 4] . $body[$i_pos + 5]);
Please login to merge, or discard this patch.
SKien/VCard/VCardAddress.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
         }
62 62
 
63 63
         // values separated by semikolon
64
-        $strValue  = ';';                                           // post office address (not supported)
65
-        $strValue .= ';';                                           // extended address (not supported)
66
-        $strValue .= $this->maskString($this->strStr) . ';';        // street (including house number)
67
-        $strValue .= $this->maskString($this->strCity) . ';';       // city
68
-        $strValue .= $this->maskString($this->strRegion) . ';';     // region
69
-        $strValue .= $this->maskString($this->strPostcode) . ';';   // postal code
70
-        $strValue .= $this->maskString($this->strCountry);          // country
64
+        $strValue  = ';'; // post office address (not supported)
65
+        $strValue .= ';'; // extended address (not supported)
66
+        $strValue .= $this->maskString($this->strStr) . ';'; // street (including house number)
67
+        $strValue .= $this->maskString($this->strCity) . ';'; // city
68
+        $strValue .= $this->maskString($this->strRegion) . ';'; // region
69
+        $strValue .= $this->maskString($this->strPostcode) . ';'; // postal code
70
+        $strValue .= $this->maskString($this->strCountry); // country
71 71
 
72 72
         return $this->buildProperty($strField, $strValue, false);
73 73
     }
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
         // values separated by semikolon
88 88
         $strValue  = $this->strStr . PHP_EOL;
89 89
         $strValue .= $this->strPostcode . ' ' . $this->strCity . PHP_EOL;
90
-        if (strlen($this->strRegion) > 0 || strlen($this->strCountry) > 0 ) {
91
-            $strSep = (strlen($this->strRegion) > 0 && strlen($this->strCountry) > 0 ) ? ' - ' : '';
90
+        if (strlen($this->strRegion) > 0 || strlen($this->strCountry) > 0) {
91
+            $strSep = (strlen($this->strRegion) > 0 && strlen($this->strCountry) > 0) ? ' - ' : '';
92 92
             $strValue .= $this->strRegion . $strSep . $this->strCountry . PHP_EOL;
93 93
         }
94 94
 
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $aSplit = $this->explodeMaskedString(';', $strValue);
115 115
         if (isset($aSplit[2])) {
116
-            $this->strStr = $this->unmaskString($aSplit[2]);        // street (including house number)
116
+            $this->strStr = $this->unmaskString($aSplit[2]); // street (including house number)
117 117
         }
118 118
         if (isset($aSplit[3])) {
119
-            $this->strCity = $this->unmaskString($aSplit[3]);       // city
119
+            $this->strCity = $this->unmaskString($aSplit[3]); // city
120 120
         }
121 121
         if (isset($aSplit[4])) {
122
-            $this->strRegion = $this->unmaskString($aSplit[4]);     // region
122
+            $this->strRegion = $this->unmaskString($aSplit[4]); // region
123 123
         }
124 124
         if (isset($aSplit[5])) {
125
-            $this->strPostcode = $this->unmaskString($aSplit[5]);   // postal code
125
+            $this->strPostcode = $this->unmaskString($aSplit[5]); // postal code
126 126
         }
127 127
         if (isset($aSplit[6])) {
128
-            $this->strCountry = $this->unmaskString($aSplit[6]);    // country
128
+            $this->strCountry = $this->unmaskString($aSplit[6]); // country
129 129
         }
130 130
         if (isset($aParams['TYPE'])) {
131 131
             $this->strType = $aParams['TYPE'];
Please login to merge, or discard this patch.
ExportTest.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -7,61 +7,61 @@
 block discarded – undo
7 7
 require_once 'autoloader.php';
8 8
 require_once 'blobPortrait.php';
9 9
 
10
-	$oVCard = new VCard();
10
+    $oVCard = new VCard();
11 11
 
12
-	// just create new contact
13
-	$oContact = new VCardContact();
14
-	$oContact->setName('von Flake', 'Wiki');
15
-	$oContact->setOrganisation('Company 4711');
12
+    // just create new contact
13
+    $oContact = new VCardContact();
14
+    $oContact->setName('von Flake', 'Wiki');
15
+    $oContact->setOrganisation('Company 4711');
16 16
 
17
-	$oAddress = new VCardAddress();
18
-	$oAddress->setStr('Bärenweg. 4');
19
-	$oAddress->setPostcode('54321');
20
-	$oAddress->setCity('Musterstadt');
21
-	$oAddress->setType(VCard::HOME);
22
-	$oContact->addAddress($oAddress, true);
17
+    $oAddress = new VCardAddress();
18
+    $oAddress->setStr('Bärenweg. 4');
19
+    $oAddress->setPostcode('54321');
20
+    $oAddress->setCity('Musterstadt');
21
+    $oAddress->setType(VCard::HOME);
22
+    $oContact->addAddress($oAddress, true);
23 23
 
24
-	$oContact->addPhone('01234 5678', VCard::HOME, false);
25
-	$oContact->addPhone('0123 89765456', VCard::CELL, true);
24
+    $oContact->addPhone('01234 5678', VCard::HOME, false);
25
+    $oContact->addPhone('0123 89765456', VCard::CELL, true);
26 26
 
27
-	$oAddress = new VCardAddress();
28
-	$oAddress->setStr('Companystr. 8');
29
-	$oAddress->setPostcode('65432');
30
-	$oAddress->setCity('Musterstadt');
31
-	$oAddress->setRegion('Baden-Würtemberg');
32
-	$oAddress->setCountry('Deutschland');
33
-	$oAddress->setType(VCard::WORK);
34
-	$oContact->addAddress($oAddress, false);
27
+    $oAddress = new VCardAddress();
28
+    $oAddress->setStr('Companystr. 8');
29
+    $oAddress->setPostcode('65432');
30
+    $oAddress->setCity('Musterstadt');
31
+    $oAddress->setRegion('Baden-Würtemberg');
32
+    $oAddress->setCountry('Deutschland');
33
+    $oAddress->setType(VCard::WORK);
34
+    $oContact->addAddress($oAddress, false);
35 35
 
36
-	$oContact->addPhone('01234 98356', VCard::WORK, false);
36
+    $oContact->addPhone('01234 98356', VCard::WORK, false);
37 37
 
38
-	$oContact->addEMail('[email protected]', true);
39
-	$oContact->addEMail('[email protected]', false);
40
-	$oContact->addEMail('[email protected]', false);
38
+    $oContact->addEMail('[email protected]', true);
39
+    $oContact->addEMail('[email protected]', false);
40
+    $oContact->addEMail('[email protected]', false);
41 41
 
42
-	$oContact->addCategory('Krieger');
43
-	$oContact->addCategory('Wikinger');
42
+    $oContact->addCategory('Krieger');
43
+    $oContact->addCategory('Wikinger');
44 44
 
45
-	$strNote  = "Hier steht ein mehrzeiliger Text," . PHP_EOL;
46
-	$strNote .= "der auch Umlaute (ä,ö,ü) und Sonderzeichen" . PHP_EOL;
47
-	$strNote .= "(@,~,§,$) enthä....";
48
-	$oContact->setNote($strNote);
45
+    $strNote  = "Hier steht ein mehrzeiliger Text," . PHP_EOL;
46
+    $strNote .= "der auch Umlaute (ä,ö,ü) und Sonderzeichen" . PHP_EOL;
47
+    $strNote .= "(@,~,§,$) enthä....";
48
+    $oContact->setNote($strNote);
49 49
 
50
-	// insert multiple contacts
51
-	$oContact->setPortraitBlob(getBlobPortrait());			// Wiki von Flake
52
-	$oVCard->addContact($oContact);
50
+    // insert multiple contacts
51
+    $oContact->setPortraitBlob(getBlobPortrait());			// Wiki von Flake
52
+    $oVCard->addContact($oContact);
53 53
 
54
-	// change name and portrait ... all other properties remains valid!
55
-	$oContact->setName('von Flake', 'Ilvy');
56
-	$oContact->setPortraitFile('images/sample2.png');	// Ilvy	von Flake
57
-	$oVCard->addContact($oContact);
54
+    // change name and portrait ... all other properties remains valid!
55
+    $oContact->setName('von Flake', 'Ilvy');
56
+    $oContact->setPortraitFile('images/sample2.png');	// Ilvy	von Flake
57
+    $oVCard->addContact($oContact);
58 58
 
59
-	// change name again and add some additional info....
60
-	$oContact->setName('von Flake', 'Halvar');
61
-	$oContact->setPrefix('Mr.');
62
-	$oContact->setStrSuffix('Häuptling');
63
-	$oContact->setPortraitFile('images/sample3.bmp');	// Halvar von Flake
64
-	$oVCard->addContact($oContact);
59
+    // change name again and add some additional info....
60
+    $oContact->setName('von Flake', 'Halvar');
61
+    $oContact->setPrefix('Mr.');
62
+    $oContact->setStrSuffix('Häuptling');
63
+    $oContact->setPortraitFile('images/sample3.bmp');	// Halvar von Flake
64
+    $oVCard->addContact($oContact);
65 65
 
66
-	// and write to file
67
-	$oVCard->write('test.vcf', false);
68 66
\ No newline at end of file
67
+    // and write to file
68
+    $oVCard->write('test.vcf', false);
69 69
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,19 +48,19 @@
 block discarded – undo
48 48
 	$oContact->setNote($strNote);
49 49
 
50 50
 	// insert multiple contacts
51
-	$oContact->setPortraitBlob(getBlobPortrait());			// Wiki von Flake
51
+	$oContact->setPortraitBlob(getBlobPortrait()); // Wiki von Flake
52 52
 	$oVCard->addContact($oContact);
53 53
 
54 54
 	// change name and portrait ... all other properties remains valid!
55 55
 	$oContact->setName('von Flake', 'Ilvy');
56
-	$oContact->setPortraitFile('images/sample2.png');	// Ilvy	von Flake
56
+	$oContact->setPortraitFile('images/sample2.png'); // Ilvy	von Flake
57 57
 	$oVCard->addContact($oContact);
58 58
 
59 59
 	// change name again and add some additional info....
60 60
 	$oContact->setName('von Flake', 'Halvar');
61 61
 	$oContact->setPrefix('Mr.');
62 62
 	$oContact->setStrSuffix('Häuptling');
63
-	$oContact->setPortraitFile('images/sample3.bmp');	// Halvar von Flake
63
+	$oContact->setPortraitFile('images/sample3.bmp'); // Halvar von Flake
64 64
 	$oVCard->addContact($oContact);
65 65
 
66 66
 	// and write to file
Please login to merge, or discard this patch.
ImportTest.php 2 patches
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -4,105 +4,105 @@
 block discarded – undo
4 4
 use SKien\VCard\VCard;
5 5
 require_once 'autoloader.php';
6 6
 
7
-	echo '<!DOCTYPE html>' . PHP_EOL;
8
-	echo '<html lang="de">' . PHP_EOL;
9
-	echo '<head><title>vCard Importtest</title>' . PHP_EOL;
10
-	echo '<meta charset="ISO-8859-1">' . PHP_EOL;
11
-	echo '</head>' . PHP_EOL;
12
-	echo '<body>' . PHP_EOL;
7
+    echo '<!DOCTYPE html>' . PHP_EOL;
8
+    echo '<html lang="de">' . PHP_EOL;
9
+    echo '<head><title>vCard Importtest</title>' . PHP_EOL;
10
+    echo '<meta charset="ISO-8859-1">' . PHP_EOL;
11
+    echo '</head>' . PHP_EOL;
12
+    echo '<body>' . PHP_EOL;
13 13
 
14
-	$strFilename = 'test.vcf';
15
-	$strEncoding = 'Windows-1252';
16
-	if (isset($_FILES['vcfFile']) && $_FILES['vcfFile']['tmp_name'] != '') {
17
-		// to test different own files use ImportSelect.html...)
18
-		$strFilename = $_FILES['vcfFile']['tmp_name'];
19
-	}
20
-	if (isset($_REQUEST['encoding'])) {
21
-		$strEncoding = $_REQUEST['encoding'];
22
-	}
14
+    $strFilename = 'test.vcf';
15
+    $strEncoding = 'Windows-1252';
16
+    if (isset($_FILES['vcfFile']) && $_FILES['vcfFile']['tmp_name'] != '') {
17
+        // to test different own files use ImportSelect.html...)
18
+        $strFilename = $_FILES['vcfFile']['tmp_name'];
19
+    }
20
+    if (isset($_REQUEST['encoding'])) {
21
+        $strEncoding = $_REQUEST['encoding'];
22
+    }
23 23
 
24 24
 
25
-	VCard::setEncoding($strEncoding);
25
+    VCard::setEncoding($strEncoding);
26 26
 
27
-	// create object and read file
28
-	$oVCard = new VCard();
29
-	$iCC = $oVCard->read($strFilename);
30
-	for ($i = 0; $i < $iCC; $i++) {
31
-		// iterate to importetd contacts
32
-		$oContact = $oVCard->getContact($i);
33
-		echo '<h1>' . $oContact->getName() . '</h1>' . PHP_EOL;
34
-		$strPortraitBlob = $oContact->getPortraitBlob();
35
-		if (strlen($strPortraitBlob) > 0 ) {
36
-			echo '<img style="float: left; margin: 0px 20px;" src="' . $strPortraitBlob . '">' . PHP_EOL;
37
-			// just save image as blob in db table ...
38
-			// ... or may create file on server (it's on you to set appropriate path and filename)
39
-			$oContact->savePortrait('myimage' . ($i + 1));
40
-		}
41
-		echo $oContact->getPrefix() . '<br/>' . PHP_EOL;
42
-		echo $oContact->getLastName() . ', ' . $oContact->getFirstName() . '<br/>' . PHP_EOL;
43
-		echo 'Nickname: ' . $oContact->getNickName() . '<br/>' . PHP_EOL;
44
-		echo 'Birthday: ' . $oContact->getDateOfBirth() . '<br/><br/>' . PHP_EOL;
45
-		echo 'Company: ' . $oContact->getOrganisation() . '<br/><br/><br/>' . PHP_EOL;
27
+    // create object and read file
28
+    $oVCard = new VCard();
29
+    $iCC = $oVCard->read($strFilename);
30
+    for ($i = 0; $i < $iCC; $i++) {
31
+        // iterate to importetd contacts
32
+        $oContact = $oVCard->getContact($i);
33
+        echo '<h1>' . $oContact->getName() . '</h1>' . PHP_EOL;
34
+        $strPortraitBlob = $oContact->getPortraitBlob();
35
+        if (strlen($strPortraitBlob) > 0 ) {
36
+            echo '<img style="float: left; margin: 0px 20px;" src="' . $strPortraitBlob . '">' . PHP_EOL;
37
+            // just save image as blob in db table ...
38
+            // ... or may create file on server (it's on you to set appropriate path and filename)
39
+            $oContact->savePortrait('myimage' . ($i + 1));
40
+        }
41
+        echo $oContact->getPrefix() . '<br/>' . PHP_EOL;
42
+        echo $oContact->getLastName() . ', ' . $oContact->getFirstName() . '<br/>' . PHP_EOL;
43
+        echo 'Nickname: ' . $oContact->getNickName() . '<br/>' . PHP_EOL;
44
+        echo 'Birthday: ' . $oContact->getDateOfBirth() . '<br/><br/>' . PHP_EOL;
45
+        echo 'Company: ' . $oContact->getOrganisation() . '<br/><br/><br/>' . PHP_EOL;
46 46
 
47
-		// test iterating through all addresses
48
-		$iAC = $oContact->getAddressCount();
49
-		for ($j = 0; $j < $iAC; $j++) {
50
-			$oAddress = $oContact->getAddress($j);
51
-			echo '<div style="width: ' . (100.0/$iAC) . '%; float: left;">' . PHP_EOL;
52
-			echo '	<b>Address: ' . $oAddress->getType() . '</b><br>' . PHP_EOL;
53
-			echo '	' . $oAddress->getStr() . '<br>' . PHP_EOL;
54
-			echo '	' . $oAddress->getPostcode() . ' ' . $oAddress->getCity() . '<br>' . PHP_EOL;
55
-			echo '	' . $oAddress->getRegion() . ' ' . $oAddress->getCountry() . '<br>' . PHP_EOL;
56
-			echo '</div>' . PHP_EOL;
57
-		}
47
+        // test iterating through all addresses
48
+        $iAC = $oContact->getAddressCount();
49
+        for ($j = 0; $j < $iAC; $j++) {
50
+            $oAddress = $oContact->getAddress($j);
51
+            echo '<div style="width: ' . (100.0/$iAC) . '%; float: left;">' . PHP_EOL;
52
+            echo '	<b>Address: ' . $oAddress->getType() . '</b><br>' . PHP_EOL;
53
+            echo '	' . $oAddress->getStr() . '<br>' . PHP_EOL;
54
+            echo '	' . $oAddress->getPostcode() . ' ' . $oAddress->getCity() . '<br>' . PHP_EOL;
55
+            echo '	' . $oAddress->getRegion() . ' ' . $oAddress->getCountry() . '<br>' . PHP_EOL;
56
+            echo '</div>' . PHP_EOL;
57
+        }
58 58
 
59
-		// test for direct access via type
60
-		echo '<div style="clear: both;"><br/>' . PHP_EOL;
61
-		$oAddress = $oContact->getAddress(VCard::WORK);
62
-		if ($oAddress) {
63
-			echo '<div style="width: 50%; float: left;">' . PHP_EOL;
64
-			echo '	<b>Address at Work:</b><br>' . PHP_EOL;
65
-			echo '	' . $oAddress->getStr() . '<br>' . PHP_EOL;
66
-			echo '	' . $oAddress->getPostcode() . ' ' . $oAddress->getCity() . '<br>' . PHP_EOL;
67
-			echo '	' . $oAddress->getRegion() . ' ' . $oAddress->getCountry() . '<br>' . PHP_EOL;
68
-			echo '</div>' . PHP_EOL;
69
-		}
70
-		$oAddress = $oContact->getAddress(VCard::HOME);
71
-		if ($oAddress) {
72
-			echo '<div style="width: 50%; float: left;">' . PHP_EOL;
73
-			echo '	<b>Address at Home:</b><br>' . PHP_EOL;
74
-			echo '	' . $oAddress->getStr() . '<br>' . PHP_EOL;
75
-			echo '	' . $oAddress->getPostcode() . ' ' . $oAddress->getCity() . '<br>' . PHP_EOL;
76
-			echo '	' . $oAddress->getRegion() . ' ' . $oAddress->getCountry() . '<br>' . PHP_EOL;
77
-			echo '</div>' . PHP_EOL;
78
-		}
59
+        // test for direct access via type
60
+        echo '<div style="clear: both;"><br/>' . PHP_EOL;
61
+        $oAddress = $oContact->getAddress(VCard::WORK);
62
+        if ($oAddress) {
63
+            echo '<div style="width: 50%; float: left;">' . PHP_EOL;
64
+            echo '	<b>Address at Work:</b><br>' . PHP_EOL;
65
+            echo '	' . $oAddress->getStr() . '<br>' . PHP_EOL;
66
+            echo '	' . $oAddress->getPostcode() . ' ' . $oAddress->getCity() . '<br>' . PHP_EOL;
67
+            echo '	' . $oAddress->getRegion() . ' ' . $oAddress->getCountry() . '<br>' . PHP_EOL;
68
+            echo '</div>' . PHP_EOL;
69
+        }
70
+        $oAddress = $oContact->getAddress(VCard::HOME);
71
+        if ($oAddress) {
72
+            echo '<div style="width: 50%; float: left;">' . PHP_EOL;
73
+            echo '	<b>Address at Home:</b><br>' . PHP_EOL;
74
+            echo '	' . $oAddress->getStr() . '<br>' . PHP_EOL;
75
+            echo '	' . $oAddress->getPostcode() . ' ' . $oAddress->getCity() . '<br>' . PHP_EOL;
76
+            echo '	' . $oAddress->getRegion() . ' ' . $oAddress->getCountry() . '<br>' . PHP_EOL;
77
+            echo '</div>' . PHP_EOL;
78
+        }
79 79
 
80
-		// phonenumbers
81
-		echo '<div style="clear: both;"><br/>' . PHP_EOL;
82
-		echo '<b>Phonenumbers:</b><br/>' . PHP_EOL;
83
-		$iPC = $oContact->getPhoneCount();
84
-		for ($j = 0; $j < $iPC; $j++) {
85
-			$aPhone = $oContact->getPhone($j);
86
-			echo $aPhone['strType'] . ': ' . $aPhone['strPhone'] . '<br>' . PHP_EOL;
87
-		}
80
+        // phonenumbers
81
+        echo '<div style="clear: both;"><br/>' . PHP_EOL;
82
+        echo '<b>Phonenumbers:</b><br/>' . PHP_EOL;
83
+        $iPC = $oContact->getPhoneCount();
84
+        for ($j = 0; $j < $iPC; $j++) {
85
+            $aPhone = $oContact->getPhone($j);
86
+            echo $aPhone['strType'] . ': ' . $aPhone['strPhone'] . '<br>' . PHP_EOL;
87
+        }
88 88
 
89
-		// mailaddresses
90
-		echo '<br/>' . PHP_EOL;
91
-		echo '<b>e-Mailaddresses:</b><br/>' . PHP_EOL;
92
-		$iPC = $oContact->getEMailCount();
93
-		for ($j = 0; $j < $iPC; $j++) {
94
-			echo 'Mail' . ($j+1) . ': ' . $oContact->getEMail($j) . '<br>' . PHP_EOL;
95
-		}
96
-		echo '<br/>' . PHP_EOL;
89
+        // mailaddresses
90
+        echo '<br/>' . PHP_EOL;
91
+        echo '<b>e-Mailaddresses:</b><br/>' . PHP_EOL;
92
+        $iPC = $oContact->getEMailCount();
93
+        for ($j = 0; $j < $iPC; $j++) {
94
+            echo 'Mail' . ($j+1) . ': ' . $oContact->getEMail($j) . '<br>' . PHP_EOL;
95
+        }
96
+        echo '<br/>' . PHP_EOL;
97 97
 
98
-		$strNote = $oContact->getNote();
99
-		if (strlen($strNote) > 0 )
100
-		{
101
-			echo '<b>Annotation (may contain multiline value)</b><br/>' . PHP_EOL;
102
-			echo '<textarea cols="80" rows="5">' . $strNote . '</textarea>' . PHP_EOL;
103
-			echo '<br/>' . PHP_EOL;
104
-		}
105
-	}
98
+        $strNote = $oContact->getNote();
99
+        if (strlen($strNote) > 0 )
100
+        {
101
+            echo '<b>Annotation (may contain multiline value)</b><br/>' . PHP_EOL;
102
+            echo '<textarea cols="80" rows="5">' . $strNote . '</textarea>' . PHP_EOL;
103
+            echo '<br/>' . PHP_EOL;
104
+        }
105
+    }
106 106
 
107
-	echo '</body>' . PHP_EOL;
108
-	echo '</html>' . PHP_EOL;
107
+    echo '</body>' . PHP_EOL;
108
+    echo '</html>' . PHP_EOL;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		$oContact = $oVCard->getContact($i);
33 33
 		echo '<h1>' . $oContact->getName() . '</h1>' . PHP_EOL;
34 34
 		$strPortraitBlob = $oContact->getPortraitBlob();
35
-		if (strlen($strPortraitBlob) > 0 ) {
35
+		if (strlen($strPortraitBlob) > 0) {
36 36
 			echo '<img style="float: left; margin: 0px 20px;" src="' . $strPortraitBlob . '">' . PHP_EOL;
37 37
 			// just save image as blob in db table ...
38 38
 			// ... or may create file on server (it's on you to set appropriate path and filename)
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
 		echo '<b>e-Mailaddresses:</b><br/>' . PHP_EOL;
92 92
 		$iPC = $oContact->getEMailCount();
93 93
 		for ($j = 0; $j < $iPC; $j++) {
94
-			echo 'Mail' . ($j+1) . ': ' . $oContact->getEMail($j) . '<br>' . PHP_EOL;
94
+			echo 'Mail' . ($j + 1) . ': ' . $oContact->getEMail($j) . '<br>' . PHP_EOL;
95 95
 		}
96 96
 		echo '<br/>' . PHP_EOL;
97 97
 
98 98
 		$strNote = $oContact->getNote();
99
-		if (strlen($strNote) > 0 )
99
+		if (strlen($strNote) > 0)
100 100
 		{
101 101
 			echo '<b>Annotation (may contain multiline value)</b><br/>' . PHP_EOL;
102 102
 			echo '<textarea cols="80" rows="5">' . $strNote . '</textarea>' . PHP_EOL;
Please login to merge, or discard this patch.