@@ -17,8 +17,7 @@ |
||
17 | 17 | public function __toString () { |
18 | 18 | try { |
19 | 19 | return implode(':', $this->getSockName()); |
20 | - } |
|
21 | - catch (\Exception $e) { |
|
20 | + } catch (\Exception $e) { |
|
22 | 21 | return ':'; |
23 | 22 | } |
24 | 23 | } |
@@ -52,8 +52,7 @@ |
||
52 | 52 | if ($chunk === '') { |
53 | 53 | return $data; |
54 | 54 | } |
55 | - } |
|
56 | - catch (Error $error) { |
|
55 | + } catch (Error $error) { |
|
57 | 56 | $error->setExtra($data); |
58 | 57 | throw $error; |
59 | 58 | } |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | public function __toString () { |
18 | 18 | try { |
19 | 19 | return implode(':', $this->getPeerName()); |
20 | - } |
|
21 | - catch (\Exception $exception) { |
|
20 | + } catch (\Exception $exception) { |
|
22 | 21 | return ':'; |
23 | 22 | } |
24 | 23 | } |
@@ -107,8 +106,7 @@ discard block |
||
107 | 106 | try { |
108 | 107 | $total += $count = $this->await(self::CH_WRITE)->send($data); |
109 | 108 | $data = substr($data, $count); // 0 bytes sent = unaltered buffer |
110 | - } |
|
111 | - catch (Error $error) { |
|
109 | + } catch (Error $error) { |
|
112 | 110 | $error->setExtra($total); |
113 | 111 | throw $error; |
114 | 112 | } |
@@ -96,11 +96,9 @@ discard block |
||
96 | 96 | public function __construct ($resource) { |
97 | 97 | if (!is_resource($resource) or get_resource_type($resource) !== 'Socket') { |
98 | 98 | throw new InvalidArgumentException('Expected an open socket resource.', SOCKET_EBADF); |
99 | - } |
|
100 | - elseif (socket_get_option($resource, SOL_SOCKET, SO_TYPE) !== static::getType()) { |
|
99 | + } elseif (socket_get_option($resource, SOL_SOCKET, SO_TYPE) !== static::getType()) { |
|
101 | 100 | throw new InvalidArgumentException('The given socket resource is of the wrong type for ' . get_class(), SOCKET_ESOCKTNOSUPPORT); |
102 | - } |
|
103 | - elseif ($errno = Error::getLast($resource)) { |
|
101 | + } elseif ($errno = Error::getLast($resource)) { |
|
104 | 102 | $error = new Error(SOCKET_EBADFD); |
105 | 103 | $error->setExtra($errno); |
106 | 104 | throw $error; |
@@ -331,8 +329,7 @@ discard block |
||
331 | 329 | public function setBlocking ($blocking) { |
332 | 330 | if ($blocking) { |
333 | 331 | $success = @socket_set_block($this->resource); |
334 | - } |
|
335 | - else { |
|
332 | + } else { |
|
336 | 333 | $success = @socket_set_nonblock($this->resource); |
337 | 334 | } |
338 | 335 | if (!$success) { |
@@ -57,14 +57,12 @@ |
||
57 | 57 | public function __construct ($subject = null, $fallback = 0) { |
58 | 58 | if (is_int($subject)) { |
59 | 59 | $errno = $subject; |
60 | - } |
|
61 | - else { |
|
60 | + } else { |
|
62 | 61 | $errno = static::getLast($subject); |
63 | 62 | } |
64 | 63 | if ($errno) { |
65 | 64 | $message = socket_strerror($errno); |
66 | - } |
|
67 | - else { |
|
65 | + } else { |
|
68 | 66 | $errno = $fallback; |
69 | 67 | $message = error_get_last()['message']; |
70 | 68 | } |