| Conditions | 4 |
| Paths | 6 |
| Total Lines | 19 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 38 | public function toString(): string |
|
| 31 | { |
||
| 32 | 38 | $orders = []; |
|
| 33 | |||
| 34 | 38 | foreach($this->orders as $column => $direction) |
|
| 35 | { |
||
| 36 | 12 | if(! empty($column)) |
|
| 37 | { |
||
| 38 | 11 | $orders[] = $column . ' ' . $direction; |
|
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | 38 | if(empty($orders)) |
|
| 43 | { |
||
| 44 | 29 | return ''; |
|
| 45 | } |
||
| 46 | |||
| 47 | 11 | return sprintf('ORDER BY %s', implode(', ', $orders)); |
|
| 48 | } |
||
| 49 | |||
| 60 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.