| @@ -274,9 +274,9 @@ discard block | ||
| 274 | 274 | $this->readable = false; | 
| 275 | 275 | $this->writable = false; | 
| 276 | 276 | |
| 277 | -        $this->emit('close', [ $this ]); | |
| 277 | +        $this->emit('close', [$this]); | |
| 278 | 278 | $this->pause(); | 
| 279 | -        $this->emit('done', [ $this ]); | |
| 279 | +        $this->emit('done', [$this]); | |
| 280 | 280 | } | 
| 281 | 281 | |
| 282 | 282 | /** | 
| @@ -334,11 +334,11 @@ discard block | ||
| 334 | 334 | } | 
| 335 | 335 | else if ($ret !== '') | 
| 336 | 336 |          { | 
| 337 | -            $this->emit('data', [ $this, $ret ]); | |
| 337 | +            $this->emit('data', [$this, $ret]); | |
| 338 | 338 | |
| 339 | 339 | if (strlen($ret) < $length) | 
| 340 | 340 |              { | 
| 341 | -                $this->emit('end', [ $this ]); | |
| 341 | +                $this->emit('end', [$this]); | |
| 342 | 342 | } | 
| 343 | 343 | } | 
| 344 | 344 | |
| @@ -385,8 +385,8 @@ discard block | ||
| 385 | 385 | } | 
| 386 | 386 | |
| 387 | 387 | $this->writable = false; // this is single-use stream only! | 
| 388 | -        $this->emit('drain', [ $this ]); | |
| 389 | -        $this->emit('finish', [ $this ]); | |
| 388 | +        $this->emit('drain', [$this]); | |
| 389 | +        $this->emit('finish', [$this]); | |
| 390 | 390 | |
| 391 | 391 | return true; | 
| 392 | 392 | } | 
| @@ -400,7 +400,7 @@ discard block | ||
| 400 | 400 | */ | 
| 401 | 401 | protected function throwAndEmitException($ex) | 
| 402 | 402 |      { | 
| 403 | -        $this->emit('error', [ $this, $ex ]); | |
| 403 | +        $this->emit('error', [$this, $ex]); | |
| 404 | 404 | throw $ex; | 
| 405 | 405 | } | 
| 406 | 406 | } | 
| @@ -194,9 +194,9 @@ discard block | ||
| 194 | 194 | $this->writeEnd(); | 
| 195 | 195 | } | 
| 196 | 196 | |
| 197 | -        $this->emit('close', [ $this ]); | |
| 197 | +        $this->emit('close', [$this]); | |
| 198 | 198 | $this->handleClose(); | 
| 199 | -        $this->emit('done', [ $this ]); | |
| 199 | +        $this->emit('done', [$this]); | |
| 200 | 200 | } | 
| 201 | 201 | |
| 202 | 202 | /** | 
| @@ -226,7 +226,7 @@ discard block | ||
| 226 | 226 | |
| 227 | 227 | if ($text !== '' && !$sent) | 
| 228 | 228 |              { | 
| 229 | -                $this->emit('error', [ $this, new WriteException('Error occurred while writing to the stream resource.') ]); | |
| 229 | +                $this->emit('error', [$this, new WriteException('Error occurred while writing to the stream resource.')]); | |
| 230 | 230 | return; | 
| 231 | 231 | } | 
| 232 | 232 | |
| @@ -234,21 +234,21 @@ discard block | ||
| 234 | 234 | $lenAfter = $lenBefore - $sent; | 
| 235 | 235 | $this->buffer->remove($sent); | 
| 236 | 236 | |
| 237 | -            $this->emit('drain', [ $this ]); | |
| 237 | +            $this->emit('drain', [$this]); | |
| 238 | 238 | |
| 239 | 239 | if ($lenAfter === 0 && $this->buffer->isEmpty()) | 
| 240 | 240 |              { | 
| 241 | 241 | $this->writing = false; | 
| 242 | -                $this->emit('finish', [ $this ]); | |
| 242 | +                $this->emit('finish', [$this]); | |
| 243 | 243 | } | 
| 244 | 244 | } | 
| 245 | 245 | catch (Error $ex) | 
| 246 | 246 |          { | 
| 247 | -            $this->emit('error', [ $this, $ex ]); | |
| 247 | +            $this->emit('error', [$this, $ex]); | |
| 248 | 248 | } | 
| 249 | 249 | catch (Exception $ex) | 
| 250 | 250 |          { | 
| 251 | -            $this->emit('error', [ $this, $ex ]); | |
| 251 | +            $this->emit('error', [$this, $ex]); | |
| 252 | 252 | } | 
| 253 | 253 | } | 
| 254 | 254 | |
| @@ -271,28 +271,28 @@ discard block | ||
| 271 | 271 | |
| 272 | 272 | if ($ret === false) | 
| 273 | 273 |              { | 
| 274 | -                $this->emit('error', [ $this, new ReadException('Error occurred while reading from the stream resource.') ]); | |
| 274 | +                $this->emit('error', [$this, new ReadException('Error occurred while reading from the stream resource.')]); | |
| 275 | 275 | return; | 
| 276 | 276 | } | 
| 277 | 277 | |
| 278 | 278 | if ($ret !== '') | 
| 279 | 279 |              { | 
| 280 | -                $this->emit('data', [ $this, $ret ]); | |
| 280 | +                $this->emit('data', [$this, $ret]); | |
| 281 | 281 | |
| 282 | 282 | if (strlen($ret) < $length) | 
| 283 | 283 |                  { | 
| 284 | 284 | $this->reading = false; | 
| 285 | -                    $this->emit('end', [ $this ]); | |
| 285 | +                    $this->emit('end', [$this]); | |
| 286 | 286 | } | 
| 287 | 287 | } | 
| 288 | 288 | } | 
| 289 | 289 | catch (Error $ex) | 
| 290 | 290 |          { | 
| 291 | -            $this->emit('error', [ $this, $ex ]); | |
| 291 | +            $this->emit('error', [$this, $ex]); | |
| 292 | 292 | } | 
| 293 | 293 | catch (Exception $ex) | 
| 294 | 294 |          { | 
| 295 | -            $this->emit('error', [ $this, $ex ]); | |
| 295 | +            $this->emit('error', [$this, $ex]); | |
| 296 | 296 | } | 
| 297 | 297 | } | 
| 298 | 298 | |
| @@ -134,13 +134,13 @@ discard block | ||
| 134 | 134 | |
| 135 | 135 | if (!$resource || !is_resource($resource)) | 
| 136 | 136 |          { | 
| 137 | -            $this->emit('error', [ $this, new ExecutionException('SSH2:Sftp could not be connected.') ]); | |
| 137 | +            $this->emit('error', [$this, new ExecutionException('SSH2:Sftp could not be connected.')]); | |
| 138 | 138 | return; | 
| 139 | 139 | } | 
| 140 | 140 | |
| 141 | 141 | $this->resource = $resource; | 
| 142 | 142 | |
| 143 | -        $this->emit('connect', [ $this ]); | |
| 143 | +        $this->emit('connect', [$this]); | |
| 144 | 144 | } | 
| 145 | 145 | |
| 146 | 146 | /** | 
| @@ -162,7 +162,7 @@ discard block | ||
| 162 | 162 | } | 
| 163 | 163 | |
| 164 | 164 | $this->handleDisconnect(); | 
| 165 | -        $this->emit('disconnect', [ $this ]); | |
| 165 | +        $this->emit('disconnect', [$this]); | |
| 166 | 166 | } | 
| 167 | 167 | |
| 168 | 168 | /** | 
| @@ -204,7 +204,7 @@ discard block | ||
| 204 | 204 | |
| 205 | 205 | if ($this->timer === null) | 
| 206 | 206 |              { | 
| 207 | - $this->timer = $this->loop->addPeriodicTimer($this->interval, [ $this, 'handleHeartbeat' ]); | |
| 207 | + $this->timer = $this->loop->addPeriodicTimer($this->interval, [$this, 'handleHeartbeat']); | |
| 208 | 208 | } | 
| 209 | 209 | } | 
| 210 | 210 | } | 
| @@ -238,11 +238,11 @@ discard block | ||
| 238 | 238 | |
| 239 | 239 | $resource = new SftpResource($this, $stream); | 
| 240 | 240 |          $resource->on('open', function(SSH2ResourceInterface $resource) { | 
| 241 | -            $this->emit('resource:open', [ $this, $resource ]); | |
| 241 | +            $this->emit('resource:open', [$this, $resource]); | |
| 242 | 242 | }); | 
| 243 | 243 |          $resource->on('close', function(SSH2ResourceInterface $resource) { | 
| 244 | 244 | $this->removeResource($resource->getId()); | 
| 245 | -            $this->emit('resource:close', [ $this, $resource ]); | |
| 245 | +            $this->emit('resource:close', [$this, $resource]); | |
| 246 | 246 | }); | 
| 247 | 247 | |
| 248 | 248 | $this->resources[$resource->getId()] = $resource; | 
| @@ -131,13 +131,13 @@ discard block | ||
| 131 | 131 | |
| 132 | 132 | if (!$shell || !is_resource($shell)) | 
| 133 | 133 |          { | 
| 134 | -            $this->emit('error', [ $this, new ExecutionException('SSH2:Shell could not be connected.') ]); | |
| 134 | +            $this->emit('error', [$this, new ExecutionException('SSH2:Shell could not be connected.')]); | |
| 135 | 135 | return; | 
| 136 | 136 | } | 
| 137 | 137 | |
| 138 | 138 | $this->resource = $shell; | 
| 139 | 139 | |
| 140 | -        $this->emit('connect', [ $this ]); | |
| 140 | +        $this->emit('connect', [$this]); | |
| 141 | 141 | } | 
| 142 | 142 | |
| 143 | 143 | /** | 
| @@ -159,7 +159,7 @@ discard block | ||
| 159 | 159 | } | 
| 160 | 160 | |
| 161 | 161 | $this->handleDisconnect(); | 
| 162 | -        $this->emit('disconnect', [ $this ]); | |
| 162 | +        $this->emit('disconnect', [$this]); | |
| 163 | 163 | } | 
| 164 | 164 | |
| 165 | 165 | /** | 
| @@ -201,7 +201,7 @@ discard block | ||
| 201 | 201 | |
| 202 | 202 | if ($this->timer === null) | 
| 203 | 203 |              { | 
| 204 | - $this->timer = $this->loop->addPeriodicTimer($this->interval, [ $this, 'handleHeartbeat' ]); | |
| 204 | + $this->timer = $this->loop->addPeriodicTimer($this->interval, [$this, 'handleHeartbeat']); | |
| 205 | 205 | } | 
| 206 | 206 | } | 
| 207 | 207 | } | 
| @@ -228,11 +228,11 @@ discard block | ||
| 228 | 228 | |
| 229 | 229 | $resource = new ShellResource($this, $this->resource); | 
| 230 | 230 |          $resource->on('open', function(SSH2ResourceInterface $resource) { | 
| 231 | -            $this->emit('resource:open', [ $this, $resource ]); | |
| 231 | +            $this->emit('resource:open', [$this, $resource]); | |
| 232 | 232 | }); | 
| 233 | 233 |          $resource->on('close', function(SSH2ResourceInterface $resource) { | 
| 234 | 234 | $this->removeResource($resource->getId()); | 
| 235 | -            $this->emit('resource:close', [ $this, $resource ]); | |
| 235 | +            $this->emit('resource:close', [$this, $resource]); | |
| 236 | 236 | }); | 
| 237 | 237 | |
| 238 | 238 | $this->resources[$resource->getId()] = $resource; | 
| @@ -328,19 +328,19 @@ discard block | ||
| 328 | 328 | |
| 329 | 329 | foreach ($parts as &$part) | 
| 330 | 330 |              { | 
| 331 | -                $resource->emit('data', [ $resource, $part ]); | |
| 331 | +                $resource->emit('data', [$resource, $part]); | |
| 332 | 332 | } | 
| 333 | 333 | unset($parts); | 
| 334 | 334 | unset($part); | 
| 335 | 335 | |
| 336 | 336 | if ($status === 0) | 
| 337 | 337 |              { | 
| 338 | -                $resource->emit('end', [ $resource ]); | |
| 338 | +                $resource->emit('end', [$resource]); | |
| 339 | 339 | $resource->close(); | 
| 340 | 340 | } | 
| 341 | 341 | else if ($status > 0) | 
| 342 | 342 |              { | 
| 343 | -                $resource->emit('error', [ $resource, new ReadException($status) ]); | |
| 343 | +                $resource->emit('error', [$resource, new ReadException($status)]); | |
| 344 | 344 | $resource->close(); | 
| 345 | 345 | } | 
| 346 | 346 | } | 
| @@ -107,17 +107,17 @@ discard block | ||
| 107 | 107 | |
| 108 | 108 | if (!$this->conn || !is_resource($this->conn)) | 
| 109 | 109 |          { | 
| 110 | -            $this->emit('error', [ $this, new ExecutionException('SSH2 connection could not be established.') ]); | |
| 110 | +            $this->emit('error', [$this, new ExecutionException('SSH2 connection could not be established.')]); | |
| 111 | 111 | return; | 
| 112 | 112 | } | 
| 113 | 113 | |
| 114 | 114 | if (!$this->auth->authenticate($this->conn)) | 
| 115 | 115 |          { | 
| 116 | -            $this->emit('error', [ $this, new ExecutionException('SSH2 connection could not be authenticated.') ]); | |
| 116 | +            $this->emit('error', [$this, new ExecutionException('SSH2 connection could not be authenticated.')]); | |
| 117 | 117 | return; | 
| 118 | 118 | } | 
| 119 | 119 | |
| 120 | -        $this->emit('connect', [ $this ]); | |
| 120 | +        $this->emit('connect', [$this]); | |
| 121 | 121 | } | 
| 122 | 122 | |
| 123 | 123 | /** | 
| @@ -138,15 +138,15 @@ discard block | ||
| 138 | 138 | |
| 139 | 139 | foreach ($this->drivers as $driver) | 
| 140 | 140 |          { | 
| 141 | -            $driver->removeListener('connect', [ $this, 'handleConnect' ]); | |
| 142 | -            $driver->removeListener('disconnect', [ $this, 'handleDisconnect' ]); | |
| 143 | -            $driver->removeListener('error', [ $this, 'handleError' ]); | |
| 141 | +            $driver->removeListener('connect', [$this, 'handleConnect']); | |
| 142 | +            $driver->removeListener('disconnect', [$this, 'handleDisconnect']); | |
| 143 | +            $driver->removeListener('error', [$this, 'handleError']); | |
| 144 | 144 | } | 
| 145 | 145 | |
| 146 | 146 | $this->conn = null; | 
| 147 | 147 | $this->drivers = []; | 
| 148 | 148 | |
| 149 | -        $this->emit('disconnect', [ $this ]); | |
| 149 | +        $this->emit('disconnect', [$this]); | |
| 150 | 150 | } | 
| 151 | 151 | |
| 152 | 152 | /** | 
| @@ -188,9 +188,9 @@ discard block | ||
| 188 | 188 |                  throw new InvalidArgumentException("The driver [$name] is not supported."); | 
| 189 | 189 | } | 
| 190 | 190 | |
| 191 | -        $driver->on('connect', [ $this, 'handleConnect' ]); | |
| 192 | -        $driver->on('disconnect', [ $this, 'handleDisconnect' ]); | |
| 193 | -        $driver->on('error', [ $this, 'handleError' ]); | |
| 191 | +        $driver->on('connect', [$this, 'handleConnect']); | |
| 192 | +        $driver->on('disconnect', [$this, 'handleDisconnect']); | |
| 193 | +        $driver->on('error', [$this, 'handleError']); | |
| 194 | 194 | |
| 195 | 195 | $this->drivers[$name] = $driver; | 
| 196 | 196 | |
| @@ -203,7 +203,7 @@ discard block | ||
| 203 | 203 | */ | 
| 204 | 204 | public function handleConnect(SSH2DriverInterface $driver) | 
| 205 | 205 |      { | 
| 206 | -        $this->emit('connect:' . $driver->getName(), [ $driver ]); | |
| 206 | +        $this->emit('connect:' . $driver->getName(), [$driver]); | |
| 207 | 207 | } | 
| 208 | 208 | |
| 209 | 209 | /** | 
| @@ -212,7 +212,7 @@ discard block | ||
| 212 | 212 | */ | 
| 213 | 213 | public function handleDisconnect(SSH2DriverInterface $driver) | 
| 214 | 214 |      { | 
| 215 | -        $this->emit('disconnect:' . $driver->getName(), [ $driver ]); | |
| 215 | +        $this->emit('disconnect:' . $driver->getName(), [$driver]); | |
| 216 | 216 | } | 
| 217 | 217 | |
| 218 | 218 | /** | 
| @@ -222,8 +222,8 @@ discard block | ||
| 222 | 222 | */ | 
| 223 | 223 | public function handleError(SSH2DriverInterface $driver, $ex) | 
| 224 | 224 |      { | 
| 225 | -        $this->emit('error:' . $driver->getName(), [ $driver, $ex ]); | |
| 226 | -        $this->emit('error', [ $this, $ex ]); | |
| 225 | +        $this->emit('error:' . $driver->getName(), [$driver, $ex]); | |
| 226 | +        $this->emit('error', [$this, $ex]); | |
| 227 | 227 | } | 
| 228 | 228 | |
| 229 | 229 | /** |