<?php

namespace ModulesGarden\HostingQuotaNotifications\App\UI\Validators;
use \ModulesGarden\HostingQuotaNotifications\Core\UI\Widget\Forms\Validators\BaseValidator;
use \ModulesGarden\HostingQuotaNotifications\App\Models\Groups;
use \ModulesGarden\HostingQuotaNotifications\App\Helper;

/**
 * PositiveNumber form data validator
 *
 * @author Artur Pilch <artur.pi@modulesgarden.com>
 */
class PositiveNumber extends BaseValidator
{
    protected function validate($data, $additionalData = null)
    {

        if(!is_numeric($data) || strpos( $data, "." ) !== false || $data < 1)
        {
            $this->addValidationError('positiveIntegerValue');
            return false;
        }
        return true;
    }
}
