OrderModifierForm   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A redirect() 0 6 2
1
<?php
2
3
namespace SilverShop\Forms;
4
5
use SilverShop\Page\CheckoutPage;
6
use SilverStripe\Control\Controller;
7
use SilverStripe\Control\Director;
8
use SilverStripe\Forms\Form;
9
10
/**
11
 * Base class for modifier forms.
12
 * Provides a redirect back to the checkout page.
13
 *
14
 * @see OrderModifier
15
 *
16
 * @package    shop
17
 * @subpackage forms
18
 */
19
class OrderModifierForm extends Form
20
{
21
    public function redirect($status = 'success', $message = '')
0 ignored issues
show
Unused Code introduced by
The parameter $message is not used and could be removed. ( Ignorable by Annotation )

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

21
    public function redirect($status = 'success', /** @scrutinizer ignore-unused */ $message = '')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23
        if (Director::is_ajax()) {
24
            return $status; //TODO: allow for custom return types, eg json - similar to ShoppingCart::return_data()
25
        }
26
        Controller::curr()->redirect(CheckoutPage::find_link());
27
    }
28
}
29