Completed
Push — master ( c4988a...0570a2 )
by Maxim
02:35
created

AbstractAsset   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getAssetsBefore() 0 3 1
A getHash() 0 3 1
A addAssetAfter() 0 3 1
A addAssetBefore() 0 3 1
A getAssetsAfter() 0 3 1
1
<?php
2
3
namespace WebComplete\mvc\assets;
4
5
abstract class AbstractAsset
6
{
7
8
    public $useLinks = true;
9
10
    public $publish = true;
11
12
    /** @var AbstractAsset[] */
13
    protected $assetsBefore = [];
14
15
    /** @var AbstractAsset[] */
16
    protected $assetsAfter = [];
17
18
    /**
19
     * @return string
20
     */
21
    abstract public function getBasePath(): string;
22
23
    /**
24
     * @return array
25
     */
26
    abstract public function css(): array;
27
28
    /**
29
     * @return array
30
     */
31
    abstract public function js(): array;
32
33
    /**
34
     * @return string
35
     */
36
    public function getHash(): string
37
    {
38
        return \md5(static::class);
39
    }
40
41
    /**
42
     * @return array
43
     */
44
    public function getAssetsBefore(): array
45
    {
46
        return $this->assetsBefore;
47
    }
48
49
    /**
50
     * @return array
51
     */
52
    public function getAssetsAfter(): array
53
    {
54
        return $this->assetsAfter;
55
    }
56
57
    /**
58
     * @param AbstractAsset $asset
59
     */
60
    public function addAssetBefore(AbstractAsset $asset)
61
    {
62
        $this->assetsBefore[\get_class($asset)] = $asset;
63
    }
64
65
    /**
66
     * @param AbstractAsset $asset
67
     */
68
    public function addAssetAfter(AbstractAsset $asset)
69
    {
70
        $this->assetsAfter[\get_class($asset)] = $asset;
71
    }
72
}
73