1 | <?php |
||
14 | class StyleBuilder |
||
15 | { |
||
16 | /** @var Style Style to be created */ |
||
17 | protected $style; |
||
18 | |||
19 | /** |
||
20 | * |
||
21 | */ |
||
22 | 111 | public function __construct() |
|
26 | |||
27 | /** |
||
28 | * Makes the font bold. |
||
29 | * |
||
30 | * @return StyleBuilder |
||
31 | */ |
||
32 | 20 | public function setFontBold() |
|
38 | |||
39 | /** |
||
40 | * Makes the font italic. |
||
41 | * |
||
42 | * @return StyleBuilder |
||
43 | */ |
||
44 | 7 | public function setFontItalic() |
|
50 | |||
51 | /** |
||
52 | * Makes the font underlined. |
||
53 | * |
||
54 | * @return StyleBuilder |
||
55 | */ |
||
56 | 7 | public function setFontUnderline() |
|
62 | |||
63 | /** |
||
64 | * Makes the font struck through. |
||
65 | * |
||
66 | * @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 | * @return StyleBuilder |
||
80 | */ |
||
81 | 53 | public function setFontSize($fontSize) |
|
87 | |||
88 | /** |
||
89 | * Sets the font color. |
||
90 | * |
||
91 | * @param string $fontColor ARGB color (@see Color) |
||
92 | * @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 | * @return StyleBuilder |
||
106 | */ |
||
107 | 51 | 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 | * @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 | * |
||
132 | * @throws InvalidArgumentException If the given cell alignment is not valid |
||
133 | * @return StyleBuilder |
||
134 | */ |
||
135 | 4 | public function setCellAlignment($cellAlignment) |
|
145 | |||
146 | /** |
||
147 | * Set a border |
||
148 | * |
||
149 | * @param Border $border |
||
150 | * @return $this |
||
151 | */ |
||
152 | 8 | public function setBorder(Border $border) |
|
158 | |||
159 | /** |
||
160 | * Sets a background color |
||
161 | * |
||
162 | * @param string $color ARGB color (@see Color) |
||
163 | * @return StyleBuilder |
||
164 | */ |
||
165 | 7 | public function setBackgroundColor($color) |
|
171 | |||
172 | /** |
||
173 | * Sets a format |
||
174 | * |
||
175 | * @param string $format Format |
||
176 | * @return StyleBuilder |
||
177 | * @api |
||
178 | */ |
||
179 | 3 | 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 | 110 | public function build() |
|
195 | } |
||
196 |