Issues (146)

src/Job/StaticSiteRewriteLinksJob.php (5 issues)

1
<?php
2
3
namespace PhpTek\Exodus\Job;
4
5
use PhpTek\Exodus\Task\StaticSiteRewriteLinksTask;
6
use SilverStripe\Core\Injector\Injectable;
7
use Symbiote\QueuedJobs\Jobs\AbstractQueuedJob;
0 ignored issues
show
The type Symbiote\QueuedJobs\Jobs\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...
8
use Symbiote\QueuedJobs\Jobs\QueuedJob;
0 ignored issues
show
The type Symbiote\QueuedJobs\Jobs\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...
9
10
/**
11
 *
12
 * A Queued jobs wrapper for StaticSiteRewriteLinksTask.
13
 *
14
 * @package phptek/silverstripe-exodus
15
 * @author Sam Minee <[email protected]>
16
 * @author Russell Michell <[email protected]>
17
 */
18
19
if (!class_exists(AbstractQueuedJob::class)) {
20
    return;
21
}
22
23
class StaticSiteRewriteLinksJob extends AbstractQueuedJob implements QueuedJob
24
{
25
    use Injectable;
26
27
    /**
28
     * The ID number of the StaticSiteContentSource which has the links to be rewritten
29
     *
30
     * @var int
31
     */
32
    protected $contentSourceID;
33
34
    /**
35
     *
36
     * Sets the content source id
37
     *
38
     * @param number $contentSourceID
39
     */
40
    public function __construct($contentSourceID = null)
41
    {
42
        if ($contentSourceID) {
43
            $this->contentSourceID = $contentSourceID;
44
        }
45
    }
46
47
    /**
48
     *
49
     * @return string
50
     */
51
    public function getJobType()
52
    {
53
        $this->totalSteps = 1;
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...
54
        return QueuedJob::QUEUED;
55
    }
56
57
    /**
58
     * Starts the rewrite links task
59
     *
60
     * @return void
61
     */
62
    public function process()
63
    {
64
        $task = singleton(StaticSiteRewriteLinksTask::class);
65
        $task->setContentSourceID($this->contentSourceID);
66
        $task->process();
67
        $this->currentStep = 1;
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...
68
        $this->isComplete = true;
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...
69
    }
70
}
71