HelloJob::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace JCIT\jobqueue\jobs;
5
6
use JCIT\jobqueue\interfaces\JobInterface;
7
8
class HelloJob implements JobInterface
9
{
10 8
    public function __construct(
11
        private string $name
12
    ) {
13 8
    }
14
15 3
    public static function fromArray(array $config): self
16
    {
17 3
        return new static($config['name']);
18
    }
19
20 5
    public function getName(): string
21
    {
22 5
        return $this->name;
23
    }
24
25 3
    public function jsonSerialize(): array
26
    {
27
        return [
28 3
            'name' => $this->name,
29
        ];
30
    }
31
}
32