| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class FormRules. |
| 4 |
* |
| 5 |
* @package Packetery |
| 6 |
*/ |
| 7 |
|
| 8 |
declare(strict_types=1); |
| 9 |
|
| 10 |
namespace Packetery\Module; |
| 11 |
|
| 12 |
/** |
| 13 |
* Class FormRules. |
| 14 |
*/ |
| 15 |
class FormRules { |
| 16 |
/** |
| 17 |
* Creates greaterThan validator parts for addRule form method. |
| 18 |
* |
| 19 |
* @param float $threshold Threshold. |
| 20 |
* @return array{array{class-string<FormValidators>, 'greaterThan'}, string, float} |
| 21 |
*/ |
| 22 |
public static function getGreaterThanParameters( float $threshold ): array { |
| 23 |
return [ |
| 24 |
[ FormValidators::class, 'greaterThan' ], |
| 25 |
// translators: %d is numeric threshold. |
| 26 |
__( 'Enter number greater than %d', 'packeta' ), |
| 27 |
$threshold, |
| 28 |
]; |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Creates date validator parts for addRule form method. |
| 33 |
* |
| 34 |
* @return array{array{class-string<FormValidators>, 'dateIsInMysqlFormat'}, string} |
| 35 |
*/ |
| 36 |
public static function getDateParameters(): array { |
| 37 |
return [ |
| 38 |
[ FormValidators::class, 'dateIsInMysqlFormat' ], |
| 39 |
__( 'Please enter date in proper format.', 'packeta' ), |
| 40 |
]; |
| 41 |
} |
| 42 |
} |
| 43 |
|