Passed
Branch master (822676)
by Stefan
02:04
created
ExportTest.php 1 patch
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.
ImportTest.php 1 patch
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.