Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
7 / 7 |
OrderBy | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
7 / 7 |
__construct | |
100.00% |
1 / 1 |
2 | |
100.00% |
5 / 5 |
|||
field | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
direction | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
namespace PHPixie\Database\Values; | |
class OrderBy | |
{ | |
protected $field; | |
protected $direction; | |
public function __construct($field, $direction) | |
{ | |
if(!in_array($direction, array('asc', 'desc'))) | |
throw new \PHPixie\Database\Exception\Value("Invalid order direction '$direction'"); | |
$this->field = $field; | |
$this->direction = $direction; | |
} | |
public function field() | |
{ | |
return $this->field; | |
} | |
public function direction() | |
{ | |
return $this->direction; | |
} | |
} |