for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace mindplay\sql\model;
use UnexpectedValueException;
/**
* Pseudo-namespace for expression builder functions
*/
abstract class expr
{
* Combine a list of expressions with OR operators
*
* @param string[] $exprs
public static function any(array $exprs): string
if (count($exprs) === 0) {
throw new UnexpectedValueException("unexpected empty array");
}
return count($exprs) > 1
? "(" . implode(") OR (", $exprs) . ")"
: $exprs[0];
* Combine a list of expressions with AND operators
public static function all(array $exprs): string
? "(" . implode(") AND (", $exprs) . ")"