BuildAddonsCron::process()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3 View Code Duplication
class BuildAddonsCron implements CronTask
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4
{
5
6
    /**
7
     * Run every 6 hours
8
     *
9
     * @return string
10
     */
11
    public function getSchedule()
12
    {
13
        return "0 */6 * * *";
14
    }
15
16
    /**
17
     * Run the build task BuildAddonsTask
18
     * @return void
19
     */
20
    public function process()
21
    {
22
        $taskClass = BuildAddonsTask::class;
23
        $job = new RunBuildTaskJob($taskClass);
24
        $jobID = Injector::inst()->get(QueuedJobService::class)->queueJob($job);
0 ignored issues
show
Unused Code introduced by
$jobID is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
25
        echo 'Added ' . $taskClass . ' to job queue';
26
    }
27
}
28