示例#1
0
 /**
  * Validates the specified phone number by checking the format of the phone number.  
  * The expected format is the following: 0-000-000-0000 or 000-000-0000.
  *
  * @param string $phone the phone number to validate.
  *
  * @returns true if the specified phone number is valid.
  */
 public static function isValidFormattedPhone($phone)
 {
     if (ValidationUtil::isNullOrEmpty($phone)) {
         return false;
     }
     return ereg('^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$', $phone);
 }
示例#2
0
 /**
  * Generic function to validate an object.
  *
  * @return boolean indicating whether validation has passed or failed.
  */
 public function validate()
 {
     if (!$this->_objValidation) {
         return true;
     }
     if (!$this->_objData) {
         return false;
     }
     $res = $this->validatePreProcess();
     if ($res) {
         $res = $res && ValidationUtil::validateObjectPlain($this->_objPath, $this->_objData, $this->_objValidation);
         if ($res) {
             $res = $res && $this->validatePostProcess();
         }
     }
     return $res;
 }
示例#3
0
 public function free()
 {
     self::$_instance = null;
 }