Skip to content
This repository
Browse code

Fix whitespace and comment errors.

  • Loading branch information...
commit 6f7557898d2e5bb22b2d030b860d111f76279fb3 1 parent 4487673
Mark Story authored August 09, 2012
32  lib/Cake/Network/CakeSocket.php
@@ -41,11 +41,11 @@ class CakeSocket {
41 41
  * @var array
42 42
  */
43 43
 	protected $_baseConfig = array(
44  
-		'persistent'	=> false,
45  
-		'host'			=> 'localhost',
46  
-		'protocol'		=> 'tcp',
47  
-		'port'			=> 80,
48  
-		'timeout'		=> 30
  44
+		'persistent' => false,
  45
+		'host' => 'localhost',
  46
+		'protocol' => 'tcp',
  47
+		'port' => 80,
  48
+		'timeout' => 30
49 49
 	);
50 50
 
51 51
 /**
@@ -78,13 +78,15 @@ class CakeSocket {
78 78
 
79 79
 /**
80 80
  * True if the socket stream is encrypted after a CakeSocket::enableCrypto() call
81  
- * @var type 
82  
- */	
  81
+ *
  82
+ * @var boolean
  83
+ */
83 84
 	public $encrypted = false;
84  
-	
  85
+
85 86
 /**
86 87
  * Contains all the encryption methods available
87  
- * @var array 
  88
+ *
  89
+ * @var array
88 90
  */
89 91
 	protected $_encryptMethods = array(
90 92
 		'sslv2_client' => STREAM_CRYPTO_METHOD_SSLv2_CLIENT,
@@ -300,13 +302,14 @@ public function reset($state = null) {
300 302
 
301 303
 /**
302 304
  * Encrypts current stream socket, using one of the defined encryption methods
303  
- * 
  305
+ *
304 306
  * @param string $type can be one of 'ssl2', 'ssl3', 'ssl23' or 'tls'
305 307
  * @param string $clientOrServer can be one of 'client', 'server'. Default is 'client'
306 308
  * @param boolean $enable enable or disable encryption. Default is true (enable)
307 309
  * @return boolean True on success
308  
- * @throws SocketException
309  
- * @see stream_socket_enable_crypto  
  310
+ * @throws InvalidArgumentException When an invalid encryption scheme is chosen.
  311
+ * @throws SocketException When attempting to enable SSL/TLS fails
  312
+ * @see stream_socket_enable_crypto
310 313
  */
311 314
 	public function enableCrypto($type, $clientOrServer = 'client', $enable = true) {
312 315
 		if (!array_key_exists($type . '_' . $clientOrServer, $this->_encryptMethods)) {
@@ -327,5 +330,6 @@ public function enableCrypto($type, $clientOrServer = 'client', $enable = true)
327 330
 			$this->setLastError(null, $errorMessage);
328 331
 			throw new SocketException($errorMessage);
329 332
 		}
330  
-	}	
331  
-}
  333
+	}
  334
+
  335
+}
41  lib/Cake/Test/Case/Network/CakeSocketTest.php
@@ -217,10 +217,10 @@ public function testReset() {
217 217
 
218 218
 /**
219 219
  * testEncrypt
220  
- * 
  220
+ *
221 221
  * @expectedException SocketException
222 222
  * @return void
223  
- */	
  223
+ */
224 224
 	public function testEnableCryptoSocketExceptionNoSsl() {
225 225
 		$configNoSslOrTls = array('host' => 'localhost', 'port' => 80, 'timeout' => 0.1);
226 226
 
@@ -232,10 +232,10 @@ public function testEnableCryptoSocketExceptionNoSsl() {
232 232
 
233 233
 /**
234 234
  * testEnableCryptoSocketExceptionNoTls
235  
- * 
  235
+ *
236 236
  * @expectedException SocketException
237 237
  * @return void
238  
- */	
  238
+ */
239 239
 	public function testEnableCryptoSocketExceptionNoTls() {
240 240
 		$configNoSslOrTls = array('host' => 'localhost', 'port' => 80, 'timeout' => 0.1);
241 241
 
@@ -247,9 +247,9 @@ public function testEnableCryptoSocketExceptionNoTls() {
247 247
 
248 248
 /**
249 249
  * _connectSocketToSslTls
250  
- * 
  250
+ *
251 251
  * @return void
252  
- */	
  252
+ */
253 253
 	protected function _connectSocketToSslTls() {
254 254
 		$configSslTls = array('host' => 'smtp.gmail.com', 'port' => 465, 'timeout' => 5);
255 255
 		$this->Socket = new CakeSocket($configSslTls);
@@ -258,22 +258,22 @@ protected function _connectSocketToSslTls() {
258 258
 
259 259
 /**
260 260
  * testEnableCryptoBadMode
261  
- * 
  261
+ *
262 262
  * @expectedException InvalidArgumentException
263 263
  * @return void
264  
- */	
  264
+ */
265 265
 	public function testEnableCryptoBadMode() {
266 266
 		// testing wrong encryption mode
267 267
 		$this->_connectSocketToSslTls();
268 268
 		$this->Socket->enableCrypto('doesntExistMode', 'server');
269 269
 		$this->Socket->disconnect();
270 270
 	}
271  
-	
  271
+
272 272
 /**
273 273
  * testEnableCrypto
274  
- * 
  274
+ *
275 275
  * @return void
276  
- */	
  276
+ */
277 277
 	public function testEnableCrypto() {
278 278
 		// testing on ssl server
279 279
 		$this->_connectSocketToSslTls();
@@ -285,13 +285,13 @@ public function testEnableCrypto() {
285 285
 		$this->assertTrue($this->Socket->enableCrypto('tls', 'client'));
286 286
 		$this->Socket->disconnect();
287 287
 	}
288  
-	
  288
+
289 289
 /**
290 290
  * testEnableCryptoExceptionEnableTwice
291  
- * 
  291
+ *
292 292
  * @expectedException SocketException
293 293
  * @return void
294  
- */	
  294
+ */
295 295
 	public function testEnableCryptoExceptionEnableTwice() {
296 296
 		// testing on tls server
297 297
 		$this->_connectSocketToSslTls();
@@ -301,26 +301,27 @@ public function testEnableCryptoExceptionEnableTwice() {
301 301
 
302 302
 /**
303 303
  * testEnableCryptoExceptionDisableTwice
304  
- * 
  304
+ *
305 305
  * @expectedException SocketException
306 306
  * @return void
307  
- */	
  307
+ */
308 308
 	public function testEnableCryptoExceptionDisableTwice() {
309 309
 		// testing on tls server
310 310
 		$this->_connectSocketToSslTls();
311 311
 		$this->Socket->enableCrypto('tls', 'client', false);
312  
-	}	
  312
+	}
313 313
 
314 314
 /**
315 315
  * testEnableCryptoEnableStatus
316  
- * 
  316
+ *
317 317
  * @return void
318  
- */	
  318
+ */
319 319
 	public function testEnableCryptoEnableStatus() {
320 320
 		// testing on tls server
321 321
 		$this->_connectSocketToSslTls();
322 322
 		$this->assertFalse($this->Socket->encrypted);
323 323
 		$this->Socket->enableCrypto('tls', 'client', true);
324 324
 		$this->assertTrue($this->Socket->encrypted);
325  
-	}	
  325
+	}
  326
+
326 327
 }
4  lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php
@@ -147,7 +147,7 @@ public function testConnectEhloTlsOnNonTlsServer() {
147 147
 		$this->socket->expects($this->at(7))->method('read')->will($this->returnValue("500 5.3.3 Unrecognized command\r\n"));
148 148
 		$this->SmtpTransport->connect();
149 149
 	}
150  
-	
  150
+
151 151
 /**
152 152
  * testConnectEhloNoTlsOnRequiredTlsServer method
153 153
  *
@@ -168,7 +168,7 @@ public function testConnectEhloNoTlsOnRequiredTlsServer() {
168 168
 		$this->SmtpTransport->connect();
169 169
 		$this->SmtpTransport->auth();
170 170
 	}
171  
-	
  171
+
172 172
 /**
173 173
  * testConnectHelo method
174 174
  *

0 notes on commit 6f75578

Please sign in to comment.
Something went wrong with that request. Please try again.