Passed
Push — master ( 6262ca...fbd7eb )
by Vladislav
02:01
created

WebSocketArgument::setReqId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
namespace Carpenstar\ByBitAPI\WebSockets\Objects\WebSockets;
3
4
use Carpenstar\ByBitAPI\WebSockets\Interfaces\IWebSocketArgumentInterface;
5
6
abstract class WebSocketArgument implements IWebSocketArgumentInterface
7
{
8
    protected ?string $reqId;
9
10
    protected array $symbols;
11
12
    public function __construct(string $symbol, ?string $reqId = null)
13
    {
14
        $this
15
            ->setSymbols($symbol)
16
            ->setReqId($reqId);
17
    }
18
19
    abstract public function getOperation(): string;
20
21
    /**
22
     * @param string|null $reqId
23
     * @return self
24
     */
25
    protected function setReqId(?string $reqId): self
26
    {
27
        $this->reqId = $reqId;
28
        return $this;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getReqId(): string
35
    {
36
        return $this->reqId;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->reqId could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
37
    }
38
39
    /**
40
     * @param string $symbol
41
     * @return self
42
     */
43
    protected function setSymbols(string $symbol): self
44
    {
45
        $this->symbols = explode(',', $symbol);
46
        return $this;
47
    }
48
49
    /**
50
     * @return string
51
     */
52
    public function getSymbols(): array
53
    {
54
        return $this->symbols;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->symbols returns the type array which is incompatible with the documented return type string.
Loading history...
55
    }
56
}