Code Duplication    Length = 5-7 lines in 2 locations

src/Utilities/BotState.php 1 location

@@ 115-119 (lines=5) @@
112
            throw new BotException('Redis connection not set');
113
        }
114
115
        if ($this->redis->exists($this->_chat_id . ':status')) {
116
            $this->status = $this->redis->get($this->_chat_id . ':status');
117
118
            return $this->status;
119
        }
120
121
        $this->redis->set($this->_chat_id . ':status', $default_status);
122
        $this->status = $default_status;

src/Localization/Language.php 1 location

@@ 135-141 (lines=7) @@
132
        }
133
134
        // Check if the language exists on Redis
135
        if ($this->redis->exists($this->_chat_id . ':language')) {
136
            $this->language = $this->redis->get($this->_chat_id . ':language');
137
            return $this->language;
138
        }
139
140
        // Set the value from the database
141
        $this->redis->setEx(
142
            $this->_chat_id . ':language',
143
            $expiring_time,
144
            $this->getLanguageDatabase($default_language)