Code Duplication    Length = 5-5 lines in 3 locations

PHPDaemon/SockJS/Methods/Generic.php 3 locations

@@ 342-346 (lines=5) @@
339
                    }
340
                    $this->appInstance->setnx('sess:' . $this->sessId, $this->attrs->server['REQUEST_URI'],
341
                        function ($redis) use ($cb) {
342
                            if (!$redis || $redis->result === 0) {
343
                                $this->error(3000);
344
                                $cb === null || $cb();
345
                                return;
346
                            }
347
                            $this->appInstance->expire('sess:' . $this->sessId,
348
                                $this->appInstance->config->deadsessiontimeout->value, function ($redis) use ($cb) {
349
                                    if (!$redis || $redis->result === 0) {
@@ 349-353 (lines=5) @@
346
                            }
347
                            $this->appInstance->expire('sess:' . $this->sessId,
348
                                $this->appInstance->config->deadsessiontimeout->value, function ($redis) use ($cb) {
349
                                    if (!$redis || $redis->result === 0) {
350
                                        $this->error(3000);
351
                                        $cb === null || $cb();
352
                                        return;
353
                                    }
354
                                    $this->appInstance->subscribe('state:' . $this->sessId,
355
                                        function ($redis) use ($cb) {
356
                                            if (!$redis) {
@@ 369-373 (lines=5) @@
366
                                            }
367
                                            $this->appInstance->publish('poll:' . $this->sessId,
368
                                                json_encode($this->pollMode), function ($redis) use ($cb) {
369
                                                    if (!$redis || $redis->result === 0) {
370
                                                        $this->error(3000);
371
                                                        $cb === null || $cb();
372
                                                        return;
373
                                                    }
374
                                                    $cb === null || $cb();
375
                                                });
376
                                        }, function ($redis) use ($cb) {