db = $db; } /** * Get all tables of database * * @return array * * @since 1.0.0 */ public function getTables() : array { $tables = []; $builder = new Builder($this->db); /** @var array $tNames */ $tNames = $builder->selectTables()->execute()?->fetchAll(\PDO::FETCH_ASSOC); if ($tNames === null) { return $tables; } foreach ($tNames as $name) { $tables[] = \array_values($name)[0]; } return $tables; } /** * Get table by name * * @param string $name Name of the table * * @return Table * * @since 1.0.0 */ public function getTable(string $name) : Table { $table = new Table(); return $table; } /** * Get fields of table * * @param string $table Name of the table * * @return array * * @since 1.0.0 */ public function getFields(string $table) : array { $builder = new Builder($this->db); $fields = $builder->selectFields($table)->execute()?->fetchAll(\PDO::FETCH_ASSOC); return $fields === null ? [] : $fields; } /** * Get field of table * * @param string $table Name of the table * @param string $name Name of the field * * @return Field * * @since 1.0.0 */ public function getField(string $table, string $name) : Field { $field = new Field(); return $field; } }