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

Client::streamGroupConsumer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
}