<?php
 class vB_dB_QueryState { use vB_Trait_NoSerialize; private array $fields = []; private array $joins = []; private array $where = []; public function addJoin(string $key, string $join) { $this->joins[$key] = $join; } public function addFilter(string $filter) : void { $this->where[] = $filter; } public function addField(string $key, string $field) : void { $this->fields[$key] = $field; } public function hasJoin($key) { return !empty($this->joins[$key]); } public function hasField($key) { return !empty($this->fields[$key]); } public function getFieldString() : string { return implode(', ', $this->fields); } public function getJoinString() : string { return implode("\n", $this->joins); } public function getFilterString() : string { if (count($this->where) > 0) { return '(' . implode(') AND (', $this->where) . ')'; } else { return ''; } } } 