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
Push — master ( 897149...84a0fb )
by Robbie
01:45 queued 10s
created

QueuedJobHandler::getJobDescriptor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Symbiote\QueuedJobs\Services;
4
5
use Monolog\Handler\AbstractProcessingHandler;
6
use SilverStripe\Core\Injector\Injectable;
7
use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor;
8
9
/**
10
 * Writes log output to a job descriptor
11
 */
12
class QueuedJobHandler extends AbstractProcessingHandler
13
{
14
    use Injectable;
15
16
    /** @var QueuedJob */
17
    protected $job;
18
19
    /** @var QueuedJobDescriptor */
20
    protected $jobDescriptor;
21
22
    public function __construct(QueuedJob $job, QueuedJobDescriptor $jobDescriptor)
23
    {
24
        parent::__construct();
25
26
        $this->job = $job;
27
        $this->jobDescriptor = $jobDescriptor;
28
    }
29
30
    /**
31
     * @return QueuedJob
32
     */
33
    public function getJob()
34
    {
35
        return $this->job;
36
    }
37
38
    /**
39
     * @return QueuedJobDescriptor
40
     */
41
    public function getJobDescriptor()
42
    {
43
        return $this->jobDescriptor;
44
    }
45
46
    /**
47
     * Writes the record down to the log of the implementing handler
48
     *
49
     * @param  array $record
50
     * @return void
51
     */
52
    protected function write(array $record)
53
    {
54
        $this->handleBatch([$record]);
55
    }
56
57
    public function handleBatch(array $records)
58
    {
59
        foreach ($records as $record) {
60
            $this->job->addMessage($record['message']);
61
        };
62
        $this->jobDescriptor->SavedJobMessages = serialize($this->job->getJobData()->messages);
63
64
        $this->jobDescriptor->write();
65
    }
66
}
67