vatNr = str_replace($isoCode, '', $vatNr); $this->isoCode = $isoCode; } public function checkAndStore() { try { $euVatValidator = new Validator(new Europa, $this->vatNr, $this->isoCode); } catch(Exception $e){ return false; } if( $euVatValidator instanceof Validator ){ $fullVat = $this->isoCode.$this->vatNr; $vatCache = VatCache::getOrCreateByVat($fullVat); $vatCache->vat_nr = $fullVat; $vatCache->valid = $euVatValidator->check(); $vatCache->save(); } return true; } }