FoxyStripePageExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 15
ccs 0
cts 6
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A onAfterInit() 0 10 2
1
<?php
2
3
namespace Dynamic\FoxyStripe\ORM;
4
5
use Dynamic\FoxyStripe\Model\FoxyCart;
6
use Dynamic\FoxyStripe\Model\FoxyStripeSetting;
7
use SilverStripe\Core\Extension;
8
use SilverStripe\View\Requirements;
9
10
class FoxyStripePageExtension extends Extension
11
{
12
    /**
13
     * @throws \SilverStripe\ORM\ValidationException
14
     */
15
    public function onAfterInit()
16
    {
17
        $config = FoxyStripeSetting::current_foxystripe_setting();
18
19
        if ($config->EnableSidecart) {
0 ignored issues
show
Bug Best Practice introduced by
The property EnableSidecart does not exist on Dynamic\FoxyStripe\Model\FoxyStripeSetting. Since you implemented __get, consider adding a @property annotation.
Loading history...
20
            Requirements::javascript(
21
                "https://cdn.foxycart.com/" . FoxyCart::getFoxyCartStoreName() . "/loader.js",
22
                [
23
                    "async" => true,
24
                    "defer" => true,
25
                ]
26
            );
27
        }
28
    }
29
}
30