Total Complexity | 5 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class DatabaseLogger |
||
8 | { |
||
9 | protected \PDO $dsn; |
||
10 | protected string $table; |
||
11 | |||
12 | public function __construct() |
||
13 | { |
||
14 | $this->dsn = Rudra::get("DSN"); |
||
15 | } |
||
16 | |||
17 | protected function up(): void |
||
30 | } |
||
31 | |||
32 | protected function isTable() |
||
39 | } |
||
40 | |||
41 | protected function writeLog(string $name): void |
||
42 | { |
||
43 | $query = $this->dsn->prepare(" |
||
44 | INSERT INTO {$this->table} (`name`) |
||
45 | VALUES (:name)" |
||
46 | ); |
||
47 | |||
48 | $query->execute([':name' => $name]); |
||
49 | } |
||
50 | |||
51 | protected function checkLog(string $name) |
||
63 | } |
||
64 | } |