File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ final class TIN
48
48
/**
49
49
* @var array<string, class-string>
50
50
*/
51
- private $ algorithms = [
51
+ private static $ algorithms = [
52
52
'AT ' => Austria::class,
53
53
'BE ' => Belgium::class,
54
54
'BG ' => Bulgaria::class,
@@ -109,6 +109,17 @@ public static function fromSlug(string $slug): TIN
109
109
return new self ($ slug );
110
110
}
111
111
112
+ public static function isCountrySupported (string $ countryCode ): bool
113
+ {
114
+ foreach (self ::$ algorithms as $ algorithm ) {
115
+ if (true === $ algorithm ::supports ($ countryCode )) {
116
+ return true ;
117
+ }
118
+ }
119
+
120
+ return false ;
121
+ }
122
+
112
123
public function isValid (bool $ strict = false ): bool
113
124
{
114
125
try {
@@ -125,7 +136,7 @@ public function isValid(bool $strict = false): bool
125
136
*/
126
137
private function getAlgorithm (string $ country , ?string $ tin = null ): CountryHandlerInterface
127
138
{
128
- foreach ($ this -> algorithms as $ algorithm ) {
139
+ foreach (self :: $ algorithms as $ algorithm ) {
129
140
if (true === $ algorithm ::supports ($ country )) {
130
141
$ handler = new $ algorithm ($ tin );
131
142
You can’t perform that action at this time.
0 commit comments