1 <?php
2 /**
3 * IntegerInput.php
4 *
5 * @author Elvyrra SAS
6 * @license http://rem.mit-license.org/ MIT
7 */
8
9 namespace Hawk;
10
11 /**
12 * This class describes the behavior of inputs that value must be an integer
13 *
14 * @package Form\Input
15 */
16 class IntegerInput extends NumberInput{
17 /**
18 * The input pattern
19 *
20 * @var string
21 */
22 public $pattern = '/^[\-]?\d*$/';
23
24 /**
25 * Return the input value, formatted for the SQL database
26 *
27 * @return int The formatted value
28 */
29 public function dbvalue(){
30 return (int)($this->value);
31 }
32 }
33