1 | <?php |
||
13 | class Purger { |
||
14 | |||
15 | |||
16 | /** |
||
17 | * @var $cssBlocks |
||
18 | * A hash table of css DeclarationBlock objects |
||
19 | */ |
||
20 | private $cssBlocks; |
||
21 | |||
22 | |||
23 | |||
24 | public function __construct(BlockHashTable $hashTable) { |
||
28 | |||
29 | |||
30 | |||
31 | /** |
||
32 | * Compares the CSS selectors against those found in the Crawler object |
||
33 | * |
||
34 | * @param PurgeHtmlCrawler $dom |
||
35 | */ |
||
36 | public function purge(PurgeHtmlCrawler $dom) { |
||
50 | |||
51 | |||
52 | |||
53 | /** |
||
54 | * Get all unused css from the cssBlocks hashtable |
||
55 | * |
||
56 | * @return |
||
57 | * An array of DeclarationBlock objects |
||
58 | */ |
||
59 | public function getPurgedCss() { |
||
72 | |||
73 | |||
74 | |||
75 | /** |
||
76 | * Filter out any used CSS on a selector by selector basis |
||
77 | * |
||
78 | * @param DeclarationBlock $block |
||
79 | * |
||
80 | * @return mixed |
||
81 | * Return the DeclarationBlock if no usage is found |
||
82 | * otherwise, return null |
||
83 | */ |
||
84 | public function filter(DeclarationBlock $block, PurgeHtmlCrawler $dom) { |
||
99 | |||
100 | |||
101 | |||
102 | /** |
||
103 | * Strip any pseudo classes out of the selector |
||
104 | * |
||
105 | * @param string $selector |
||
106 | * |
||
107 | * @return string |
||
108 | * A processed selector string |
||
109 | */ |
||
110 | public function preprocess($selector) { |
||
121 | |||
122 | } |
||
123 |