public static function getDecimalValidator(Logger $logger, $scale = 6)
 {
     if (empty($scale)) {
         $scale = 6;
     }
     $validator = new Decimal($logger);
     $validator->withScale($scale);
     return $validator;
 }
 private static function getDecimalValidator($column, $logger)
 {
     $validator = new Decimal($logger);
     $maxValueWithoutPoint = str_repeat("9", $column->NUMERIC_PRECISION);
     $divisorBasedOnScaleValue = pow(10, $column->NUMERIC_SCALE);
     $maxValue = $maxValueWithoutPoint / $divisorBasedOnScaleValue;
     $validator->withMin(-$maxValue)->withMax($maxValue)->withScale($column->NUMERIC_SCALE);
     return $validator;
 }
Beispiel #3
0
function testDecimal()
{
    $decimal = new Decimal(LoggerFactory::getNullLogger());
    $decimal->set(5.6);
    if (!$decimal->isValid()) {
        echo "\nInvalid decimal separator !";
    } else {
        echo "\nValid decimal separator";
    }
    echo "\n";
}