OrderStep_QuickDispatch::nextStep()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
4
5
class OrderStep_QuickDispatch extends OrderStep_Sent implements OrderStepInterface
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
    private static $defaults = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $defaults is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
8
        'CustomerCanEdit' => 0,
9
        'CustomerCanPay' => 0,
10
        'CustomerCanCancel' => 0,
11
        'Name' => 'Dispatch',
12
        'Code' => 'QUICK_DISPATCH',
13
        'ShowAsInProcessOrder' => 1,
14
    );
15
16
17
    /**
18
     * Can run this step once any items have been submitted.
19
     * makes sure the step is ready to run.... (e.g. check if the order is ready to be emailed as receipt).
20
     * should be able to run this function many times to check if the step is ready.
21
     *
22
     * @see Order::doNextStatus
23
     *
24
     * @param Order object
25
     *
26
     * @return bool - true if the current step is ready to be run...
27
     **/
28
    public function initStep(Order $order)
29
    {
30
        return parent::initStep($order);
31
    }
32
33
    /**
34
     * Add a member to the order - in case he / she is not a shop admin.
35
     *
36
     * @param Order object
37
     *
38
     * @return bool - true if run correctly.
0 ignored issues
show
Documentation introduced by
Should the return type not be boolean|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
39
     **/
40
    public function doStep(Order $order)
41
    {
42
        if ($order->HasBeenDispatched) {
43
            if (! $this->RelevantLogEntry($order)) {
44
                $log = OrderStatusLog_DispatchPhysicalOrder::create();
45
                $log->OrderID = $order->ID;
46
                $log->write();
47
            }
48
        }
49
        return parent::doStep($order);
50
    }
51
52
    /**
53
     * go to next step if order has been submitted.
54
     *
55
     * @param Order $order
56
     *
57
     * @return OrderStep | Null	(next step OrderStep)
0 ignored issues
show
Documentation introduced by
Should the return type not be OrderStep|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
58
     **/
59
    public function nextStep(Order $order)
60
    {
61
        return parent::nextStep($order);
62
    }
63
64
65
    /**
66
     * Explains the current order step.
67
     *
68
     * @return string
69
     */
70
    protected function myDescription()
71
    {
72
        return _t('OrderStep.QUICKDISPATCH_DESCRIPTION', 'The order is on its way to the customer.');
73
    }
74
}
75