Completed
Push — master ( 62d6d0...3be28e )
by Rudie
02:13
created
IMAP.php 3 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -116,6 +116,9 @@  discard block
 block discarded – undo
116 116
 		$this->unseen = $unseen;
117 117
 	}
118 118
 
119
+	/**
120
+	 * @param boolean $clear
121
+	 */
119 122
 	protected function flags( $flags, $clear ) {
120 123
 		$cb = $clear ? 'imap_clearflag_full' : 'imap_setflag_full';
121 124
 
@@ -214,6 +217,9 @@  discard block
 block discarded – undo
214 217
 		return $this->parts;
215 218
 	}
216 219
 
220
+	/**
221
+	 * @param string $IMAPMessagePartClass
222
+	 */
217 223
 	protected function messageParts( $parts, $sectionPrefix = array(), $IMAPMessagePartClass ) {
218 224
 		$sectionPrefix = (array)$sectionPrefix;
219 225
 
@@ -263,6 +269,9 @@  discard block
 block discarded – undo
263 269
 		return $this->decode($body);
264 270
 	}
265 271
 
272
+	/**
273
+	 * @param string $content
274
+	 */
266 275
 	public function decode( $content ) {
267 276
 		return quoted_printable_decode($content);
268 277
 	}
@@ -313,6 +322,9 @@  discard block
 block discarded – undo
313 322
 		return file_put_contents($filepath, $this->decode($this->content()));
314 323
 	}
315 324
 
325
+	/**
326
+	 * @param string $content
327
+	 */
316 328
 	public function decode( $content ) {
317 329
 		return base64_decode($content);
318 330
 	}
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 	public $mbox; // IMAP resource
13 13
 
