DragonBe\Vies\Validator\ValidatorSI::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 (intval($vatNumber[0]) == 0) {
            return false;
        }
        $checksum = (int) $vatNumber[7];
        $weights = array(8, 7, 6, 5, 4, 3, 2);
        $checkval = $this->sumWeights($weights, $vatNumber);
        $checkval = $checkval % 11 == 10 ? 0 : 11 - $checkval % 11;
        if ($checksum != $checkval) {
            return false;
        }
        return true;
    }
ValidatorSI