1 | <?php |
||
14 | class StyleBuilder |
||
15 | { |
||
16 | /** @var Style Style to be created */ |
||
17 | protected $style; |
||
18 | |||
19 | /** |
||
20 | 108 | * |
|
21 | */ |
||
22 | 108 | public function __construct() |
|
26 | |||
27 | /** |
||
28 | * Makes the font bold. |
||
29 | * |
||
30 | 21 | * @return StyleBuilder |
|
31 | */ |
||
32 | 21 | public function setFontBold() |
|
38 | |||
39 | /** |
||
40 | * Makes the font italic. |
||
41 | * |
||
42 | 7 | * @return StyleBuilder |
|
43 | */ |
||
44 | 7 | public function setFontItalic() |
|
50 | |||
51 | /** |
||
52 | * Makes the font underlined. |
||
53 | * |
||
54 | 7 | * @return StyleBuilder |
|
55 | */ |
||
56 | 7 | public function setFontUnderline() |
|
62 | |||
63 | /** |
||
64 | * Makes the font struck through. |
||
65 | * |
||
66 | 4 | * @return StyleBuilder |
|
67 | */ |
||
68 | 4 | public function setFontStrikethrough() |
|
74 | |||
75 | /** |
||
76 | * Sets the font size. |
||
77 | * |
||
78 | * @param int $fontSize Font size, in pixels |
||
79 | 52 | * @return StyleBuilder |
|
80 | */ |
||
81 | 52 | public function setFontSize($fontSize) |
|
87 | |||
88 | /** |
||
89 | * Sets the font color. |
||
90 | * |
||
91 | * @param string $fontColor ARGB color (@see Color) |
||
92 | 3 | * @return StyleBuilder |
|
93 | */ |
||
94 | 3 | public function setFontColor($fontColor) |
|
100 | |||
101 | /** |
||
102 | * Sets the font name. |
||
103 | * |
||
104 | * @param string $fontName Name of the font to use |
||
105 | 50 | * @return StyleBuilder |
|
106 | */ |
||
107 | 50 | public function setFontName($fontName) |
|
113 | |||
114 | /** |
||
115 | * Makes the text wrap in the cell if requested |
||
116 | * |
||
117 | * @param bool $shouldWrap Should the text be wrapped |
||
118 | 4 | * @return StyleBuilder |
|
119 | */ |
||
120 | 4 | public function setShouldWrapText($shouldWrap = true) |
|
126 | |||
127 | /** |
||
128 | * Sets the cell alignment. |
||
129 | * |
||
130 | * @param string $cellAlignment The cell alignment |
||
131 | 8 | * |
|
132 | * @throws InvalidArgumentException If the given cell alignment is not valid |
||
133 | 8 | * @return StyleBuilder |
|
134 | */ |
||
135 | 8 | public function setCellAlignment($cellAlignment) |
|
145 | |||
146 | 7 | /** |
|
147 | * Set a border |
||
148 | 7 | * |
|
149 | * @param Border $border |
||
150 | * @return $this |
||
151 | */ |
||
152 | public function setBorder(Border $border) |
||
158 | 3 | ||
159 | /** |
||
160 | 3 | * Sets a background color |
|
161 | * |
||
162 | 3 | * @param string $color ARGB color (@see Color) |
|
163 | * @return StyleBuilder |
||
164 | */ |
||
165 | public function setBackgroundColor($color) |
||
171 | |||
172 | 108 | /** |
|
173 | * Sets a format |
||
174 | * |
||
175 | * @param string $format Format |
||
176 | * @return StyleBuilder |
||
177 | * @api |
||
178 | */ |
||
179 | public function setFormat($format) |
||
185 | |||
186 | /** |
||
187 | * Returns the configured style. The style is cached and can be reused. |
||
188 | * |
||
189 | * @return Style |
||
190 | */ |
||
191 | public function build() |
||
195 | } |
||
196 |