Omnipay\Common\CreditCard::addSupportedBrand PHP Метод

addSupportedBrand() публичный Метод

Note: The fact that a particular card is known does not imply that your gateway supports it. Set $add_to_front to true if the key should be added to the front of the array
public addSupportedBrand ( string $name, string $expression ) : boolean
$name string The name of the new supported brand.
$expression string The regular expression to check if a card is supported.
Результат boolean success
    public function addSupportedBrand($name, $expression)
    {
        $known_brands = array_keys($this->supported_cards);
        if (in_array($name, $known_brands)) {
            return false;
        }
        $this->supported_cards[$name] = $expression;
        return true;
    }

Usage Example

Пример #1
0
 public function testCustomBrandWorks()
 {
     $this->card->addSupportedBrand('omniexpress', '/^9\\d{12}(\\d{3})?$/');
     $this->assertArrayHasKey('omniexpress', $this->card->getSupportedBrands());
     $this->card->setNumber('9111111111111110');
     $this->card->validate();
     $this->assertEquals('omniexpress', $this->card->getBrand());
 }
All Usage Examples Of Omnipay\Common\CreditCard::addSupportedBrand
CreditCard