SinglePageCheckoutComponentConfig   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 4
1
<?php
2
3
namespace SilverShop\Checkout;
4
5
use SilverShop\Checkout\Component\BillingAddress;
6
use SilverShop\Checkout\Component\CustomerDetails;
7
use SilverShop\Checkout\Component\Membership;
8
use SilverShop\Checkout\Component\Notes;
9
use SilverShop\Checkout\Component\Payment;
10
use SilverShop\Checkout\Component\ShippingAddress;
11
use SilverShop\Checkout\Component\Terms;
12
use SilverShop\Model\Order;
13
use SilverStripe\Omnipay\GatewayInfo;
14
use SilverStripe\Security\Security;
15
16
class SinglePageCheckoutComponentConfig extends CheckoutComponentConfig
17
{
18
    public function __construct(Order $order)
19
    {
20
        parent::__construct($order);
21
        $this->addComponent(CustomerDetails::create());
22
        $this->addComponent(ShippingAddress::create());
23
        $this->addComponent(BillingAddress::create());
24
        if (Checkout::member_creation_enabled() && !Security::getCurrentUser()) {
25
            $this->addComponent(Membership::create());
26
        }
27
        if (count(GatewayInfo::getSupportedGateways()) > 1) {
28
            $this->addComponent(Payment::create());
29
        }
30
        $this->addComponent(Notes::create());
31
        $this->addComponent(Terms::create());
32
    }
33
}
34