public function setOperator($operator)
    {
        if (!$operator) {
            $operator = '==';
        }

        if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
            throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
        }

        $this->operator = $operator;
    }
public function setOperator($operator)
    {
        if (!$operator) {
            $operator = '==';
        }

        if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
            throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
        }

        $this->operator = $operator;
    }
public function setOperator ( $ operator ) { if ( ! $ operator ) { $ operator = '==' ; } if ( ! \ in_array ( $ operator , [ '>' , '<' , '>=' , '<=' , '==' , '!=' ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid operator "%s".' , $ operator ) ) ; } $ this -> operator = $ operator ; }
Sets the comparison operator.

@param string $operator A valid operator

@throws \InvalidArgumentException
Sets the comparison operator .