1 | <?php |
||
12 | class Styler |
||
13 | { |
||
14 | /** |
||
15 | * Holds unique styles. |
||
16 | * |
||
17 | * @var Style[] |
||
18 | */ |
||
19 | private $styles = array(); |
||
20 | |||
21 | /** |
||
22 | * Holds unique fonts. |
||
23 | * |
||
24 | * @var Font[] |
||
25 | */ |
||
26 | private $fonts = array(); |
||
27 | |||
28 | /** |
||
29 | * Holds unique fills. |
||
30 | * |
||
31 | * @var Fill[] |
||
32 | */ |
||
33 | private $fills = array(); |
||
34 | |||
35 | /** |
||
36 | * Holds unique borders. |
||
37 | * |
||
38 | * @var Border[] |
||
39 | */ |
||
40 | private $borders = array(); |
||
41 | |||
42 | /** |
||
43 | * Holds (hash => component id) mappings. |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | private $hashes = array(); |
||
48 | |||
49 | /** |
||
50 | * Styler constructor to initialize reserved default styles. |
||
51 | */ |
||
52 | 4 | public function __construct() |
|
58 | |||
59 | /** |
||
60 | * Add a new style, if it doesnt exists yet. |
||
61 | * |
||
62 | * @param Style $style |
||
63 | */ |
||
64 | 4 | public function addStyle(Style $style) |
|
74 | |||
75 | /** |
||
76 | * Register a new style/font/fill component to account |
||
77 | * for reusable styles, fills, fonts, ... |
||
78 | * |
||
79 | * @param Component $component |
||
80 | * @param array $collection |
||
81 | */ |
||
82 | 4 | private function register(Component $component, &$collection) |
|
94 | |||
95 | /** |
||
96 | * Return default style (Calibri,11). |
||
97 | * |
||
98 | * @return Style |
||
99 | */ |
||
100 | 1 | public function getDefaultStyle() |
|
104 | |||
105 | /** |
||
106 | * Return entire xml string for the style sheet. |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | 2 | public function getStyleSheetXml() |
|
124 | |||
125 | /** |
||
126 | * Return fonts, fills, borders, xfs xml strings. |
||
127 | * |
||
128 | * @param Component[] $components |
||
129 | * @return string |
||
130 | */ |
||
131 | 2 | private function getComponentXml(array &$components) |
|
139 | } |
||
140 |