Code Duplication    Length = 4-5 lines in 2 locations

lib/Util/RedisUtil.php 2 locations

@@ 73-77 (lines=5) @@
70
     */
71
    public function setupRedisInstance() {
72
        try {
73
        if (!extension_loaded('redis')) {
74
            $this->logger->debug(
75
                    'It seems that the message queueing capabilities are not available in your local php installation. Please install php-redis.', ['app' => OcrConstants::APP_NAME]);
76
            throw new NotFoundException($this->l10n->t('Message queueing capabilities are missing on the server (package php-redis).'));
77
        }
78
        $redis = new \Redis();
79
        if (!$redis->connect($this->config->getAppValue($this->appName, 'redisHost'), 
80
                intval($this->config->getAppValue($this->appName, 'redisPort')), 2.5, null, 100)) {
@@ 88-91 (lines=4) @@
85
        if($password !== '') {
86
            $authenticated = $redis->auth($password);
87
        }
88
        if ($password !== '' && !$authenticated) {
89
            $this->logger->debug('Redis authentication error.', ['app' => OcrConstants::APP_NAME]);
90
            throw new NotFoundException($this->l10n->t('Redis authentication error.'));
91
        }
92
        if (!$redis->select(intval($this->config->getAppValue($this->appName, 'redisDb')))) {
93
            throw new NotFoundException($this->l10n->t('Cannot connect to the right Redis database.'));
94
        }