Passed
Push — master ( 0517dd...df09ce )
by Sergey
01:20 queued 10s
created

Client   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 5
dl 0
loc 42
ccs 0
cts 11
cp 0
rs 10
c 2
b 0
f 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A stream() 0 3 1
A __construct() 0 3 1
A streamGroupConsumer() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This class is work with redis' stream
7
 *
8
 * @author Sergei Karii <[email protected]>
9
 */
10
11
namespace Asiries335\redisSteamPhp;
12
13
final class Client
14
{
15
16
    /**
17
     * Client Redis Interface.
18
     *
19
     * @var ClientRedisStreamPhpInterface
20
     */
21
    private $_client;
22
23
    /**
24
     * Client constructor.
25
     *
26
     * @param ClientRedisStreamPhpInterface $redisClient Client redis interface
27
     */
28
    public function __construct(ClientRedisStreamPhpInterface $redisClient)
29
    {
30
        $this->_client = $redisClient;
31
    }
32
33
    /**
34
     * Work with stream
35
     *
36
     * @param string $streamName Name stream
37
     *
38
     * @return Stream
39
     */
40
    public function stream(string $streamName) : Stream
41
    {
42
        return new Stream($this->_client, $streamName);
43
    }
44
45
    /**
46
     * Work with stream group
47
     *
48
     * @param string $streamName Name stream
49
     *
50
     * @return StreamGroupConsumer
51
     */
52
    public function streamGroupConsumer(string $streamName) : StreamGroupConsumer
53
    {
54
        return new StreamGroupConsumer($this->_client, $streamName);
55
    }
56
}