1 | <?php |
||
12 | abstract class Filter implements FilterInterface |
||
13 | { |
||
14 | /** |
||
15 | * Filter's name |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $name; |
||
20 | |||
21 | /** |
||
22 | * Filter's configuration |
||
23 | * |
||
24 | * @var ConfigurationInterface |
||
25 | */ |
||
26 | protected $configuration; |
||
27 | |||
28 | /** |
||
29 | * Notification dispatcher |
||
30 | * |
||
31 | * @var EventDispatcherInterface |
||
32 | */ |
||
33 | protected $eventDispatcher; |
||
34 | |||
35 | /** |
||
36 | * Apply a filter to a list of source files |
||
37 | * |
||
38 | * @param SplFileInfo[] $files |
||
39 | * @param SplFileInfo[] $destinations |
||
40 | * @return SplFileInfo[] |
||
41 | */ |
||
42 | abstract public function run(array $files, array $destinations); |
||
43 | |||
44 | /** |
||
45 | * Filter constructor. |
||
46 | * |
||
47 | * @param string $name |
||
48 | * @param ConfigurationInterface $configuration |
||
49 | * @param EventDispatcherInterface $eventDispatcher |
||
50 | */ |
||
51 | public function __construct( |
||
60 | |||
61 | /** |
||
62 | * Use this method to check your filter requirements (for example, if the library required by this filter are |
||
63 | * installed). |
||
64 | */ |
||
65 | public function checkRequirements() |
||
68 | |||
69 | /** |
||
70 | * Remove the assets cache directory. |
||
71 | */ |
||
72 | public function clean() |
||
80 | |||
81 | /** |
||
82 | * Return the assets cache dir. |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | public function getCacheDir() |
||
97 | |||
98 | /** |
||
99 | * @return string |
||
100 | */ |
||
101 | public function getName() |
||
105 | |||
106 | /** |
||
107 | * Return files matching $pattern in filters cache directory. |
||
108 | * |
||
109 | * @param string $pattern |
||
110 | * @return Finder|SplFileInfo[] |
||
111 | */ |
||
112 | protected function findFilesInCacheDir($pattern) |
||
120 | |||
121 | /** |
||
122 | * Add a notification to the subscriber. |
||
123 | * |
||
124 | * @param $message |
||
125 | */ |
||
126 | protected function addNotification($message) |
||
135 | } |
||
136 |