Passed
Push — master ( 8a0571...9857b7 )
by Aleksei
12:06 queued 21s
created

Task   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 6
c 1
b 0
f 0
dl 0
loc 53
ccs 12
cts 12
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getPayload() 0 3 1
A __construct() 0 7 1
A getId() 0 3 1
A getHeaders() 0 3 1
A getName() 0 3 1
A getQueue() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Queue;
6
7
final class Task implements TaskInterface
8
{
9
    /**
10
     * @param non-empty-string $id Unique identifier of the task in the queue.
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
11
     * @param non-empty-string $queue broker queue name.
12
     * @param non-empty-string $name name of the task/job.
13
     * @param mixed $payload payload of the task/job.
14
     * @param array<non-empty-string, array<string>> $headers headers of the task/job.
15
     */
16 5
    public function __construct(
17
        private readonly string $id,
18
        private readonly string $queue,
19
        private readonly string $name,
20
        private readonly mixed $payload,
21
        private readonly array $headers,
22
    ) {
23 5
    }
24
25 1
    public function getPayload(): mixed
26
    {
27 1
        return $this->payload;
28
    }
29
30
    /**
31
     * @return non-empty-string
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
32
     */
33 1
    public function getName(): string
34
    {
35 1
        return $this->name;
36
    }
37
38
    /**
39
     * @return array<non-empty-string, array<string>>
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<non-empty-string, array<string>> at position 2 could not be parsed: Unknown type name 'non-empty-string' at position 2 in array<non-empty-string, array<string>>.
Loading history...
40
     */
41 1
    public function getHeaders(): array
42
    {
43 1
        return $this->headers;
44
    }
45
46
    /**
47
     * @return non-empty-string
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
48
     */
49 1
    public function getQueue(): string
50
    {
51 1
        return $this->queue;
52
    }
53
54
    /**
55
     * @return non-empty-string
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
56
     */
57 1
    public function getId(): string
58
    {
59 1
        return $this->id;
60
    }
61
}
62