AssetCollection   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 69
rs 10
c 0
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setFrontendAssets() 0 9 2
A setBackendAssets() 0 9 2
A __construct() 0 3 1
A getBackendAssets() 0 3 1
A getFrontendAssets() 0 3 1
1
<?php
2
/**
3
 * Copyright (c) 2017
4
 *
5
 * @package   Majima
6
 * @author    David Neustadt <[email protected]>
7
 * @copyright 2017 David Neustadt
8
 * @license   MIT
9
 */
10
11
namespace Majima\PluginBundle\Components;
12
13
/**
14
 * Class AssetCollection
15
 * @package Majima\PluginBundle\Components
16
 */
17
class AssetCollection
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $pluginPath;
23
24
    /**
25
     * @var array
26
     */
27
    private $backendAssets = [];
28
29
    /**
30
     * @var array
31
     */
32
    private $frontendAssets = [];
33
34
    /**
35
     * AssetCollection constructor.
36
     * @param $pluginPath
37
     */
38
    public function __construct($pluginPath = null)
39
    {
40
        $this->pluginPath = $pluginPath;
41
    }
42
43
    /**
44
     * @return array
45
     */
46
    public function getBackendAssets()
47
    {
48
        return $this->backendAssets;
49
    }
50
51
    /**
52
     * @param array $backendAssets
53
     */
54
    public function setBackendAssets($backendAssets)
55
    {
56
        foreach ($backendAssets as &$backendAsset) {
57
            $backendAsset = $this->pluginPath . DIRECTORY_SEPARATOR . $backendAsset;
58
        }
59
60
        $this->backendAssets = array_merge(
61
            $this->getBackendAssets(),
62
            $backendAssets
63
        );
64
    }
65
66
    /**
67
     * @return array
68
     */
69
    public function getFrontendAssets()
70
    {
71
        return $this->frontendAssets;
72
    }
73
74
    /**
75
     * @param array $frontendAssets
76
     */
77
    public function setFrontendAssets($frontendAssets)
78
    {
79
        foreach ($frontendAssets as &$frontendAsset) {
80
            $frontendAsset = $this->pluginPath . DIRECTORY_SEPARATOR . $frontendAsset;
81
        }
82
83
        $this->frontendAssets = array_merge(
84
            $this->getFrontendAssets(),
85
            $frontendAssets
86
        );
87
    }
88
}