1 | <?php |
||
18 | class CsvConfiguration implements CsvConfigurationInterface |
||
19 | { |
||
20 | const DEFAULT_DELIMITER = ','; |
||
21 | const DEFAULT_NULL = '\\N'; |
||
22 | const DEFAULT_QUOTE = '"'; |
||
23 | const DEFAULT_ESCAPE = '\\'; |
||
24 | const DEFAULT_DOUBLE_QUOTE = false; |
||
25 | const DEFAULT_ENCODING = 'UTF-8'; |
||
26 | |||
27 | const OPTION_DELIMITER = 'delimiter'; |
||
28 | const OPTION_NULL = 'null'; |
||
29 | const OPTION_NEW_LINES = 'newLines'; |
||
30 | const OPTION_QUOTE = 'quote'; |
||
31 | const OPTION_ESCAPE = 'escape'; |
||
32 | const OPTION_DOUBLE_QUOTE = 'doubleQuote'; |
||
33 | const OPTION_BOMS = 'boms'; |
||
34 | const OPTION_ENCODING = 'encoding'; |
||
35 | |||
36 | /** @var string */ |
||
37 | private $delimiter; |
||
38 | /** @var string */ |
||
39 | private $quote; |
||
40 | /** @var string */ |
||
41 | private $escape; |
||
42 | /** @var bool */ |
||
43 | private $doubleQuotes; |
||
44 | /** @var string[] */ |
||
45 | private $newLines; |
||
46 | /** @var string */ |
||
47 | private $null; |
||
48 | /** @var string[] */ |
||
49 | private $boms; |
||
50 | /** @var string */ |
||
51 | private $encoding; |
||
52 | |||
53 | /** |
||
54 | * CsvConfiguration constructor. |
||
55 | * |
||
56 | * @param array $options List of options that can be configured: |
||
57 | * <p> `delimiter` string (Default: `','`) |
||
58 | * <p> `quote` string (Default: `'"'`) |
||
59 | * <p> `escape` string (Default: `'\\'`) |
||
60 | * <p> `doubleQuotes` string (Default: `false`) |
||
61 | * <p> `newLines` string[] (Default: `["\n","\r","\r\n"]`) |
||
62 | * <p> `null` string (Default: `'\\N'`) |
||
63 | * <p> `boms` string[] (Default: |
||
64 | * `[Bom::BOM_UTF8,Bom::BOM_UTF16_BE,Bom::BOM_UTF16_LE,Bom::BOM_UTF32_BE,Bom::BOM_UTF32_LE]`) |
||
65 | * <p> `encoding` string (Default: `'UTF-8'`) |
||
66 | */ |
||
67 | 8 | public function __construct(array $options = []) |
|
94 | |||
95 | /** |
||
96 | * @param array $options |
||
97 | * @param string $name |
||
98 | * @param mixed $default |
||
99 | * @param callable $type |
||
|
|||
100 | * |
||
101 | * @return mixed |
||
102 | */ |
||
103 | 8 | private function getOption(array $options, $name, $default = null, callable $type = null) |
|
120 | |||
121 | /** |
||
122 | * @return string |
||
123 | */ |
||
124 | 30 | public function getDelimiter() |
|
128 | |||
129 | /** |
||
130 | * @return string |
||
131 | */ |
||
132 | 30 | public function getQuote() |
|
136 | |||
137 | /** |
||
138 | * @return string |
||
139 | */ |
||
140 | 30 | public function getEscape() |
|
144 | |||
145 | /** |
||
146 | * @return string[] |
||
147 | */ |
||
148 | 30 | public function getNewLines() |
|
152 | |||
153 | /** |
||
154 | * @return bool |
||
155 | */ |
||
156 | 28 | public function useDoubleQuotes() |
|
160 | |||
161 | /** |
||
162 | * @return string |
||
163 | */ |
||
164 | 30 | public function getNullValue() |
|
168 | |||
169 | /** |
||
170 | * @return string[] |
||
171 | */ |
||
172 | 30 | public function getBoms() |
|
176 | |||
177 | /** |
||
178 | * @return string |
||
179 | */ |
||
180 | 30 | public function getEncoding() |
|
184 | } |
||
185 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.