| Total Complexity | 6 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class OrderBy |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Regras de ordenação |
||
| 12 | * @var string[] |
||
| 13 | */ |
||
| 14 | private $rules; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Prepara a cláusula SQL |
||
| 18 | */ |
||
| 19 | public function __construct() |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Retorna o SQL da cláusula |
||
| 26 | * @return string |
||
| 27 | */ |
||
| 28 | public function __toString() |
||
| 29 | { |
||
| 30 | if (!empty($this->rules)) { |
||
| 31 | ksort($this->rules); |
||
| 32 | |||
| 33 | return ' ORDER BY ' . implode(', ', $this->rules); |
||
| 34 | } |
||
| 35 | |||
| 36 | return ''; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Define a ordenação principal |
||
| 41 | * @param string $orderBy |
||
| 42 | */ |
||
| 43 | public function set($orderBy) |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Adiciona uma ordenação |
||
| 50 | * @param string $orderBy |
||
| 51 | * @param int $priority |
||
| 52 | */ |
||
| 53 | public function add($orderBy, $priority = 0) |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Remove as ordenações |
||
| 60 | */ |
||
| 61 | public function reset() |
||
| 64 | } |
||
| 65 | } |
||
| 66 |