for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BfwSql\Queries\Parts;
class OrderList extends AbstractList
{
/**
* {@inheritdoc}
*/
protected $partPrefix = 'ORDER BY';
protected $separator = ',';
* Magic method __invoke, used when the user call object like a function
* @link http://php.net/manual/en/language.oop5.magic.php#object.invoke
*
* @param string $expr The expression to use into the order
* @param string $sort The sort order : ASC or DESC
* @return void
public function __invoke(string $expr, $sort = 'ASC')
$this->list[] = new Order($expr, $sort);
}
public function generate(): string
$sqlPart = '';
foreach ($this->list as $index => $order) {
if ($index > 0) {
$sqlPart .= $this->separator;
$sqlPart .= $order->generate();
return $sqlPart;