Code Duplication    Length = 8-8 lines in 5 locations

src/RealTimeClient.php 5 locations

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