| Total Complexity | 6 | 
| Total Lines | 53 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 9 | class Query extends AbstractQuery  | 
            ||
| 10 | { | 
            ||
| 11 | /**  | 
            ||
| 12 | * @inheritDoc  | 
            ||
| 13 | */  | 
            ||
| 14 | public function insertOrUpdate(string $table, array $rows, array $primary)  | 
            ||
| 15 |     { | 
            ||
| 16 | $values = [];  | 
            ||
| 17 |         foreach ($rows as $set) { | 
            ||
| 18 |             $values[] = "(" . implode(", ", $set) . ")"; | 
            ||
| 19 | }  | 
            ||
| 20 |         $result = $this->driver->execute("REPLACE INTO " . $this->driver->table($table) . | 
            ||
| 21 |             " (" . implode(", ", array_keys(reset($rows))) . ") VALUES\n" . implode(",\n", $values)); | 
            ||
| 22 | return $result == true;  | 
            ||
| 23 | }  | 
            ||
| 24 | |||
| 25 | /**  | 
            ||
| 26 | * @inheritDoc  | 
            ||
| 27 | */  | 
            ||
| 28 | public function user()  | 
            ||
| 29 |     { | 
            ||
| 30 | return get_current_user(); // should return effective user  | 
            ||
| 31 | }  | 
            ||
| 32 | |||
| 33 | /**  | 
            ||
| 34 | * @inheritDoc  | 
            ||
| 35 | */  | 
            ||
| 36 | public function view(string $name)  | 
            ||
| 37 |     { | 
            ||
| 38 | return [  | 
            ||
| 39 | 'name' => $name,  | 
            ||
| 40 | 'type' => 'VIEW',  | 
            ||
| 41 | 'materialized' => false,  | 
            ||
| 42 |             'select' => preg_replace('~^(?:[^`"[]+|`[^`]*`|"[^"]*")* AS\s+~iU', '', | 
            ||
| 43 |                 $this->connection->result("SELECT sql FROM sqlite_master WHERE name = " . | 
            ||
| 44 | $this->driver->quote($name)))  | 
            ||
| 45 | ]; //! identifiers may be inside []  | 
            ||
| 46 | }  | 
            ||
| 47 | |||
| 48 | /**  | 
            ||
| 49 | * @inheritDoc  | 
            ||
| 50 | */  | 
            ||
| 51 | public function lastAutoIncrementId()  | 
            ||
| 54 | }  | 
            ||
| 55 | |||
| 56 | /**  | 
            ||
| 57 | * @inheritDoc  | 
            ||
| 58 | */  | 
            ||
| 59 | public function explain(ConnectionInterface $connection, string $query)  | 
            ||
| 62 | }  | 
            ||
| 63 | }  | 
            ||
| 64 |