Completed
Pull Request — master (#447)
by Alexandru
01:33
created

RedisChannelManager   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getGlobalConnectionsCount() 0 4 1
1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\WebSockets\Channels\ChannelManagers;
4
5
use BeyondCode\LaravelWebSockets\PubSub\ReplicationInterface;
6
7
class RedisChannelManager extends ArrayChannelManager
8
{
9
    /**
10
     * The replicator driver.
11
     *
12
     * @var \BeyondCode\LaravelWebSockets\PubSub\ReplicationInterface
13
     */
14
    protected $replicator;
15
16
    /**
17
     * Initialize the channel manager.
18
     *
19
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
20
     */
21
    public function __construct()
22
    {
23
        $this->replicator = app(ReplicationInterface::class);
24
    }
25
26
    /**
27
     * Get the connections count across multiple servers.
28
     *
29
     * @param  mixed  $appId
30
     * @return int|\React\Promise\PromiseInterface
31
     */
32
    public function getGlobalConnectionsCount($appId)
33
    {
34
        return $this->replicator->getGlobalConnectionsCount($appId);
35
    }
36
}
37