Exemple #1
0
 /**
  * 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;
 }
Exemple #2
0
 /**
  * @see \Tbs\Helper\CreditCard\Master::mask()
  */
 public function testUnMask()
 {
     $rs = Master::unMask('1111 2222 3333 4444');
     $this->assertInternalType('string', $rs);
     $this->assertEquals('1111222233334444', $rs);
 }
 /**
  * @see \Tbs\Helper\CreditCard::sanitize()
  */
 public function testSanitazeTagsMasterUnMasked()
 {
     $master = '5444360512159683';
     $rs = Card::sanitize($master . '<script>alert("some content");</script>');
     $this->assertEquals(Master::mask($master), $rs);
 }