src/Parts/Order.php 1 location
|
@@ 21-23 (lines=3) @@
|
18 |
|
|
19 |
|
public function __construct(array $fields = [], string $type = 'asc') |
20 |
|
{ |
21 |
|
if (!\in_array(strtolower($type), ['asc', 'desc'], true)) { |
22 |
|
throw new BuilderException('Передан неверный тип ' . $type . ' |ORDER add|'); |
23 |
|
} |
24 |
|
if (\count($fields)) { |
25 |
|
$this->map($fields, $type); |
26 |
|
} |
src/System/Traits/Helper.php 1 location
|
@@ 24-26 (lines=3) @@
|
21 |
|
|
22 |
|
public function concatOrder(array $order, string $type = 'asc'): string |
23 |
|
{ |
24 |
|
if (!\in_array($type, ['asc', 'desc'], true)) { |
25 |
|
throw new BuilderException('Передан неверный тип |ORDER concate|'); |
26 |
|
} |
27 |
|
$result = ''; |
28 |
|
if (\count($order) > 0) { |
29 |
|
$result = implode(',', $this->escapeField($order)) . ' ' . strtoupper($type); |