Code Duplication    Length = 8-8 lines in 5 locations

src/RealTimeClient.php 5 locations

@@ 177-184 (lines=8) @@
174
    /**
175
     * {@inheritDoc}
176
     */
177
    public function getChannels()
178
    {
179
        if (!$this->connected) {
180
            return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?'));
181
        }
182
183
        return Promise\resolve(array_values($this->channels));
184
    }
185
186
    /**
187
     * {@inheritDoc}
@@ 205-212 (lines=8) @@
202
    /**
203
     * {@inheritDoc}
204
     */
205
    public function getGroups()
206
    {
207
        if (!$this->connected) {
208
            return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?'));
209
        }
210
211
        return Promise\resolve(array_values($this->groups));
212
    }
213
214
    /**
215
     * {@inheritDoc}
@@ 233-240 (lines=8) @@
230
    /**
231
     * {@inheritDoc}
232
     */
233
    public function getDMs()
234
    {
235
        if (!$this->connected) {
236
            return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?'));
237
        }
238
239
        return Promise\resolve(array_values($this->dms));
240
    }
241
242
    /**
243
     * {@inheritDoc}
@@ 261-268 (lines=8) @@
258
    /**
259
     * {@inheritDoc}
260
     */
261
    public function getUsers()
262
    {
263
        if (!$this->connected) {
264
            return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?'));
265
        }
266
267
        return Promise\resolve(array_values($this->users));
268
    }
269
270
    /**
271
     * {@inheritDoc}
@@ 291-298 (lines=8) @@
288
     *
289
     * @return \React\Promise\PromiseInterface A promise for an array of bots.
290
     */
291
    public function getBots()
292
    {
293
        if (!$this->connected) {
294
            return Promise\reject(new ConnectionException('Client not connected. Did you forget to call `connect()`?'));
295
        }
296
297
        return Promise\resolve(array_values($this->bots));
298
    }
299
300
    /**
301
     * Gets a bot by its ID.