Passed
Pull Request — master (#9)
by Sergey
03:51
created

Client   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A stream() 0 3 1
A streamGroupConsumer() 0 3 1
A __construct() 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 2
    public function __construct(ClientRedisStreamPhpInterface $redisClient)
29
    {
30 2
        $this->_client = $redisClient;
31 2
    }
32
33
    /**
34
     * Work with stream
35
     *
36
     * @param string $streamName Name stream
37
     *
38
     * @return Stream
39
     */
40 1
    public function stream(string $streamName) : Stream
41
    {
42 1
        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 1
    public function streamGroupConsumer(string $streamName) : StreamGroupConsumer
53
    {
54 1
        return new StreamGroupConsumer($this->_client, $streamName);
55
    }
56
}