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

Task::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

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