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