1 | <?php |
||
27 | class Settings |
||
28 | { |
||
29 | /** Optional Chart Rendering libraries */ |
||
30 | const CHART_RENDERER_JPGRAPH = 'JpGraph'; |
||
31 | |||
32 | /** Optional PDF Rendering libraries */ |
||
33 | const PDF_RENDERER_TCPDF = 'TcPDF'; |
||
34 | const PDF_RENDERER_DOMPDF = 'DomPDF'; |
||
35 | const PDF_RENDERER_MPDF = 'MPDF'; |
||
36 | |||
37 | private static $chartRenderers = [ |
||
38 | self::CHART_RENDERER_JPGRAPH, |
||
39 | ]; |
||
40 | |||
41 | private static $pdfRenderers = [ |
||
42 | self::PDF_RENDERER_TCPDF, |
||
43 | self::PDF_RENDERER_DOMPDF, |
||
44 | self::PDF_RENDERER_MPDF, |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * Name of the external Library used for rendering charts |
||
49 | * e.g. |
||
50 | * jpgraph. |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | private static $chartRendererName; |
||
55 | |||
56 | /** |
||
57 | * Directory Path to the external Library used for rendering charts. |
||
58 | * |
||
59 | * @var string |
||
60 | */ |
||
61 | private static $chartRendererPath; |
||
62 | |||
63 | /** |
||
64 | * Name of the external Library used for rendering PDF files |
||
65 | * e.g. |
||
66 | * mPDF. |
||
67 | * |
||
68 | * @var string |
||
69 | */ |
||
70 | private static $pdfRendererName; |
||
71 | |||
72 | /** |
||
73 | * Default options for libxml loader. |
||
74 | * |
||
75 | * @var int |
||
76 | */ |
||
77 | private static $libXmlLoaderOptions = null; |
||
78 | |||
79 | /** |
||
80 | * Return the name of the method that is currently configured for cell cacheing. |
||
81 | * |
||
82 | * @return string Name of the cacheing method |
||
83 | */ |
||
84 | public static function getCacheStorageMethod() |
||
88 | |||
89 | /** |
||
90 | * Return the name of the class that is currently being used for cell cacheing. |
||
91 | * |
||
92 | * @return string Name of the class currently being used for cacheing |
||
93 | */ |
||
94 | public static function getCacheStorageClass() |
||
98 | |||
99 | /** |
||
100 | * Set the method that should be used for cell caching. |
||
101 | * |
||
102 | * @param string $method Name of the caching method |
||
103 | * @param array $arguments Optional configuration arguments for the caching method |
||
104 | * |
||
105 | * @return bool Success or failure |
||
106 | */ |
||
107 | public static function setCacheStorageMethod($method = CachedObjectStorageFactory::CACHE_IN_MEMORY, $arguments = []) |
||
111 | |||
112 | /** |
||
113 | * Set the locale code to use for formula translations and any special formatting. |
||
114 | * |
||
115 | * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk") |
||
116 | * |
||
117 | * @return bool Success or failure |
||
118 | */ |
||
119 | public static function setLocale($locale = 'en_us') |
||
123 | |||
124 | /** |
||
125 | * Set details of the external library that PhpSpreadsheet should use for rendering charts. |
||
126 | * |
||
127 | * @param string $libraryName Internal reference name of the library |
||
128 | * e.g. \PhpOffice\PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH |
||
129 | * @param string $libraryBaseDir Directory path to the library's base folder |
||
130 | * |
||
131 | * @return bool Success or failure |
||
132 | */ |
||
133 | 3 | public static function setChartRenderer($libraryName, $libraryBaseDir) |
|
141 | |||
142 | /** |
||
143 | * Identify to PhpSpreadsheet the external library to use for rendering charts. |
||
144 | * |
||
145 | * @param string $libraryName Internal reference name of the library |
||
146 | * e.g. \PhpOffice\PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH |
||
147 | * |
||
148 | * @return bool Success or failure |
||
149 | */ |
||
150 | 3 | public static function setChartRendererName($libraryName) |
|
159 | |||
160 | /** |
||
161 | * Tell PhpSpreadsheet where to find the external library to use for rendering charts. |
||
162 | * |
||
163 | * @param string $libraryBaseDir Directory path to the library's base folder |
||
164 | * |
||
165 | * @return bool Success or failure |
||
166 | */ |
||
167 | 3 | public static function setChartRendererPath($libraryBaseDir) |
|
176 | |||
177 | /** |
||
178 | * Return the Chart Rendering Library that PhpSpreadsheet is currently configured to use (e.g. jpgraph). |
||
179 | * |
||
180 | * @return string|null Internal reference name of the Chart Rendering Library that PhpSpreadsheet is |
||
181 | * currently configured to use |
||
182 | * e.g. \PhpOffice\PhpSpreadsheet\Settings::CHART_RENDERER_JPGRAPH |
||
183 | */ |
||
184 | public static function getChartRendererName() |
||
188 | |||
189 | /** |
||
190 | * Return the directory path to the Chart Rendering Library that PhpSpreadsheet is currently configured to use. |
||
191 | * |
||
192 | * @return string|null Directory Path to the Chart Rendering Library that PhpSpreadsheet is |
||
193 | * currently configured to use |
||
194 | */ |
||
195 | public static function getChartRendererPath() |
||
199 | |||
200 | /** |
||
201 | * Identify to PhpSpreadsheet the external library to use for rendering PDF files. |
||
202 | * |
||
203 | * @param string $libraryName Internal reference name of the library |
||
204 | * e.g. \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF, |
||
205 | * \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF |
||
206 | * or \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF |
||
207 | */ |
||
208 | 5 | public static function setPdfRendererName($libraryName) |
|
215 | |||
216 | /** |
||
217 | * Return the PDF Rendering Library that PhpSpreadsheet is currently configured to use (e.g. dompdf). |
||
218 | * |
||
219 | * @return string|null Internal reference name of the PDF Rendering Library that PhpSpreadsheet is |
||
220 | * currently configured to use |
||
221 | * e.g. \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF, |
||
222 | * \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF |
||
223 | * or \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF |
||
224 | */ |
||
225 | 4 | public static function getPdfRendererName() |
|
229 | |||
230 | /** |
||
231 | * Set default options for libxml loader. |
||
232 | * |
||
233 | * @param int $options Default options for libxml loader |
||
234 | */ |
||
235 | 14 | public static function setLibXmlLoaderOptions($options = null) |
|
242 | |||
243 | /** |
||
244 | * Get default options for libxml loader. |
||
245 | * Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly. |
||
246 | * |
||
247 | * @return int Default options for libxml loader |
||
248 | */ |
||
249 | 22 | public static function getLibXmlLoaderOptions() |
|
259 | } |
||
260 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.