GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#290)
by
unknown
01:34
created

Job   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 45
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A hydrate() 0 6 1
A getTitle() 0 4 1
A getJobType() 0 4 1
A getRunAsMemberID() 0 4 1
A processItem() 0 5 1
1
<?php
2
3
namespace App\Queue\Dev;
4
5
use App\Queue;
6
use SilverStripe\ORM\FieldType\DBDatetime;
7
use Symbiote\QueuedJobs\Services\QueuedJob;
8
9
/**
10
 * Class Job
11
 *
12
 * This is a test job which is intended to be used for testing the queue runner
13
 * the job runs multiple steps and eventually completes
14
 *
15
 * @property int $randomID
16
 * @package App\Queue\Dev
17
 */
18
class Job extends Queue\Job
19
{
20
21
    /**
22
     * @var string|null
23
     */
24
    private $type = QueuedJob::QUEUED;
25
26
    public function hydrate(int $type, int $randomID): void
27
    {
28
        $this->type = $type;
0 ignored issues
show
Documentation Bug introduced by
It seems like $type of type integer is incompatible with the declared type string|null of property $type.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
29
        $this->randomID = $randomID;
30
        $this->items = [1, 2, 3, 4, 5];
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    public function getTitle(): string
37
    {
38
        return 'Test job';
39
    }
40
41
    /**
42
     * @return int|null
43
     */
44
    public function getJobType(): int
45
    {
46
        return (int) $this->type;
47
    }
48
49
    public function getRunAsMemberID(): ?int
50
    {
51
        return 0;
52
    }
53
54
    /**
55
     * @param mixed $item
56
     */
57
    public function processItem($item): void
58
    {
59
        $this->addMessage(sprintf('Step %d at %s', $item, DBDatetime::now()->Rfc2822()));
60
        sleep(1);
61
    }
62
}
63