PluginProbe
Packeta / 1.6.2
Packeta v1.6.2
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / Packetery / Module / FormValidators.php

FormValidators.php in Packeta 1.6.2, at src/Packetery/Module/FormValidators.php

45 lines 885 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class FormValidators
4 *
5 * @package Packetery\Module
6 */
7
8 declare(strict_types=1);
9
10 namespace Packetery\Module;
11
12 use Packetery\Nette\Forms\Controls\BaseControl;
13
14 /**
15 * Class FormValidators
16 *
17 * @package Packetery\Module
18 */
19 class FormValidators {
20
21 /**
22 * Tests if input value is greater than argument.
23 *
24 * @param BaseControl $input Form input.
25 * @param float $arg Validation argument.
26 *
27 * @return bool
28 */
29 public static function greaterThan( BaseControl $input, float $arg ): bool {
30 return $input->getValue() > $arg;
31 }
32
33 /**
34 * Tests if input date is later than argument date
35 *
36 * @param BaseControl $input Form input.
37 * @param string $date Validation argument.
38 *
39 * @return bool
40 */
41 public static function dateIsLater( BaseControl $input, string $date ): bool {
42 return strtotime( $input->getValue() ) > strtotime( $date );
43 }
44 }
45