@@ 48-62 (lines=15) @@ | ||
45 | * |
|
46 | * @return \League\JsonGuard\ValidationError|null |
|
47 | */ |
|
48 | private function validateMax($value, $parameter, $pointer) |
|
49 | { |
|
50 | if (!is_numeric($value) || |
|
51 | bccomp($value, $parameter, $this->precision) === -1 || bccomp($value, $parameter, $this->precision) === 0) { |
|
52 | return null; |
|
53 | } |
|
54 | ||
55 | return new ValidationError( |
|
56 | 'Value {value} is not at most {max}', |
|
57 | self::KEYWORD, |
|
58 | $value, |
|
59 | $pointer, |
|
60 | ['value' => $value, 'max' => $parameter] |
|
61 | ); |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * @param mixed $value |
@@ 48-62 (lines=15) @@ | ||
45 | * |
|
46 | * @return \League\JsonGuard\ValidationError|null |
|
47 | */ |
|
48 | private function validateMin($value, $parameter, $pointer = null) |
|
49 | { |
|
50 | if (!is_numeric($value) || |
|
51 | bccomp($value, $parameter, $this->precision) === 1 || bccomp($value, $parameter, $this->precision) === 0) { |
|
52 | return null; |
|
53 | } |
|
54 | ||
55 | return new ValidationError( |
|
56 | 'Number {value} is not at least {min}', |
|
57 | self::KEYWORD, |
|
58 | $value, |
|
59 | $pointer, |
|
60 | ['value' => $value, 'min' => $parameter] |
|
61 | ); |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * @param mixed $value |