PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.6
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.6
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Services / Spout / Writer / WriterFactory.php

WriterFactory.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.6, at app/Services/Spout/Writer/WriterFactory.php

49 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Box\Spout\Writer;
4
5 use Box\Spout\Common\Exception\UnsupportedTypeException;
6 use Box\Spout\Common\Helper\GlobalFunctionsHelper;
7 use Box\Spout\Common\Type;
8
9 /**
10 * Class WriterFactory
11 * This factory is used to create writers, based on the type of the file to be read.
12 * It supports CSV, XLSX and ODS formats.
13 *
14 * @package Box\Spout\Writer
15 */
16 class WriterFactory
17 {
18 /**
19 * This creates an instance of the appropriate writer, given the type of the file to be read
20 *
21 * @api
22 * @param string $writerType Type of the writer to instantiate
23 * @return WriterInterface
24 * @throws \Box\Spout\Common\Exception\UnsupportedTypeException
25 */
26 public static function create($writerType)
27 {
28 $writer = null;
29
30 switch ($writerType) {
31 case Type::CSV:
32 $writer = new CSV\Writer();
33 break;
34 case Type::XLSX:
35 $writer = new XLSX\Writer();
36 break;
37 case Type::ODS:
38 $writer = new ODS\Writer();
39 break;
40 default:
41 throw new UnsupportedTypeException('No writers supporting the given type: ' . $writerType);
42 }
43
44 $writer->setGlobalFunctionsHelper(new GlobalFunctionsHelper());
45
46 return $writer;
47 }
48 }
49