1 | <?php |
||
2 | |||
3 | namespace ClickHouseDB\Quote; |
||
4 | |||
5 | class FormatLine |
||
6 | { |
||
7 | /** |
||
8 | * |
||
9 | * @var array |
||
10 | */ |
||
11 | private static $strict = []; |
||
12 | |||
13 | /** |
||
14 | * Format |
||
15 | * |
||
16 | * @param string $format |
||
17 | * @return StrictQuoteLine |
||
18 | */ |
||
19 | 11 | public static function strictQuote($format) |
|
20 | { |
||
21 | 11 | if (empty(self::$strict[$format])) |
|
22 | { |
||
23 | 2 | self::$strict[$format] = new StrictQuoteLine($format); |
|
24 | } |
||
25 | 11 | return self::$strict[$format]; |
|
26 | } |
||
27 | |||
28 | /** |
||
29 | * Array in a string for a query Insert |
||
30 | * |
||
31 | * @param mixed[] $row |
||
32 | * @return string |
||
33 | */ |
||
34 | 11 | public static function Insert(array $row) |
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
35 | { |
||
36 | 11 | return self::strictQuote('Insert')->quoteRow($row); |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * Array to TSV |
||
41 | * |
||
42 | * @param array $row |
||
43 | * @return string |
||
44 | */ |
||
45 | 1 | public static function TSV(Array $row) |
|
46 | { |
||
47 | 1 | return self::strictQuote('TSV')->quoteRow($row); |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * Array to CSV |
||
52 | * |
||
53 | * @param array $row |
||
54 | * @return string |
||
55 | */ |
||
56 | 1 | public static function CSV(Array $row) |
|
57 | { |
||
58 | 1 | return self::strictQuote('CSV')->quoteRow($row); |
|
59 | } |
||
60 | } |
||
61 |