loophp/tin

Add this new function to TIN.php

ortegafernando opened this issue · 4 comments

Hello, as we can not catch the invalidCountry exception exclusively, I think this function will be good to detect is the TIN's country BEFORE using check function.

    public function hasAlgorithm(): bool
    {
        $parsedTin = $this->parse($this->slug, false);
        foreach ($this->algorithms as $algorithm) {
            if (true === $algorithm::supports($parsedTin['country'])) {
                return true;
            }
        }
        return false;
    }

I can make a PULL REQUEST if you want.

Hi, what about last PR ?

Hi,

Sorry, I'm a bit overwhelmed with work lately...

How about adding just Tin::isSupported():bool ?

Feel free to provide the PR.

Solved by #46, correct? :)

yes, thank you !