@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param resource $resource |
| 53 | 53 | * @param WebSocketServer $server |
| 54 | 54 | */ |
| 55 | - public function __construct ($resource, WebSocketServer $server) { |
|
| 55 | + public function __construct($resource, WebSocketServer $server) { |
|
| 56 | 56 | parent::__construct($resource); |
| 57 | 57 | $this->server = $server; |
| 58 | 58 | $this->handshake = new Handshake($this); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @param string $reason Sent to the peer, if code is >= 1000 |
| 78 | 78 | * @return $this |
| 79 | 79 | */ |
| 80 | - public function close (int $code = null, string $reason = '') { |
|
| 80 | + public function close(int $code = null, string $reason = '') { |
|
| 81 | 81 | try { |
| 82 | 82 | if ($code >= 1000 and $this->isOk()) { |
| 83 | 83 | $this->frameHandler->writeClose($code, $reason); |
@@ -94,32 +94,32 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | * @return FrameHandler |
| 96 | 96 | */ |
| 97 | - public function getFrameHandler (): FrameHandler { |
|
| 97 | + public function getFrameHandler(): FrameHandler { |
|
| 98 | 98 | return $this->frameHandler; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * @return WebSocketServer |
| 103 | 103 | */ |
| 104 | - public function getServer (): WebSocketServer { |
|
| 104 | + public function getServer(): WebSocketServer { |
|
| 105 | 105 | return $this->server; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * @return int |
| 110 | 110 | */ |
| 111 | - public function getState (): int { |
|
| 111 | + public function getState(): int { |
|
| 112 | 112 | return $this->state; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - final public function isNegotiating (): bool { |
|
| 115 | + final public function isNegotiating(): bool { |
|
| 116 | 116 | return $this->state === self::STATE_HANDSHAKE; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * @return bool |
| 121 | 121 | */ |
| 122 | - final public function isOk (): bool { |
|
| 122 | + final public function isOk(): bool { |
|
| 123 | 123 | return $this->state === self::STATE_OK; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @param string $binary |
| 132 | 132 | * @throws WebSocketError |
| 133 | 133 | */ |
| 134 | - public function onBinary (string $binary): void { |
|
| 134 | + public function onBinary(string $binary): void { |
|
| 135 | 135 | unset($binary); |
| 136 | 136 | throw new WebSocketError(Frame::CLOSE_UNHANDLED_DATA, "I don't handle binary data."); |
| 137 | 137 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @param int $code |
| 143 | 143 | * @param string $reason |
| 144 | 144 | */ |
| 145 | - public function onClose (int $code, string $reason): void { |
|
| 145 | + public function onClose(int $code, string $reason): void { |
|
| 146 | 146 | unset($code, $reason); |
| 147 | 147 | $this->close(); |
| 148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * Closes the connection with a protocol-error frame. |
| 156 | 156 | */ |
| 157 | - final public function onOutOfBand (): void { |
|
| 157 | + final public function onOutOfBand(): void { |
|
| 158 | 158 | $this->close(Frame::CLOSE_PROTOCOL_ERROR, "Received out-of-band data."); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @param string $message |
| 167 | 167 | */ |
| 168 | - public function onPing (string $message): void { |
|
| 168 | + public function onPing(string $message): void { |
|
| 169 | 169 | $this->frameHandler->writePong($message); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * |
| 177 | 177 | * @param string $message |
| 178 | 178 | */ |
| 179 | - public function onPong (string $message): void { |
|
| 179 | + public function onPong(string $message): void { |
|
| 180 | 180 | // stub |
| 181 | 181 | } |
| 182 | 182 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @throws WebSocketError |
| 187 | 187 | * @throws Throwable |
| 188 | 188 | */ |
| 189 | - public function onReadable (): void { |
|
| 189 | + public function onReadable(): void { |
|
| 190 | 190 | try { |
| 191 | 191 | if ($this->isNegotiating()) { |
| 192 | 192 | if ($this->handshake->onReadable()) { |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * If you have negotiated an extension during {@link Handshake}, |
| 217 | 217 | * claim the RSV bits here via {@link FrameReader::setRsv()} |
| 218 | 218 | */ |
| 219 | - protected function onStateOk (): void { |
|
| 219 | + protected function onStateOk(): void { |
|
| 220 | 220 | // stub |
| 221 | 221 | } |
| 222 | 222 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @param string $text |
| 229 | 229 | * @throws WebSocketError |
| 230 | 230 | */ |
| 231 | - public function onText (string $text): void { |
|
| 231 | + public function onText(string $text): void { |
|
| 232 | 232 | unset($text); |
| 233 | 233 | throw new WebSocketError(Frame::CLOSE_UNHANDLED_DATA, "I don't handle text."); |
| 234 | 234 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * |
| 239 | 239 | * @param string $binary |
| 240 | 240 | */ |
| 241 | - public function writeBinary (string $binary): void { |
|
| 241 | + public function writeBinary(string $binary): void { |
|
| 242 | 242 | $this->frameHandler->writeBinary($binary); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | * @param string $text |
| 249 | 249 | */ |
| 250 | - public function writeText (string $text): void { |
|
| 250 | + public function writeText(string $text): void { |
|
| 251 | 251 | $this->frameHandler->writeText($text); |
| 252 | 252 | } |
| 253 | 253 | |