public static function formula($value, array $params = [])
    {
        if (empty($params['operator']) || !isset($params['operand'])) {
            return $value;
        }
        switch (trim($params['operator'])) {
            case '*':
                return $value * $params['operand'];
            case '/':
                return $value / $params['operand'];
            case '+':
                return $value + $params['operand'];
            case '-':
                return $value - $params['operand'];
            case '**':
                return pow($value, $params['operand']);
            case 'mod':
            case '%':
                return $value % $params['operand'];
            case '|':
                return $value | $params['operand'];
            case '&':
                return $value & $params['operand'];
            case '^':
            case 'xor':
                return $value ^ $params['operand'];
            case '<<':
                return $value << $params['operand'];
            case '>>':
                return $value >> $params['operand'];
        }
        throw new TemplateException("Unknown operator: {$params['operator']}");
    }