DragonBe\Vies\Validator\ValidatorMT::validate PHP Method

validate() public method

public validate ( string $vatNumber ) : boolean
$vatNumber string
return boolean
    public function validate($vatNumber)
    {
        if (strlen($vatNumber) != 8) {
            return false;
        }
        if ((int) substr($vatNumber, 0, 6) <= 100000) {
            return false;
        }
        $weights = array(3, 4, 6, 7, 8, 9);
        $checksum = (int) substr($vatNumber, -2, 2);
        $checkval = $this->sumWeights($weights, $vatNumber);
        $checkval = intval(37 - $checkval % 37);
        if ($checkval != $checksum) {
            return false;
        }
        return true;
    }
ValidatorMT