CheckExternalLinksJob::getJobType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\ExternalLinks\Jobs;
4
5
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
0 ignored issues
show
Bug introduced by
The type Symbiote\QueuedJobs\Services\AbstractQueuedJob was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symbiote\QueuedJobs\Services\QueuedJob;
0 ignored issues
show
Bug introduced by
The type Symbiote\QueuedJobs\Services\QueuedJob was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use SilverStripe\ExternalLinks\Tasks\CheckExternalLinksTask;
8
9
if (!class_exists(AbstractQueuedJob::class)) {
10
    return;
11
}
12
13
/**
14
 * A Job for running a external link check for published pages
15
 *
16
 */
17
class CheckExternalLinksJob extends AbstractQueuedJob implements QueuedJob
18
{
19
20
    public function getTitle()
21
    {
22
        return _t(__CLASS__ . '.TITLE', 'Checking for external broken links');
23
    }
24
25
    public function getJobType()
26
    {
27
        return QueuedJob::QUEUED;
28
    }
29
30
    public function getSignature()
31
    {
32
        return md5(get_class($this));
33
    }
34
35
    /**
36
     * Check an individual page
37
     */
38
    public function process()
39
    {
40
        $task = CheckExternalLinksTask::create();
41
        $track = $task->runLinksCheck(1);
42
        $this->currentStep = $track->CompletedPages;
0 ignored issues
show
Bug Best Practice introduced by
The property currentStep does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
43
        $this->totalSteps = $track->TotalPages;
0 ignored issues
show
Bug Best Practice introduced by
The property totalSteps does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
44
        $this->isComplete = $track->Status === 'Completed';
0 ignored issues
show
Bug Best Practice introduced by
The property isComplete does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
45
    }
46
}
47