Replace the old clumsy and unreadable way of appending to a $db_cond variable by a cleaner way to define possible filters and evaluate them based on the actually present filters.
This PR adds a FilterHelper class whose add() method lets the caller define possible filters in various, but still readable ways.
In the end, the array of actually present filters is given to evaluate(), which compares it to the stored filters and returns a ready-to-use MySQL WHERE condition.
Replace the old clumsy and unreadable way of appending to a
$db_cond
variable by a cleaner way to define possible filters and evaluate them based on the actually present filters.This PR adds a
FilterHelper
class whoseadd()
method lets the caller define possible filters in various, but still readable ways. In the end, the array of actually present filters is given toevaluate()
, which compares it to the stored filters and returns a ready-to-use MySQLWHERE
condition.