| Total Complexity | 7 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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) |
||
| 86 | ); |
||
| 87 | } |
||
| 88 | } |