| 1 | <?php |
||
| 5 | class SmtpSocketHelper |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var int |
||
| 9 | */ |
||
| 10 | private $port; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var int |
||
| 14 | */ |
||
| 15 | private $timeout; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var resource |
||
| 19 | */ |
||
| 20 | private $handle; |
||
| 21 | |||
| 22 | public function __construct($port = 25, $timeout = 15) |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Checks is resource |
||
| 30 | * |
||
| 31 | * @return bool |
||
| 32 | */ |
||
| 33 | public function isResource() |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Opens resource |
||
| 40 | * |
||
| 41 | * @param string $hostname |
||
| 42 | * @param int $errno |
||
| 43 | * @param string $errstr |
||
| 44 | */ |
||
| 45 | public function open($hostname, &$errno, &$errstr) |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Writes message |
||
| 52 | * |
||
| 53 | * @param string $message |
||
| 54 | * |
||
| 55 | * @return bool|int |
||
| 56 | */ |
||
| 57 | public function write($message) |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Get last response code |
||
| 68 | * |
||
| 69 | * @return int |
||
| 70 | */ |
||
| 71 | public function getResponseCode() |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Closes resource |
||
| 89 | */ |
||
| 90 | public function close() |
||
| 100 | } |
If you suppress an error, we recommend checking for the error condition explicitly: