Example #1
0
 public function testIsCCNum()
 {
     $this->assertTrue(Zend_Filter::isCcnum('4929000000006'), '"4929000000006" is a valid Visa cc num.');
     $this->assertTrue(Zend_Filter::isCcnum('5404000000000001'), '"5404000000000001" is a valid Mastercard cc num.');
     $this->assertTrue(Zend_Filter::isCcnum('374200000000004'), '"374200000000004" is a valid Amex cc num.');
     $this->assertFalse(Zend_Filter::isCcnum('4444555566667777'), '"4444555566667777" is not a valid cc num.');
     $this->assertFalse(Zend_Filter::isCcnum('ABCDEF'), '"ABCDEF" is not a valid cc num.');
 }
Example #2
0
 /**
  * Returns value if it is a valid credit card number format. The
  * optional second argument allows developers to indicate the
  * type.
  *
  * @param mixed $key
  * @param mixed $type
  * @return mixed
  */
 public function testCcnum($key, $type = NULL)
 {
     if (!$this->keyExists($key)) {
         return false;
     }
     if (Zend_Filter::isCcnum($this->_source[$key], $type)) {
         return $this->_source[$key];
     }
     return FALSE;
 }
Example #3
0
 /**
  * Returns value if it is a valid credit card number format. The
  * optional second argument allows developers to indicate the
  * type.
  *
  * @param mixed $key
  * @param mixed $type
  * @return mixed
  */
 public function testCcnum($key = null, $type = NULL)
 {
     if (!($value = $this->keyExists($key))) {
         return false;
     }
     if (Zend_Filter::isCcnum($value, $type)) {
         return $value;
     }
     return FALSE;
 }
Example #4
0
 /**
  * Returns value if it is a valid credit card number format. The
  * optional second argument allows developers to indicate the
  * type.
  *
  * @param mixed $key
  * @param mixed $type
  * @return mixed
  */
 public function isCcnum($key, $type = NULL)
 {
     return Zend_Filter::isCcnum($this->_source[$key], $type);
 }
Example #5
0
 /**
  * Returns value if it is a valid credit card number format. The
  * optional second argument allows developers to indicate the
  * type.
  *
  * @deprecated since 0.8.0
  * @param      mixed $key
  * @return     mixed
  */
 public function testCcnum($key)
 {
     if (!$this->keyExists($key)) {
         return false;
     }
     if (Zend_Filter::isCcnum($this->_source[$key])) {
         return $this->_source[$key];
     }
     return false;
 }