forked from kevinowino869/mitrobill
update PEAR
This commit is contained in:
@ -2,19 +2,20 @@
|
||||
|
||||
/**
|
||||
* Wrapper for network stream functionality.
|
||||
*
|
||||
|
||||
*
|
||||
* PHP has built in support for various types of network streams, such as HTTP and TCP sockets. One problem that arises with them is the fact that a single fread/fwrite call might not read/write all the data you intended, regardless of whether you're in blocking mode or not. While the PHP manual offers a workaround in the form of a loop with a few variables, using it every single time you want to read/write can be tedious.
|
||||
|
||||
This package abstracts this away, so that when you want to get exactly N amount of bytes, you can be sure the upper levels of your app will be dealing with N bytes. Oh, and the functionality is nicely wrapped in an object (but that's just the icing on the cake).
|
||||
*
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
*
|
||||
* @category Net
|
||||
* @package PEAR2_Net_Transmitter
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
* @copyright 2011 Vasil Rangelov
|
||||
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
|
||||
* @version 1.0.0a5
|
||||
* @version 1.0.0b2
|
||||
* @link http://pear2.php.net/PEAR2_Net_Transmitter
|
||||
*/
|
||||
/**
|
||||
@ -34,7 +35,7 @@ use Exception as E;
|
||||
|
||||
/**
|
||||
* Exception thrown when something goes wrong with the connection.
|
||||
*
|
||||
*
|
||||
* @category Net
|
||||
* @package PEAR2_Net_Transmitter
|
||||
* @author Vasil Rangelov <boen.robot@gmail.com>
|
||||
@ -44,18 +45,21 @@ use Exception as E;
|
||||
class StreamException extends RuntimeException implements Exception
|
||||
{
|
||||
/**
|
||||
* @var int|string|resource|null The fragment up until the point of failure.
|
||||
* On failure with sending, this is the number of bytes sent
|
||||
* successfully before the failure.
|
||||
* On failure when receiving, this is a string/stream holding
|
||||
* the contents received successfully before the failure.
|
||||
* NULL if the failure occured before the operation started.
|
||||
* The fragment up until the point of failure.
|
||||
*
|
||||
* On failure with sending, this is the number of bytes sent successfully
|
||||
* before the failure.
|
||||
* On failure when receiving, this is a string/stream holding the contents
|
||||
* received successfully before the failure.
|
||||
* NULL if the failure occurred before the operation started.
|
||||
*
|
||||
* @var int|string|resource|null
|
||||
*/
|
||||
protected $fragment = null;
|
||||
|
||||
/**
|
||||
* Creates a new stream exception.
|
||||
*
|
||||
*
|
||||
* @param string $message The Exception message to throw.
|
||||
* @param int $code The Exception code.
|
||||
* @param E|null $previous Previous exception thrown,
|
||||
@ -66,7 +70,7 @@ class StreamException extends RuntimeException implements Exception
|
||||
* successfully before the failure.
|
||||
* On failure when receiving, this is a string/stream holding
|
||||
* the contents received successfully before the failure.
|
||||
* NULL if the failure occured before the operation started.
|
||||
* NULL if the failure occurred before the operation started.
|
||||
*/
|
||||
public function __construct(
|
||||
$message,
|
||||
@ -80,14 +84,14 @@ class StreamException extends RuntimeException implements Exception
|
||||
|
||||
/**
|
||||
* Gets the stream fragment.
|
||||
*
|
||||
*
|
||||
* @return int|string|resource|null The fragment up until the
|
||||
* point of failure.
|
||||
* On failure with sending, this is the number of bytes sent
|
||||
* successfully before the failure.
|
||||
* On failure when receiving, this is a string/stream holding
|
||||
* the contents received successfully before the failure.
|
||||
* NULL if the failure occured before the operation started.
|
||||
* NULL if the failure occurred before the operation started.
|
||||
*/
|
||||
public function getFragment()
|
||||
{
|
||||
@ -99,7 +103,7 @@ class StreamException extends RuntimeException implements Exception
|
||||
|
||||
/**
|
||||
* Returns a string representation of the exception.
|
||||
*
|
||||
*
|
||||
* @return string The exception as a string.
|
||||
*/
|
||||
public function __toString()
|
||||
|
Reference in New Issue
Block a user