summaryrefslogtreecommitdiff
path: root/libs/SimpleValidator/Validators/GreaterThan.php
blob: 6e5603199887a56e13982e7bbebd1c10adb47cca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

namespace SimpleValidator\Validators;

class GreaterThan extends Base
{
    private $min;

    public function __construct($field, $error_message, $min)
    {
        parent::__construct($field, $error_message);
        $this->min = $min;
    }

    public function execute(array $data)
    {
        if ($this->isFieldNotEmpty($data)) {
            return $data[$this->field] > $this->min;
        }

        return true;
    }
}