1 | <?php |
||
18 | class AssetManipulationList |
||
19 | { |
||
20 | |||
21 | const STATE_PUBLIC = 'public'; |
||
22 | |||
23 | const STATE_PROTECTED = 'protected'; |
||
24 | |||
25 | const STATE_DELETED = 'deleted'; |
||
26 | |||
27 | /** |
||
28 | * List of public assets |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $public = array(); |
||
33 | |||
34 | /** |
||
35 | * List of protected assets |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $protected = array(); |
||
40 | |||
41 | /** |
||
42 | * List of deleted assets |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $deleted = array(); |
||
47 | |||
48 | /** |
||
49 | * Get an identifying key for a given filename and hash |
||
50 | * |
||
51 | * @param array $asset Asset tuple |
||
52 | * @return string |
||
53 | */ |
||
54 | protected function getAssetKey($asset) |
||
58 | |||
59 | /** |
||
60 | * Add asset with the given state |
||
61 | * |
||
62 | * @param array $asset Asset tuple |
||
63 | * @param string $state One of the STATE_* const vars |
||
64 | * @return bool True if the asset was added to the set matching the given state |
||
65 | */ |
||
66 | public function addAsset($asset, $state) |
||
79 | |||
80 | /** |
||
81 | * Mark a file as public |
||
82 | * |
||
83 | * @param array $asset Asset tuple |
||
84 | * @return bool True if the asset was added to the public set |
||
85 | */ |
||
86 | public function addPublicAsset($asset) |
||
100 | |||
101 | /** |
||
102 | * Record an asset as protected |
||
103 | * |
||
104 | * @param array $asset Asset tuple |
||
105 | * @return bool True if the asset was added to the protected set |
||
106 | */ |
||
107 | public function addProtectedAsset($asset) |
||
123 | |||
124 | /** |
||
125 | * Record an asset as deleted |
||
126 | * |
||
127 | * @param array $asset Asset tuple |
||
128 | * @return bool True if the asset was added to the deleted set |
||
129 | */ |
||
130 | public function addDeletedAsset($asset) |
||
145 | |||
146 | /** |
||
147 | * Get all public assets |
||
148 | * |
||
149 | * @return array |
||
150 | */ |
||
151 | public function getPublicAssets() |
||
155 | |||
156 | /** |
||
157 | * Get protected assets |
||
158 | * |
||
159 | * @return array |
||
160 | */ |
||
161 | public function getProtectedAssets() |
||
165 | |||
166 | /** |
||
167 | * Get deleted assets |
||
168 | * |
||
169 | * @return array |
||
170 | */ |
||
171 | public function getDeletedAssets() |
||
175 | } |
||
176 |