Passed
Pull Request — master (#668)
by butschster
20:19
created

AuthorizationStatus   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 73.32%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 42
ccs 11
cts 15
cp 0.7332
rs 10
c 1
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getTopics() 0 3 1
A getResponse() 0 3 1
A hasResponse() 0 3 1
A __construct() 0 10 1
A getAttributes() 0 3 1
A isSuccessful() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Broadcasting;
6
7
use Psr\Http\Message\ResponseInterface;
8
9
final class AuthorizationStatus
10
{
11
    private bool $success;
12
    private array $topics;
13
    private array $attributes;
14
    private ?ResponseInterface $response;
15
16 3
    public function __construct(
17
        bool $success,
18
        array $topics,
19
        array $attributes = [],
20
        ?ResponseInterface $response = null
21
    ) {
22 3
        $this->success = $success;
23 3
        $this->topics = $topics;
24 3
        $this->attributes = $attributes;
25 3
        $this->response = $response;
26
    }
27
28 2
    public function isSuccessful(): bool
29
    {
30 2
        return $this->success;
31
    }
32
33
    public function getTopics(): array
34
    {
35
        return $this->topics;
36
    }
37
38
    public function getAttributes(): array
39
    {
40
        return $this->attributes;
41
    }
42
43 3
    public function hasResponse(): bool
44
    {
45 3
        return $this->response !== null;
46
    }
47
48 1
    public function getResponse(): ?ResponseInterface
49
    {
50 1
        return $this->response;
51
    }
52
}
53