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.

WorkflowPublishTargetJob::getTitle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Symbiote\AdvancedWorkflow\Jobs;
4
5
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
6
7
// Prevent failure if queuedjobs module isn't installed.
8
if (!class_exists(AbstractQueuedJob::class)) {
9
    return;
10
}
11
12
/**
13
 * A queued job that publishes a target after a delay.
14
 *
15
 * @package advancedworkflow
16
 */
17
class WorkflowPublishTargetJob extends AbstractQueuedJob
18
{
19
    public function __construct($obj = null, $type = null)
20
    {
21
        if ($obj) {
22
            $this->setObject($obj);
23
            $this->publishType = $type ? strtolower($type) : 'publish';
24
            $this->totalSteps = 1;
25
        }
26
    }
27
28
    public function getTitle()
29
    {
30
        return _t(
31
            'AdvancedWorkflowPublishJob.SCHEDULEJOBTITLE',
32
            "Scheduled {type} of {object}",
33
            "",
34
            array(
35
                'type' => $this->publishType,
36
                'object' => $this->getObject()->Title
37
            )
38
        );
39
    }
40
41
    public function process()
42
    {
43
        if ($target = $this->getObject()) {
44
            if ($this->publishType == 'publish') {
45
                $target->setIsPublishJobRunning(true);
46
                $target->PublishOnDate = '';
47
                $target->writeWithoutVersion();
48
                $target->publishRecursive();
49
            } elseif ($this->publishType == 'unpublish') {
50
                $target->setIsPublishJobRunning(true);
51
                $target->UnPublishOnDate = '';
52
                $target->writeWithoutVersion();
53
                $target->doUnpublish();
54
            }
55
        }
56
        $this->currentStep = 1;
57
        $this->isComplete = true;
58
    }
59
}
60