<?php
/**
 * Created by PhpStorm.
 * User: billy
 * Date: 11/02/2017
 * Time: 4:19 PM
 */

namespace App\Modules\Validators;

class OtaVersionFormatValidator
{
    public function validate($attribute, $value, $params, $validator){
        //return true if field value is foo

        $values = explode('.', $value);

        if (count($values) != 4)
        {
            return false;
        }

        foreach ($values as $tempValue)
        {
            if (!is_integer(intval($tempValue))){
                return false;
            }
        }

        return true;
    }
}