Total Complexity | 5 |
Total Lines | 71 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | abstract class AbstractDBHelper |
||
29 | { |
||
30 | /** |
||
31 | * Execute (or not) queries |
||
32 | * |
||
33 | * @var bool |
||
34 | */ |
||
35 | public $pretend = false; |
||
36 | |||
37 | /** |
||
38 | * DBAL connection |
||
39 | * |
||
40 | * @var Connection |
||
41 | */ |
||
42 | public $conn = null; |
||
43 | |||
44 | 75 | /** |
|
45 | * Requires a connection to work |
||
46 | 75 | */ |
|
47 | 75 | public function __construct(Connection $conn) |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * Set Pretend to true to simulate queries, false to execute interface |
||
54 | */ |
||
55 | public function setPretend(bool $pretend): AbstractDBHelper |
||
56 | 10 | { |
|
57 | $this->pretend = $pretend; |
||
58 | 10 | ||
59 | return $this; |
||
60 | 10 | } |
|
61 | |||
62 | /** |
||
63 | * Get, for a driver options for connection (PDO) |
||
64 | * |
||
65 | * @return array |
||
66 | */ |
||
67 | public static function getDriverOptions(): array |
||
68 | 70 | { |
|
69 | return []; |
||
70 | 70 | } |
|
71 | |||
72 | /** |
||
73 | * Set the right enclosure |
||
74 | */ |
||
75 | public function getEnclosureForCSV(): string |
||
76 | { |
||
77 | 1 | return '"'; |
|
78 | } |
||
79 | 1 | ||
80 | /** |
||
81 | * Register doctrine custom types for driver |
||
82 | */ |
||
83 | public function registerCustomTypes(): void |
||
85 | } |
||
86 | |||
87 | 33 | /** |
|
88 | * Load Data from a CSV |
||
89 | 33 | * |
|
90 | * @param string $fname File's name |
||
91 | * @param array $fields |
||
92 | */ |
||
93 | abstract public function loadData( |
||
94 | string $table, |
||
95 | string $fname, |
||
96 | array $fields, |
||
97 | string $mode |
||
98 | ): string; |
||
99 | } |
||
100 |