FOF30\Model\DataModel\Filter\Number::modulo PHP Méthode

modulo() public méthode

Perform an interval match. It's similar to a 'between' match, but the from and to values are calculated based on $value and $interval: $value - $interval < VALUE < $value + $interval
public modulo ( integer | float $value, integer | float $interval, boolean $include = true ) : string
$value integer | float The starting value of the search space
$interval integer | float The interval period of the search space
$include boolean Should I include the boundaries in the search?
Résultat string The SQL where clause
    public function modulo($value, $interval, $include = true)
    {
        if ($this->isEmpty($value) || $this->isEmpty($interval)) {
            return '';
        }
        $extra = '';
        if ($include) {
            $extra = '=';
        }
        $sql = '(' . $this->getFieldName() . ' >' . $extra . ' ' . $value . ' AND ';
        $sql .= '(' . $this->getFieldName() . ' - ' . $value . ') % ' . $interval . ' = 0)';
        return $sql;
    }