14
-	public function __construct( $server, $username, $password, $mailbox = 'INBOX', $flags = array() ) {
14
+	public function __construct($server, $username, $password, $mailbox = 'INBOX', $flags = array()) {
15 15
 		$this->server = $server;
16 16
 		$this->username = $username;
17 17
 		$this->password = $password;
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 
24 24
 	public function connect() {
25 25
 		$server = $this->server;
26
-		if ( $this->flags ) {
27
-			$server .= '/' . implode('/', $this->flags);
26
+		if ($this->flags) {
27
+			$server .= '/'.implode('/', $this->flags);
28 28
 		}
29 29
 
30 30
 		$mailbox = '{'.$server.'}'.$this->mailbox;
31 31
 		$this->mbox = imap_open($mailbox, $this->username, $this->password);
32 32
 	}
33 33
 
34
-	public function messages( $options = true ) {
35
-		if ( is_bool($options) ) {
34
+	public function messages($options = true) {
35
+		if (is_bool($options)) {
36 36
 			$options = array('seen' => $options);
37 37
 		}
38 38
 
@@ -46,31 +46,31 @@  discard block
 block discarded – undo
46 46
 		$IMAPMessageClass = $this->IMAPMessageClass;
47 47
 
48 48
 		$headers = imap_headers($this->mbox);
49
-		if ( $options['newestFirst'] ) {
49
+		if ($options['newestFirst']) {
50 50
 			$headers = array_reverse($headers);
51 51
 		}
52 52
 
53 53
 		$messages = array();
54 54
 		$eligables = 0;
55
-		foreach ( $headers AS $n => $header ) {
56
-			if ( preg_match('/(U?)\s+(\d+)\)/', $header, $match) ) {
55
+		foreach ($headers AS $n => $header) {
56
+			if (preg_match('/(U?)\s+(\d+)\)/', $header, $match)) {
57 57
 				$unseen = (bool)trim($match[1]);
58 58
 				$msgNum = (int)$match[2];
59 59
 
60 60
 				$eligable = $options['seen'] || $unseen;
61
-				if ( $eligable ) {
61
+				if ($eligable) {
62 62
 					$eligables++;
63 63
 				}
64 64
 
65
-				if ( $eligable ) {
66
-					if ( $eligables > $options['offset'] ) {
67
-						if ( !$options['limit'] || !isset($messages[$options['limit']-1]) ) {
65
+				if ($eligable) {
66
+					if ($eligables > $options['offset']) {
67
+						if (!$options['limit'] || !isset($messages[$options['limit']-1])) {
68 68
 							$messages[] = new $IMAPMessageClass($this, $msgNum, $header, $unseen);
69 69
 						}
70 70
 					}
71 71
 				}
72 72
 
73
-				if ( $options['limit'] && isset($messages[$options['limit']-1]) ) {
73
+				if ($options['limit'] && isset($messages[$options['limit']-1])) {
74 74
 					break;
75 75
 				}
76 76
 			}
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 		return $messages;
80 80
 	}
81 81
 
82
-	static public function options( $options, $base ) {
83
-		foreach ( $options AS $name => $value ) {
82
+	static public function options($options, $base) {
83
+		foreach ($options AS $name => $value) {
84 84
 			$base[$name] = $value; // overwrite base
85 85
 		}
86 86
 
@@ -109,35 +109,35 @@  discard block
 block discarded – undo
109 109
 	public $HTMLBody;
110 110
 	public $attachments = array(); // typeof Array<IMAPMessageAttachment>
111 111
 
112
-	public function __construct( IMAPMailbox $mailbox, $msgNumber, $header, $unseen ) {
112
+	public function __construct(IMAPMailbox $mailbox, $msgNumber, $header, $unseen) {
113 113
 		$this->mailbox = $mailbox;
114 114
 		$this->msgNumber = $msgNumber;
115 115
 		$this->header = $header;
116 116
 		$this->unseen = $unseen;
117 117
 	}
118 118
 
119
-	protected function flags( $flags, $clear ) {
119
+	protected function flags($flags, $clear) {
120 120
 		$cb = $clear ? 'imap_clearflag_full' : 'imap_setflag_full';
121 121
 
122 122
 		$feedback = array();
123
-		foreach ( (array)$flags AS $flag ) {
124
-			$flag = '\\' . ucfirst($flag);
123
+		foreach ((array)$flags AS $flag) {
124
+			$flag = '\\'.ucfirst($flag);
125 125
 			$feedback[] = $cb($this->mailbox->mbox, (string)$this->msgNumber, $flag);
126 126
 		}
127 127
 
128 128
 		return is_array($flags) ? $feedback : $feedback[0];
129 129
 	}
130 130
 
131
-	public function flag( $flags ) {
131
+	public function flag($flags) {
132 132
 		return $this->flags($flags, false);
133 133
 	}
134 134
 
135
-	public function unflag( $flags ) {
135
+	public function unflag($flags) {
136 136
 		return $this->flags($flags, true);
137 137
 	}
138 138
 
139 139
 	public function subject() {
140
-		if ( !$this->subject ) {
140
+		if (!$this->subject) {
141 141
 			$headers = $this->headers();
142 142
 
143 143
 			$subject = imap_utf8($headers->Subject);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	}
150 150
 
151 151
 	public function headers() {
152
-		if ( !$this->headers ) {
152
+		if (!$this->headers) {
153 153
 			$this->headers = imap_headerinfo($this->mailbox->mbox, $this->msgNumber);
154 154
 		}
155 155
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	}
158 158
 
159 159
 	public function parts() {
160
-		if ( !$this->parts ) {
160
+		if (!$this->parts) {
161 161
 			$structure = $this->structure();
162 162
 
163 163
 			// Possibilities:
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 			$parts = $attachments = array();
171 171
 
172 172
 			// - PLAIN
173
-			if ( 'PLAIN' == $structure->subtype ) {
173
+			if ('PLAIN' == $structure->subtype) {
174 174
 				$parts[] = new $IMAPMessagePartClass($this, $structure, '1');
175 175
 			}
176 176
 
177 177
 			// - ALTERNATIVE
178
-			else if ( 'ALTERNATIVE' == $structure->subtype ) {
178
+			else if ('ALTERNATIVE' == $structure->subtype) {
179 179
 				// get message parts
180 180
 				$parts = $this->messageParts($structure->parts, null, $IMAPMessagePartClass);
181 181
 			}
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
 			else {
185 185
 				$IMAPMessageAttachmentClass = self::$IMAPMessageAttachmentClass;
186 186
 
187
-				foreach ( $structure->parts AS $i => $part ) {
188
-					if ( 'ALTERNATIVE' == $part->subtype ) {
187
+				foreach ($structure->parts AS $i => $part) {
188
+					if ('ALTERNATIVE' == $part->subtype) {
189 189
 						$parts = array_merge($parts, $this->messageParts($part->parts, $i+1, $IMAPMessagePartClass));
190 190
 					}
191 191
 					else {
192 192
 						$parts[] = new $IMAPMessagePartClass($this, $part, $i+1);
193 193
 
194
-						if ( $part->ifdisposition && 'ATTACHMENT' == $part->disposition ) {
194
+						if ($part->ifdisposition && 'ATTACHMENT' == $part->disposition) {
195 195
 							$attachments[] = new $IMAPMessageAttachmentClass($this, $part, $i+1);
196 196
 						}
197 197
 					}
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 			$this->parts = $parts;
202 202
 			$this->attachments = $attachments;
203 203
 
204
-			foreach ( $parts AS $part ) {
205
-				if ( 'PLAIN' == $part->subtype && !$this->plainBody ) {
204
+			foreach ($parts AS $part) {
205
+				if ('PLAIN' == $part->subtype && !$this->plainBody) {
206 206
 					$this->plainBody = $part;
207 207
 				}
208
-				else if ( 'HTML' == $part->subtype && !$this->HTMLBody ) {
208
+				else if ('HTML' == $part->subtype && !$this->HTMLBody) {
209 209
 					$this->HTMLBody = $part;
210 210
 				}
211 211
 			}
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 		return $this->parts;
215 215
 	}
216 216
 
217
-	protected function messageParts( $parts, $sectionPrefix = array(), $IMAPMessagePartClass ) {
217
+	protected function messageParts($parts, $sectionPrefix = array(), $IMAPMessagePartClass) {
218 218
 		$sectionPrefix = (array)$sectionPrefix;
219 219
 
220 220
 		$partObjects = array();
221
-		foreach ( $parts AS $i => $part ) {
221
+		foreach ($parts AS $i => $part) {
222 222
 			$s = $sectionPrefix;
223 223
 			$s[] = (string)($i+1);
224 224
 			$section = implode('.', $s);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 
232 232
 	public function structure() {
233
-		if ( !$this->structure ) {
233
+		if (!$this->structure) {
234 234
 			$this->structure = imap_fetchstructure($this->mailbox->mbox, $this->msgNumber);
235 235
 		}
236 236
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	public $message; // typeof IMAPMessage
252 252
 	public $structure; // typeof stdClass
253 253
 
254
-	public function __construct( $message, $structure, $section ) {
254
+	public function __construct($message, $structure, $section) {
255 255
 		$this->message = $message;
256 256
 		$this->structure = $structure;
257 257
 		$this->section = (string)$section;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		return $this->decode($body);
264 264
 	}
265 265
 
266
-	public function decode( $content ) {
266
+	public function decode($content) {
267 267
 		return quoted_printable_decode($content);
268 268
 	}
269 269
 
@@ -273,18 +273,18 @@  discard block
 block discarded – undo
273 273
 
274 274
 	public $filename = '';
275 275
 
276
-	public function __construct( $message, $structure, $section ) {
276
+	public function __construct($message, $structure, $section) {
277 277
 		parent::__construct($message, $structure, $section);
278 278
 
279 279
 		$this->filename();
280 280
 	}
281 281
 
282 282
 	public function filename() {
283
-		if ( !$this->filename ) {
283
+		if (!$this->filename) {
284 284
 			// from dparameters
285
-			if ( $this->structure->ifdparameters ) {
286
-				foreach ( $this->structure->dparameters AS $param ) {
287
-					if ( 'FILENAME' == $param->attribute ) {
285
+			if ($this->structure->ifdparameters) {
286
+				foreach ($this->structure->dparameters AS $param) {
287
+					if ('FILENAME' == $param->attribute) {
288 288
 						$this->filename = $param->value;
289 289
 						break;
290 290
 					}
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 			}
293 293
 
294 294
 			// from parameters
295
-			if ( !$this->filename && $this->structure->ifparameters ) {
296
-				foreach ( $this->structure->parameters AS $param ) {
297
-					if ( 'NAME' == $param->attribute ) {
295
+			if (!$this->filename && $this->structure->ifparameters) {
296
+				foreach ($this->structure->parameters AS $param) {
297
+					if ('NAME' == $param->attribute) {
298 298
 						$this->filename = $param->value;
299 299
 						break;
300 300
 					}
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
 		return $this->filename;
306 306
 	}
307 307
 
308
-	public function save( $filepath ) {
309
-		if ( '/' == substr($filepath, -1) ) {
308
+	public function save($filepath) {
309
+		if ('/' == substr($filepath, -1)) {
310 310
 			$filepath .= $this->filename;
311 311
 		}
312 312
 
313 313
 		return file_put_contents($filepath, $this->decode($this->content()));
314 314
 	}
315 315
 
316
-	public function decode( $content ) {
316
+	public function decode($content) {
317 317
 		return base64_decode($content);
318 318
 	}
319 319
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -187,8 +187,7 @@  discard block
 block discarded – undo
187 187
 				foreach ( $structure->parts AS $i => $part ) {
188 188
 					if ( 'ALTERNATIVE' == $part->subtype ) {
189 189
 						$parts = array_merge($parts, $this->messageParts($part->parts, $i+1, $IMAPMessagePartClass));
190
-					}
191
-					else {
190
+					} else {
192 191
 						$parts[] = new $IMAPMessagePartClass($this, $part, $i+1);
193 192
 
194 193
 						if ( $part->ifdisposition && 'ATTACHMENT' == $part->disposition ) {
@@ -204,8 +203,7 @@  discard block
 block discarded – undo
204 203
 			foreach ( $parts AS $part ) {
205 204
 				if ( 'PLAIN' == $part->subtype && !$this->plainBody ) {
206 205
 					$this->plainBody = $part;
207
-				}
208
-				else if ( 'HTML' == $part->subtype && !$this->HTMLBody ) {
206
+				} else if ( 'HTML' == $part->subtype && !$this->HTMLBody ) {
209 207
 					$this->HTMLBody = $part;
210 208
 				}
211 209
 			}
Please login to merge, or discard this patch.
test.br-autohelpdesk.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -3,34 +3,34 @@  discard block
 block discarded – undo
3 3
 require 'env.php';
4 4
 require 'IMAP.php';
5 5
 
6
-$mbox = imap_open('{' . IMAP_HELPDESK_HOST . '/novalidate-cert}INBOX', IMAP_HELPDESK_USER, IMAP_HELPDESK_PASS);
6
+$mbox = imap_open('{'.IMAP_HELPDESK_HOST.'/novalidate-cert}INBOX', IMAP_HELPDESK_USER, IMAP_HELPDESK_PASS);
7 7
 
8 8
 $headers = imap_headers($mbox);
9 9
 print_r($headers);
10 10
 
11
-foreach ( $headers AS $hd ) {
12
-	if ( preg_match('/(\d+)\)/', $hd, $match) ) {
11
+foreach ($headers AS $hd) {
12
+	if (preg_match('/(\d+)\)/', $hd, $match)) {
13 13
 		$msgNum = $match[1];
14 14
 
15 15
 		$hd = imap_headerinfo($mbox, $msgNum);
16 16
 		$new = !!trim($hd->Unseen);
17 17
 
18
-		if ( $new ) {
18
+		if ($new) {
19 19
 
20 20
 			// subject -- should contain #code#
21 21
 			$title = get_plain_text_subject($mbox, $msgNum, $hd);
22 22
 			$code = preg_match('/#(\d+)#$/', $title, $match) ? (int)$match[1] : 0;
23
-echo $title . "\n";
23
+echo $title."\n";
24 24
 
25 25
 			// body -- get only last part (no conversation history)
26 26
 			$attachments = array();
27 27
 			$full_body = get_plain_text_body($mbox, $msgNum, $attachments);
28 28
 			$body = get_last_body_part($full_body);
29
-			if ( $attachments ) {
30
-				$body .= "\n\n== Attachments:\n* " . implode("\n* ", $attachments);
29
+			if ($attachments) {
30
+				$body .= "\n\n== Attachments:\n* ".implode("\n* ", $attachments);
31 31
 			}
32 32
 #echo $full_body . "\n===================================================\n";
33
-echo $body . "\n\n===================================================\n===================================================\n===================================================\n";
33
+echo $body."\n\n===================================================\n===================================================\n===================================================\n";
34 34
 
35 35
 			flush();
36 36
 		}
@@ -43,49 +43,49 @@  discard block
 block discarded – undo
43 43
 imap_close($mbox, CL_EXPUNGE);
44 44
 
45 45
 
46
-function get_last_body_part( $body ) {
46
+function get_last_body_part($body) {
47 47
 	$lines = preg_split('/(\r\n|\r|\n)/', $body);
48 48
 
49 49
 	$body = '';
50
-	foreach ( $lines AS $line ) {
51
-		if ( '>' == substr($line, 0, 1) || '-----' == substr($line, 0, 5) || '_____' == substr($line, 0, 5) ) {
50
+	foreach ($lines AS $line) {
51
+		if ('>' == substr($line, 0, 1) || '-----' == substr($line, 0, 5) || '_____' == substr($line, 0, 5)) {
52 52
 			break;
53 53
 		}
54 54
 
55
-		$body .= $line . "\r\n";
55
+		$body .= $line."\r\n";
56 56
 	}
57 57
 
58 58
 	return trim($body);
59 59
 }
60 60
 
61
-function get_plain_text_subject( $mbox, $msgNum, $headers = null ) {
61
+function get_plain_text_subject($mbox, $msgNum, $headers = null) {
62 62
 	$headers or $headers = imap_headerinfo($mbox, $msgNum);
63 63
 
64 64
 	$subjectParts = imap_mime_header_decode($headers->Subject);
65 65
 	$subject = '';
66
-	foreach ( $subjectParts AS $p ) {
66
+	foreach ($subjectParts AS $p) {
67 67
 		$subject .= $p->text;
68 68
 	}
69 69
 
70 70
 	return trim($subject);
71 71
 }
72 72
 
73
-function get_plain_text_body( $mbox, $msgNum, &$attachments = array() ) {
73
+function get_plain_text_body($mbox, $msgNum, &$attachments = array()) {
74 74
 	$structure = imap_fetchstructure($mbox, $msgNum);
75 75
 
76 76
 	// only plain text
77
-	if ( 'PLAIN' == $structure->subtype ) {
77
+	if ('PLAIN' == $structure->subtype) {
78 78
 		return trim(imap_qprint(imap_body($mbox, $msgNum)));
79 79
 	}
80 80
 
81
-	if ( isset($structure->parts) ) {
81
+	if (isset($structure->parts)) {
82 82
 		// get attachments
83
-		foreach ( $structure->parts AS $partNum => $part ) {
84
-			if ( in_array($part->subtype, array('JPEG', 'PNG', 'GIF')) ) {
83
+		foreach ($structure->parts AS $partNum => $part) {
84
+			if (in_array($part->subtype, array('JPEG', 'PNG', 'GIF'))) {
85 85
 				// oeh an image
86
-				$name = 'image-from-email-'.$msgNum.'.' . strtolower($part->subtype);
87
-				foreach ( $part->parameters AS $param ) {
88
-					if ( 'NAME' == $param->attribute ) {
86
+				$name = 'image-from-email-'.$msgNum.'.'.strtolower($part->subtype);
87
+				foreach ($part->parameters AS $param) {
88
+					if ('NAME' == $param->attribute) {
89 89
 						$name = $param->value;
90 90
 					}
91 91
 				}
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 		}
96 96
 
97 97
 		// multipart (probably) -- look for plain text part
98
-		foreach ( $structure->parts AS $partNum => $part ) {
99
-			if ( 'PLAIN' == $part->subtype ) {
98
+		foreach ($structure->parts AS $partNum => $part) {
99
+			if ('PLAIN' == $part->subtype) {
100 100
 				$body = imap_fetchbody($mbox, $msgNum, (string)($partNum+1));
101 101
 
102 102
 				return trim($body);
103 103
 			}
104
-			else if ( 'ALTERNATIVE' == $part->subtype && isset($part->parts) ) {
105
-				foreach ( $part->parts AS $subPartNum => $subPart ) {
106
-					if ( 'PLAIN' == $subPart->subtype ) {
104
+			else if ('ALTERNATIVE' == $part->subtype && isset($part->parts)) {
105
+				foreach ($part->parts AS $subPartNum => $subPart) {
106
+					if ('PLAIN' == $subPart->subtype) {
107 107
 						$body = imap_fetchbody($mbox, $msgNum, ($partNum+1).'.'.($subPartNum+1));
108 108
 
109 109
 						return trim($body);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,8 +100,7 @@
 block discarded – undo
100 100
 				$body = imap_fetchbody($mbox, $msgNum, (string)($partNum+1));
101 101
 
102 102
 				return trim($body);
103
-			}
104
-			else if ( 'ALTERNATIVE' == $part->subtype && isset($part->parts) ) {
103
+			} else if ( 'ALTERNATIVE' == $part->subtype && isset($part->parts) ) {
105 104
 				foreach ( $part->parts AS $subPartNum => $subPart ) {
106 105
 					if ( 'PLAIN' == $subPart->subtype ) {
107 106
 						$body = imap_fetchbody($mbox, $msgNum, ($partNum+1).'.'.($subPartNum+1));
Please login to merge, or discard this patch.
test.11nk5.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,40 +6,40 @@
 block discarded – undo
6 6
 $mbox = new IMAPMailbox(IMAP_11NK5_HOST, IMAP_11NK5_USER, IMAP_11NK5_PASS, 'INBOX', ['ssl', 'novalidate-cert']);
7 7
 
8 8
 $messages = $mbox->messages(false);
9
-echo count($messages) . " new messages...\n\n";
9
+echo count($messages)." new messages...\n\n";
10 10
 
11 11
 
12 12
 exit;
13 13
 
14 14
 
15
-foreach ( $messages AS $message ) {
15
+foreach ($messages AS $message) {
16 16
 
17 17
 	$title = $message->subject();
18 18
 var_dump($title);
19 19
 
20 20
 	$message->parts();
21 21
 	$body = $message->plainBody;
22
-	if ( $body ) {
22
+	if ($body) {
23 23
 		$text = $body->content();
24 24
 
25
-		if ( preg_match('#^https?://[a-z0-9]#i', $text) ) {
25
+		if (preg_match('#^https?://[a-z0-9]#i', $text)) {
26 26
 			$tags = preg_split('/\s+/', $text);
27 27
 
28 28
 			$url = array_shift($tags);
29 29
 
30 30
 			$tags = implode(' ', $tags);
31 31
 
32
-			if ( $tags ) {
32
+			if ($tags) {
33 33
 var_dump($url);
34 34
 var_dump($tags);
35 35
 
36
-				if ( $message->unseen ) {
36
+				if ($message->unseen) {
37 37
 					$q = compact('title', 'url', 'tags');
38 38
 					$qs = http_build_query($q);
39 39
 
40 40
 					$rsp = @file_get_contents('http://hotblocks.nl/tags/index.php?'.$qs);
41 41
 					echo "SUBMIT URL: ";
42
-					if ( $rsp ) {
42
+					if ($rsp) {
43 43
 						var_dump(strlen($rsp));
44 44
 					}
45 45
 					else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@
 block discarded – undo
41 41
 					echo "SUBMIT URL: ";
42 42
 					if ( $rsp ) {
43 43
 						var_dump(strlen($rsp));
44
-					}
45
-					else {
44
+					} else {
46 45
 						echo "FAIL\n";
47 46
 						$message->unflag('seen');
48 47
 					}
Please login to merge, or discard this patch.
test.br-bounces.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 require 'env.php';
4 4
 require 'IMAP.php';
5 5
 
6
-$mbox = imap_open('{' . IMAP_BOUNCES_HOST . '/novalidate-cert}INBOX', IMAP_BOUNCES_USER, IMAP_BOUNCES_PASS);
6
+$mbox = imap_open('{'.IMAP_BOUNCES_HOST.'/novalidate-cert}INBOX', IMAP_BOUNCES_USER, IMAP_BOUNCES_PASS);
7 7
 
8 8
 $headers = imap_headers($mbox);
9 9
 print_r($headers);
Please login to merge, or discard this patch.
test.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 $messages = $mbox->messages(array('seen' => false, 'offset' => 0, 'limit' => 3, 'newestFirst' => true));
10 10
 #print_r($messages);
11 11
 
12
-foreach ( $messages AS $message ) {
12
+foreach ($messages AS $message) {
13 13
 
14 14
 	echo "------------------------------------------------------------------------\n";
15 15
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 	print_r($message);
22 22
 
23
-	foreach ( $message->attachments AS $attachment ) {
23
+	foreach ($message->attachments AS $attachment) {
24 24
 		var_dump($attachment->save(__DIR__.'/attachments/'));
25 25
 	}
26 26
 
Please login to merge, or discard this patch.