PEAR2_Net_Transmitter  1.0.0a1
A wrapper for stream functionality
PEAR2/Net/Transmitter/SocketException.php
Go to the documentation of this file.
00001 <?php
00002 
00022 namespace PEAR2\Net\Transmitter;
00023 
00033 class SocketException extends \RuntimeException implements Exception
00034 {
00035 
00039     protected $error_no = 0;
00040 
00044     protected $error_str = '';
00045 
00057     public function __construct($message = '', $code = 0, $previous = null,
00058         $error_no = null, $error_str = null
00059     ) {
00060         parent::__construct($message, $code, $previous);
00061         $this->error_no = $error_no;
00062         $this->error_str = $error_str;
00063     }
00064 
00070     public function getSocketErrorNumber()
00071     {
00072         return $this->error_no;
00073     }
00074 
00075     // @codeCoverageIgnoreStart
00076     // Unreliable in testing.
00077 
00083     public function getSocketErrorMessage()
00084     {
00085         return $this->error_str;
00086     }
00087 
00093     public function __toString()
00094     {
00095         $result = parent::__toString();
00096         if (0 !== $this->getSocketErrorNumber()) {
00097             $result .= "\nSocket error number:" . $this->getSocketErrorNumber();
00098         }
00099         if ('' !== $this->getSocketErrorMessage()) {
00100             $result .= "\nSocket error message:"
00101                 . $this->getSocketErrorMessage();
00102         }
00103         return $result;
00104     }
00105 
00106     // @codeCoverageIgnoreEnd
00107 }