Passed
Pull Request — master (#70)
by Andrew
05:24
created

Job   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setup() 0 4 1
A getSignature() 0 3 1
1
<?php
2
3
namespace SilverStripe\StaticPublishQueue;
4
5
use SilverStripe\Core\Config\Configurable;
6
use SilverStripe\Core\Extensible;
7
use SilverStripe\ORM\DataObject;
8
use SilverStripe\StaticPublishQueue\Contract\StaticallyPublishable;
9
use SilverStripe\StaticPublishQueue\Extension\Publishable\PublishableSiteTree;
10
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
11
12
abstract class Job extends AbstractQueuedJob
13
{
14
    use Configurable;
15
    use Extensible;
16
17
    /**
18
     * @var int
19
     * @config
20
     */
21
    private static $chunk_size = 200;
0 ignored issues
show
introduced by
The private property $chunk_size is not used, and could be removed.
Loading history...
22
23
    public function setup()
24
    {
25
        parent::setup();
26
        $this->totalSteps = ceil(count($this->URLsToProcess) / self::config()->get('chunk_size'));
0 ignored issues
show
Bug Best Practice introduced by
The property URLsToProcess does not exist on SilverStripe\StaticPublishQueue\Job. Since you implemented __get, consider adding a @property annotation.
Loading history...
27
    }
28
29
    public function getSignature()
30
    {
31
        return md5(implode('-', [static::class, implode('-', array_keys($this->URLsToProcess))]));
0 ignored issues
show
Bug Best Practice introduced by
The property URLsToProcess does not exist on SilverStripe\StaticPublishQueue\Job. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
It seems like $this->URLsToProcess can also be of type null; however, parameter $input of array_keys() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

31
        return md5(implode('-', [static::class, implode('-', array_keys(/** @scrutinizer ignore-type */ $this->URLsToProcess))]));
Loading history...
32
    }
33
}
34