1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* JBZoo Assets |
4
|
|
|
* |
5
|
|
|
* This file is part of the JBZoo CCK package. |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
* |
9
|
|
|
* @package Assets |
10
|
|
|
* @license MIT |
11
|
|
|
* @copyright Copyright (C) JBZoo.com, All rights reserved. |
12
|
|
|
* @link https://github.com/JBZoo/Assets |
13
|
|
|
* @author Sergey Kalistratov <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace JBZoo\Assets\Asset; |
17
|
|
|
|
18
|
|
|
use JBZoo\Data\Data; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class Asset |
22
|
|
|
* @package JBZoo\Assets\Asset |
23
|
|
|
*/ |
24
|
|
|
abstract class Asset |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $_name; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $_source; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var array |
38
|
|
|
*/ |
39
|
|
|
protected $_dependencies = []; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var array |
43
|
|
|
*/ |
44
|
|
|
protected $_options = []; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
protected $_root; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var Data |
53
|
|
|
*/ |
54
|
|
|
protected $_params; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* AssetAbstract constructor. |
58
|
|
|
* |
59
|
|
|
* @param string $root |
60
|
|
|
* @param Data $params |
61
|
|
|
* @param string $name |
62
|
|
|
* @param string $source |
63
|
|
|
* @param string|array $dependencies |
64
|
|
|
* @param string|array $options |
65
|
|
|
*/ |
66
|
|
|
public function __construct($root, Data $params, $name, $source, $dependencies = [], $options = []) |
67
|
|
|
{ |
68
|
|
|
$this->_name = $name; |
69
|
|
|
$this->_root = $root; |
70
|
|
|
$this->_source = $source; |
71
|
|
|
$this->_params = $params; |
72
|
|
|
$this->_options = (array)$options; |
73
|
|
|
$this->_dependencies = (array)$dependencies; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return Data |
78
|
|
|
*/ |
79
|
|
|
public function getParams() |
80
|
|
|
{ |
81
|
|
|
return $this->_params; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Gets the name. |
86
|
|
|
* |
87
|
|
|
* @return string |
88
|
|
|
*/ |
89
|
|
|
public function getName() |
90
|
|
|
{ |
91
|
|
|
return $this->_name; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Gets the dependencies. |
96
|
|
|
* |
97
|
|
|
* @return array |
98
|
|
|
*/ |
99
|
|
|
public function getDependencies() |
100
|
|
|
{ |
101
|
|
|
return $this->_dependencies; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Gets the source. |
106
|
|
|
* |
107
|
|
|
* @return string |
108
|
|
|
*/ |
109
|
|
|
public function getSource() |
110
|
|
|
{ |
111
|
|
|
return $this->_source; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Gets the type. |
116
|
|
|
* |
117
|
|
|
* @return array |
118
|
|
|
*/ |
119
|
|
|
public function getOptions() |
120
|
|
|
{ |
121
|
|
|
return $this->_options; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @param array $filters |
126
|
|
|
* @return mixed |
127
|
|
|
*/ |
128
|
|
|
abstract public function load(array $filters = []); |
129
|
|
|
} |
130
|
|
|
|