Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix whitespace and comment errors.

  • Loading branch information...
commit 6f7557898d2e5bb22b2d030b860d111f76279fb3 1 parent 4487673
@markstory markstory authored
View
32 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 @@ public function reset($state = null) {
/**
* 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 @@ public function enableCrypto($type, $clientOrServer = 'client', $enable = true)
$this->setLastError(null, $errorMessage);
throw new SocketException($errorMessage);
}
- }
-}
+ }
+
+}
View
41 lib/Cake/Test/Case/Network/CakeSocketTest.php
@@ -217,10 +217,10 @@ public function testReset() {
/**
* testEncrypt
- *
+ *
* @expectedException SocketException
* @return void
- */
+ */
public function testEnableCryptoSocketExceptionNoSsl() {
$configNoSslOrTls = array('host' => 'localhost', 'port' => 80, 'timeout' => 0.1);
@@ -232,10 +232,10 @@ public function testEnableCryptoSocketExceptionNoSsl() {
/**
* testEnableCryptoSocketExceptionNoTls
- *
+ *
* @expectedException SocketException
* @return void
- */
+ */
public function testEnableCryptoSocketExceptionNoTls() {
$configNoSslOrTls = array('host' => 'localhost', 'port' => 80, 'timeout' => 0.1);
@@ -247,9 +247,9 @@ public function testEnableCryptoSocketExceptionNoTls() {
/**
* _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 @@ protected function _connectSocketToSslTls() {
/**
* 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 @@ public function testEnableCrypto() {
$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 @@ public function testEnableCryptoExceptionEnableTwice() {
/**
* 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);
- }
+ }
+
}
View
4 lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php
@@ -147,7 +147,7 @@ public function testConnectEhloTlsOnNonTlsServer() {
$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 @@ public function testConnectEhloNoTlsOnRequiredTlsServer() {
$this->SmtpTransport->connect();
$this->SmtpTransport->auth();
}
-
+
/**
* testConnectHelo method
*
Please sign in to comment.
Something went wrong with that request. Please try again.