Permalink
Browse files

Doc fixes;

Ensured proper system level error code/message display;
Minor performance improvement at NetworkStream::setBuffer().
  • Loading branch information...
1 parent 5c569d2 commit 84fc3f645b5c12ebc9bc1c9e5a811c8f3b3af1fe @boenrobot boenrobot committed Jul 29, 2012
@@ -50,7 +50,7 @@ class FilterCollection implements \SeekableIterator, \Countable
* @param string $name The name of the filter.
* @param array $params An array of parameters for the filter.
*
- * @return FilterCollection The collection itself.
+ * @return self|FilterCollection The collection itself.
*/
public function append($name, array $params = array())
{
@@ -70,7 +70,7 @@ public function append($name, array $params = array())
* @param string $name The name of the filter.
* @param array $params An array of parameters for the filter.
*
- * @return FilterCollection The collection itself.
+ * @return self|FilterCollection The collection itself.
*/
public function insertBefore($position, $name, array $params = array())
{
@@ -98,7 +98,7 @@ public function insertBefore($position, $name, array $params = array())
*
* @param int $position The position from which to remove a filter.
*
- * @return FilterCollection The collection itself.
+ * @return self|FilterCollection The collection itself.
*/
public function removeAt($position)
{
@@ -110,7 +110,7 @@ public function removeAt($position)
/**
* Clears the collection
*
- * @return FilterCollection The collection itself.
+ * @return self|FilterCollection The collection itself.
*/
public function clear()
{
@@ -173,7 +173,7 @@ public function next()
}
/**
- * Gets the key at the current pointer position.
+ * Gets the filter name at the current pointer position.
*
* @return string The name of the filter at the current position.
*/
@@ -183,7 +183,7 @@ public function key()
}
/**
- * Gets the response at the current pointer position.
+ * Gets the filter parameters at the current pointer position.
*
* @return array An array of parameters for the filter at the current
* position.
@@ -64,7 +64,7 @@ public function setBuffer($size, $direction = self::DIRECTION_ALL)
if (self::DIRECTION_SEND === $direction
&& function_exists('stream_set_chunk_size') && !$result
) {
- return is_int(stream_set_chunk_size($this->stream, $size));
+ return false !== stream_set_chunk_size($this->stream, $size);
}
return $result;
}
@@ -33,25 +33,24 @@ class SocketException extends \RuntimeException implements Exception
{
/**
- * @var int The error code of the last error on the socket.
+ * @var int The system level error code.
*/
- protected $error_no = 0;
+ protected $error_no;
/**
- * @var string The error message of the last error on the socket.
+ * @var string The system level error message.
*/
- protected $error_str = '';
+ protected $error_str;
/**
* Creates a new socket exception.
*
- * @param string $message The Exception message to throw.
- * @param int $code The Exception code.
- * @param Exception $previous The previous exception used for the exception
- * chaining.
- * @param int $error_no If provided, holds the system level error
- * number that occurred in the system-level connect() call.
- * @param string $error_str The error message as a string.
+ * @param string $message The Exception message to throw.
+ * @param int $code The Exception code.
+ * @param \Exception $previous The previous exception used for the
+ * exception chaining.
+ * @param int $error_no The system level error number.
+ * @param string $error_str The system level error message.
*/
public function __construct($message = '', $code = 0, $previous = null,
$error_no = null, $error_str = null
@@ -62,9 +61,9 @@ public function __construct($message = '', $code = 0, $previous = null,
}
/**
- * Gets the error code of the last error on the socket.
+ * Gets the system level error code on the socket.
*
- * @return int NULL if none was provided or the number itself.
+ * @return int The system level error number.
*/
public function getSocketErrorNumber()
{
@@ -75,9 +74,9 @@ public function getSocketErrorNumber()
// Unreliable in testing.
/**
- * Gets the error message of the last error on the socket.
+ * Gets the system level error message on the socket.
*
- * @return string The error message.
+ * @return string The system level error message.
*/
public function getSocketErrorMessage()
{
@@ -92,10 +91,10 @@ public function getSocketErrorMessage()
public function __toString()
{
$result = parent::__toString();
- if (0 !== $this->getSocketErrorNumber()) {
+ if (null !== $this->getSocketErrorNumber()) {
$result .= "\nSocket error number:" . $this->getSocketErrorNumber();
}
- if ('' !== $this->getSocketErrorMessage()) {
+ if (null !== $this->getSocketErrorMessage()) {
$result .= "\nSocket error message:"
. $this->getSocketErrorMessage();
}

0 comments on commit 84fc3f6

Please sign in to comment.