Browse Source

Fix whitespace and comment errors.

mark_story 13 years ago
parent
commit
6f7557898d

+ 18 - 14
lib/Cake/Network/CakeSocket.php

@@ -41,11 +41,11 @@ class CakeSocket {
  * @var array
  */
 	protected $_baseConfig = array(
-		'persistent'	=> false,
-		'host'			=> 'localhost',
-		'protocol'		=> 'tcp',
-		'port'			=> 80,
-		'timeout'		=> 30
+		'persistent' => false,
+		'host' => 'localhost',
+		'protocol' => 'tcp',
+		'port' => 80,
+		'timeout' => 30
 	);
 
 /**
@@ -78,13 +78,15 @@ class CakeSocket {
 
 /**
  * True if the socket stream is encrypted after a CakeSocket::enableCrypto() call
- * @var type 
- */	
+ *
+ * @var boolean
+ */
 	public $encrypted = false;
-	
+
 /**
  * Contains all the encryption methods available
- * @var array 
+ *
+ * @var array
  */
 	protected $_encryptMethods = array(
 		'sslv2_client' => STREAM_CRYPTO_METHOD_SSLv2_CLIENT,
@@ -300,13 +302,14 @@ class CakeSocket {
 
 /**
  * Encrypts current stream socket, using one of the defined encryption methods
- * 
+ *
  * @param string $type can be one of 'ssl2', 'ssl3', 'ssl23' or 'tls'
  * @param string $clientOrServer can be one of 'client', 'server'. Default is 'client'
  * @param boolean $enable enable or disable encryption. Default is true (enable)
  * @return boolean True on success
- * @throws SocketException
- * @see stream_socket_enable_crypto  
+ * @throws InvalidArgumentException When an invalid encryption scheme is chosen.
+ * @throws SocketException When attempting to enable SSL/TLS fails
+ * @see stream_socket_enable_crypto
  */
 	public function enableCrypto($type, $clientOrServer = 'client', $enable = true) {
 		if (!array_key_exists($type . '_' . $clientOrServer, $this->_encryptMethods)) {
@@ -327,5 +330,6 @@ class CakeSocket {
 			$this->setLastError(null, $errorMessage);
 			throw new SocketException($errorMessage);
 		}
-	}	
-}
+	}
+
+}

+ 21 - 20
lib/Cake/Test/Case/Network/CakeSocketTest.php

@@ -217,10 +217,10 @@ class CakeSocketTest extends CakeTestCase {
 
 /**
  * testEncrypt
- * 
+ *
  * @expectedException SocketException
  * @return void
- */	
+ */
 	public function testEnableCryptoSocketExceptionNoSsl() {
 		$configNoSslOrTls = array('host' => 'localhost', 'port' => 80, 'timeout' => 0.1);
 
@@ -232,10 +232,10 @@ class CakeSocketTest extends CakeTestCase {
 
 /**
  * testEnableCryptoSocketExceptionNoTls
- * 
+ *
  * @expectedException SocketException
  * @return void
- */	
+ */
 	public function testEnableCryptoSocketExceptionNoTls() {
 		$configNoSslOrTls = array('host' => 'localhost', 'port' => 80, 'timeout' => 0.1);
 
@@ -247,9 +247,9 @@ class CakeSocketTest extends CakeTestCase {
 
 /**
  * _connectSocketToSslTls
- * 
+ *
  * @return void
- */	
+ */
 	protected function _connectSocketToSslTls() {
 		$configSslTls = array('host' => 'smtp.gmail.com', 'port' => 465, 'timeout' => 5);
 		$this->Socket = new CakeSocket($configSslTls);
@@ -258,22 +258,22 @@ class CakeSocketTest extends CakeTestCase {
 
 /**
  * testEnableCryptoBadMode
- * 
+ *
  * @expectedException InvalidArgumentException
  * @return void
- */	
+ */
 	public function testEnableCryptoBadMode() {
 		// testing wrong encryption mode
 		$this->_connectSocketToSslTls();
 		$this->Socket->enableCrypto('doesntExistMode', 'server');
 		$this->Socket->disconnect();
 	}
-	
+
 /**
  * testEnableCrypto
- * 
+ *
  * @return void
- */	
+ */
 	public function testEnableCrypto() {
 		// testing on ssl server
 		$this->_connectSocketToSslTls();
@@ -285,13 +285,13 @@ class CakeSocketTest extends CakeTestCase {
 		$this->assertTrue($this->Socket->enableCrypto('tls', 'client'));
 		$this->Socket->disconnect();
 	}
-	
+
 /**
  * testEnableCryptoExceptionEnableTwice
- * 
+ *
  * @expectedException SocketException
  * @return void
- */	
+ */
 	public function testEnableCryptoExceptionEnableTwice() {
 		// testing on tls server
 		$this->_connectSocketToSslTls();
@@ -301,26 +301,27 @@ class CakeSocketTest extends CakeTestCase {
 
 /**
  * testEnableCryptoExceptionDisableTwice
- * 
+ *
  * @expectedException SocketException
  * @return void
- */	
+ */
 	public function testEnableCryptoExceptionDisableTwice() {
 		// testing on tls server
 		$this->_connectSocketToSslTls();
 		$this->Socket->enableCrypto('tls', 'client', false);
-	}	
+	}
 
 /**
  * testEnableCryptoEnableStatus
- * 
+ *
  * @return void
- */	
+ */
 	public function testEnableCryptoEnableStatus() {
 		// testing on tls server
 		$this->_connectSocketToSslTls();
 		$this->assertFalse($this->Socket->encrypted);
 		$this->Socket->enableCrypto('tls', 'client', true);
 		$this->assertTrue($this->Socket->encrypted);
-	}	
+	}
+
 }

+ 2 - 2
lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php

@@ -147,7 +147,7 @@ class SmtpTransportTest extends CakeTestCase {
 		$this->socket->expects($this->at(7))->method('read')->will($this->returnValue("500 5.3.3 Unrecognized command\r\n"));
 		$this->SmtpTransport->connect();
 	}
-	
+
 /**
  * testConnectEhloNoTlsOnRequiredTlsServer method
  *
@@ -168,7 +168,7 @@ class SmtpTransportTest extends CakeTestCase {
 		$this->SmtpTransport->connect();
 		$this->SmtpTransport->auth();
 	}
-	
+
 /**
  * testConnectHelo method
  *