diff --git a/SqlBuilder.php b/SqlBuilder.php index 32190f3..0ae3d5b 100644 --- a/SqlBuilder.php +++ b/SqlBuilder.php @@ -281,10 +281,11 @@ class SqlBuilder extends Component */ private function make(): string { - $select = $this->makeCondition(); - $select .= $this->makeGroup(); - $select .= $this->makeOrder(); - return $select; + return join(' ', [ + $this->makeCondition(), + $this->makeGroup(), + $this->makeOrder(), + ]); } /** @@ -310,7 +311,7 @@ class SqlBuilder extends Component private function makeGroup(): string { if ($this->query->group !== '' && $this->query->group !== '0') { - return ' GROUP BY ' . $this->query->group; + return 'GROUP BY ' . $this->query->group; } return ''; } @@ -322,7 +323,7 @@ class SqlBuilder extends Component private function makeOrder(): string { if (count($this->query->order) > 0) { - return ' ORDER BY ' . implode(',', $this->query->order); + return 'ORDER BY ' . implode(',', $this->query->order); } return ''; } @@ -337,7 +338,7 @@ class SqlBuilder extends Component if (empty($condition)) { return ''; } - return ' WHERE ' . $condition; + return 'WHERE ' . $condition; }