/** * Sanitize the card number . * * @param string $card * @return string|false */ public static function sanitize($card) { if (Master::isValid($card)) { return Master::sanitize($card); } elseif (Visa::isValid($card)) { return Visa::sanitize($card); } elseif (Amex::isValid($card)) { return Amex::sanitize($card); } return false; }
/** * @see \Tbs\Helper\CreditCard\Visa::mask() */ public function testUnMask() { $rs = Visa::unMask('1111 2222 3333 4444'); $this->assertInternalType('string', $rs); $this->assertEquals('1111222233334444', $rs); }
/** * @see \Tbs\Helper\CreditCard::sanitize() */ public function testSanitazeTagsVisaUnMasked() { $visa = '4556518283874759'; $rs = Card::sanitize($visa . '<script>alert("some content");</script>'); $this->assertEquals(Visa::mask($visa), $rs); }