| @@ 182-202 (lines=21) @@ | ||
| 179 | * |
|
| 180 | * @return string |
|
| 181 | */ |
|
| 182 | public function readLine($sequence) |
|
| 183 | { |
|
| 184 | if ( |
|
| 185 | !isset($this->_out) |
|
| 186 | || |
|
| 187 | feof($this->_out) |
|
| 188 | ) { |
|
| 189 | // TODO? |
|
| 190 | return; |
|
| 191 | } |
|
| 192 | ||
| 193 | $line = fgets($this->_out); |
|
| 194 | if (!$line) { |
|
| 195 | $metas = stream_get_meta_data($this->_out); |
|
| 196 | if ($metas['timed_out']) { |
|
| 197 | throw new Swift_IoException('Connection to ' . $this->_getReadConnectionDescription() . ' Timed Out'); |
|
| 198 | } |
|
| 199 | } |
|
| 200 | ||
| 201 | return $line; |
|
| 202 | } |
|
| 203 | ||
| 204 | /** |
|
| 205 | * Reads $length bytes from the stream into a string and moves the pointer |
|
| @@ 217-239 (lines=23) @@ | ||
| 214 | * |
|
| 215 | * @return string|null |
|
| 216 | */ |
|
| 217 | public function read($length) |
|
| 218 | { |
|
| 219 | if ( |
|
| 220 | !isset($this->_out) |
|
| 221 | || |
|
| 222 | feof($this->_out) |
|
| 223 | ) { |
|
| 224 | // TODO? |
|
| 225 | return; |
|
| 226 | } |
|
| 227 | ||
| 228 | $ret = fread($this->_out, $length); |
|
| 229 | if (!$ret) { |
|
| 230 | $metas = stream_get_meta_data($this->_out); |
|
| 231 | if ($metas['timed_out']) { |
|
| 232 | throw new Swift_IoException( |
|
| 233 | 'Connection to ' . $this->_getReadConnectionDescription() . ' Timed Out' |
|
| 234 | ); |
|
| 235 | } |
|
| 236 | } |
|
| 237 | ||
| 238 | return $ret; |
|
| 239 | } |
|
| 240 | ||
| 241 | /** |
|
| 242 | * WARNING: Not implemented |
|