/** * Parses ORDER BY clause. * @return string */ protected function parseSorting() { $order = array(); foreach ($this->stmt->getSorting() as $rule) { list($field, $type) = $rule; $order[] = $this->tryDelimite($field) . ($type !== null ? ' ' . $type : ''); } return "\nORDER BY " . implode(', ', $order); }