Why Nostr? What is Njump?
2025-05-22 22:06:18

Schrank :shopware: 🐘 (er/ihm) on Nostr: Is this a design pattern and if yes, how it is called? interface AddressValidator { ...

Is this a design pattern and if yes, how it is called?

interface AddressValidator {
isSupported(string $country): bool;
validateAddress(Address $a): Address
}

class GermanValidator implements AddressValidator {}
class FranceValidator implements AddressValidator {}

class MetaValidator implements AddressValidator {
__construct(AddressValidator ...$validator)
// run through the validator and find one for the address -> country and use it.
}

First we use GermanValidator, but later we use Meta.
Author Public Key
npub1q66fpdcl8tcfdymqhh05zcgvyjdq7cj6xl6vj92tfyajecr8ucus0fawz6