1 | <?php |
||
12 | class StyleBuilder |
||
13 | { |
||
14 | /** @var Style Style to be created */ |
||
15 | protected $style; |
||
16 | |||
17 | /** |
||
18 | * |
||
19 | */ |
||
20 | 108 | public function __construct() |
|
24 | |||
25 | /** |
||
26 | * Makes the font bold. |
||
27 | * |
||
28 | * @return StyleBuilder |
||
29 | */ |
||
30 | 21 | public function setFontBold() |
|
36 | |||
37 | /** |
||
38 | * Makes the font italic. |
||
39 | * |
||
40 | * @return StyleBuilder |
||
41 | */ |
||
42 | 7 | public function setFontItalic() |
|
48 | |||
49 | /** |
||
50 | * Makes the font underlined. |
||
51 | * |
||
52 | * @return StyleBuilder |
||
53 | */ |
||
54 | 7 | public function setFontUnderline() |
|
60 | |||
61 | /** |
||
62 | * Makes the font struck through. |
||
63 | * |
||
64 | * @return StyleBuilder |
||
65 | */ |
||
66 | 4 | public function setFontStrikethrough() |
|
72 | |||
73 | /** |
||
74 | * Sets the font size. |
||
75 | * |
||
76 | * @param int $fontSize Font size, in pixels |
||
77 | * @return StyleBuilder |
||
78 | */ |
||
79 | 52 | public function setFontSize($fontSize) |
|
85 | |||
86 | /** |
||
87 | * Sets the font color. |
||
88 | * |
||
89 | * @param string $fontColor ARGB color (@see Color) |
||
90 | * @return StyleBuilder |
||
91 | */ |
||
92 | 3 | public function setFontColor($fontColor) |
|
98 | |||
99 | /** |
||
100 | * Sets the font name. |
||
101 | * |
||
102 | * @param string $fontName Name of the font to use |
||
103 | * @return StyleBuilder |
||
104 | */ |
||
105 | 50 | public function setFontName($fontName) |
|
111 | |||
112 | /** |
||
113 | * Makes the text wrap in the cell if requested |
||
114 | * |
||
115 | * @param bool $shouldWrap Should the text be wrapped |
||
116 | * @return StyleBuilder |
||
117 | */ |
||
118 | 4 | public function setShouldWrapText($shouldWrap = true) |
|
124 | |||
125 | /** |
||
126 | * Set a border |
||
127 | * |
||
128 | * @param Border $border |
||
129 | * @return $this |
||
130 | */ |
||
131 | 8 | public function setBorder(Border $border) |
|
137 | |||
138 | /** |
||
139 | * Sets a background color |
||
140 | * |
||
141 | * @param string $color ARGB color (@see Color) |
||
142 | * @return StyleBuilder |
||
143 | */ |
||
144 | 7 | public function setBackgroundColor($color) |
|
150 | |||
151 | /** |
||
152 | * Sets a format |
||
153 | * |
||
154 | * @param string $format Format |
||
155 | * @return StyleBuilder |
||
156 | * @api |
||
157 | */ |
||
158 | 3 | public function setFormat($format) |
|
164 | |||
165 | /** |
||
166 | * Returns the configured style. The style is cached and can be reused. |
||
167 | * |
||
168 | * @return Style |
||
169 | */ |
||
170 | 108 | public function build() |
|
174 | } |
||
175 |