Example #1
0
 /**
  * Returns value if it is a valid phone number format, FALSE
  * otherwise. The optional second argument indicates the country.
  *
  * @param mixed $key
  * @return mixed
  */
 public function testPhone($key, $country = 'US')
 {
     if (!$this->keyExists($key)) {
         return false;
     }
     if (Zend_Filter::isPhone($this->_source[$key], $country)) {
         return $this->_source[$key];
     }
     return FALSE;
 }
Example #2
0
 /**
  * Returns value if it is a valid phone number format, FALSE
  * otherwise. The optional second argument indicates the country.
  *
  * @param mixed $key
  * @return mixed
  */
 public function isPhone($key, $country = 'US')
 {
     return Zend_Filter::isPhone($this->_source[$key], $country);
 }
Example #3
0
 public function testisPhone()
 {
     $this->assertTrue(Zend_Filter::isPhone('6134123456'), '"6134123456" is a US Phone number');
     $this->assertFalse(Zend_Filter::isPhone('1004123456'), '"100123456" is not a valid US Phone number');
 }
Example #4
0
 /**
  * Returns value if it is a valid phone number format, FALSE
  * otherwise. The optional second argument indicates the country.
  *
  * @param mixed $key
  * @return mixed
  */
 public function testPhone($key = null, $country = 'US')
 {
     if (!($value = $this->keyExists($key))) {
         return false;
     }
     if (Zend_Filter::isPhone($value, $country)) {
         return $value;
     }
     return FALSE;
 }