1 | <?php |
||
14 | class StyleBuilder |
||
15 | { |
||
16 | /** @var Style Style to be created */ |
||
17 | protected $style; |
||
18 | |||
19 | /** |
||
20 | * |
||
21 | */ |
||
22 | 118 | public function __construct() |
|
26 | |||
27 | /** |
||
28 | * Makes the font bold. |
||
29 | * |
||
30 | * @api |
||
31 | * @return StyleBuilder |
||
32 | */ |
||
33 | 16 | public function setFontBold() |
|
38 | |||
39 | /** |
||
40 | * Makes the font italic. |
||
41 | * |
||
42 | * @api |
||
43 | * @return StyleBuilder |
||
44 | */ |
||
45 | 4 | public function setFontItalic() |
|
50 | |||
51 | /** |
||
52 | * Makes the font underlined. |
||
53 | * |
||
54 | * @api |
||
55 | * @return StyleBuilder |
||
56 | */ |
||
57 | 6 | public function setFontUnderline() |
|
62 | |||
63 | /** |
||
64 | * Makes the font struck through. |
||
65 | * |
||
66 | * @api |
||
67 | * @return StyleBuilder |
||
68 | */ |
||
69 | 4 | public function setFontStrikethrough() |
|
74 | |||
75 | /** |
||
76 | * Sets the font size. |
||
77 | * |
||
78 | * @api |
||
79 | * @param int $fontSize Font size, in pixels |
||
80 | * @return StyleBuilder |
||
81 | */ |
||
82 | 57 | public function setFontSize($fontSize) |
|
87 | |||
88 | /** |
||
89 | * Sets the font color. |
||
90 | * |
||
91 | * @api |
||
92 | * @param string $fontColor ARGB color (@see Color) |
||
93 | * @return StyleBuilder |
||
94 | */ |
||
95 | 2 | public function setFontColor($fontColor) |
|
100 | |||
101 | /** |
||
102 | * Sets the font name. |
||
103 | * |
||
104 | * @api |
||
105 | * @param string $fontName Name of the font to use |
||
106 | * @return StyleBuilder |
||
107 | */ |
||
108 | 54 | public function setFontName($fontName) |
|
113 | |||
114 | /** |
||
115 | * Makes the text wrap in the cell if requested |
||
116 | * |
||
117 | * @api |
||
118 | * @param bool $shouldWrap Should the text be wrapped |
||
119 | * @return StyleBuilder |
||
120 | */ |
||
121 | 5 | public function setShouldWrapText($shouldWrap = true) |
|
126 | |||
127 | /** |
||
128 | * Set a border |
||
129 | * |
||
130 | * @param Border $border |
||
131 | * @return $this |
||
132 | */ |
||
133 | 8 | public function setBorder(Border $border) |
|
138 | |||
139 | /** |
||
140 | * Sets a background color |
||
141 | * |
||
142 | * @api |
||
143 | * @param string $color ARGB color (@see Color) |
||
144 | * @return StyleBuilder |
||
145 | */ |
||
146 | 6 | public function setBackgroundColor($color) |
|
151 | |||
152 | /** |
||
153 | * Returns the configured style. The style is cached and can be reused. |
||
154 | * |
||
155 | * @api |
||
156 | * @return Style |
||
157 | */ |
||
158 | 118 | public function build() |
|
162 | } |
||
163 |