ElectronicDownloadProductCleanUp   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 12 3
1
<?php
2
3
4
5
class ElectronicDownloadProductCleanUp extends BuildTask
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
{
7
    protected $title = "Remove expired downloads from the download folder.";
8
9
    protected $description = "Removes all the expired downloads from the download folder.";
10
11
    public function run($request)
12
    {
13
        $items = ElectronicDelivery_OrderLog::get()->filter(array("Completed" => 0));
14
        foreach ($items as $item) {
15
            if ($item->IsExpired()) {
16
                //a simple write will take care of all the deletion process...
17
                $item->deleteFolderIfExpired();
18
            } else {
0 ignored issues
show
Unused Code introduced by
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
19
                //do nothing
20
            }
21
        }
22
    }
23
}
24