BootstrapAsset::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 1
1
<?php
2
3
namespace App\Assets;
4
5
use Micro\Base\KernelInjector;
6
use Micro\Mvc\Views\IView;
7
use Micro\Web\Asset;
8
9
/**
10
 * Class BootstrapAsset
11
 * @package App\Assets
12
 */
13
class BootstrapAsset extends Asset
14
{
15
    public static $name = 'Bootstrap';
16
    public static $version = '3.3.6';
17
18
    /**
19
     * @param IView $view
20
     * @throws \Micro\Base\Exception
21
     */
22
    public function __construct(IView $view)
23
    {
24
        if ((new KernelInjector())->build()->isDebug()) {
25
            $this->js[] = '/js/bootstrap.js';
26
            $this->css[] = '/css/bootstrap.css';
27
        } else {
28
            $this->js[] = '/js/bootstrap.min.js';
29
            $this->css[] = '/css/bootstrap.min.css';
30
        }
31
32
        $this->sourcePath = (new KernelInjector)->build()->getAppDir() . '/../vendor/twbs/bootstrap/dist';
33
34
        parent::__construct($view);
35
    }
36
}
37