1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | |||
3 | namespace SilverStripe\ExternalLinks\Jobs; |
||
4 | |||
5 | use Symbiote\QueuedJobs\Services\AbstractQueuedJob; |
||
0 ignored issues
–
show
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. 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
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. 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
|
|||
43 | $this->totalSteps = $track->TotalPages; |
||
0 ignored issues
–
show
|
|||
44 | $this->isComplete = $track->Status === 'Completed'; |
||
0 ignored issues
–
show
|
|||
45 | } |
||
46 | } |
||
47 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.