Пример #1
0
 /**
  *
  * Check the value format of every element in array
  * @param 		array		$inputArray Input Array with search elements
  * @return ErrorException
  */
 public static function isCorrectValueForInputElement($inputArray)
 {
     try {
         foreach ((array) $inputArray as $element => $value) {
             $format = GR4PHP_Template::checkFormatOfInputValue($element);
             switch ($format) {
                 case "integer":
                     if (!is_numeric($value)) {
                         throw new GR4PHP_Exception("Please check the format of the input value of the element <i>" . $element . "</i>. It should be <b>" . $format . "</b>");
                     }
                     break;
                 case "string":
                     if (!is_string($value)) {
                         throw new GR4PHP_Exception("Please check the format of the input value of the element <i>" . $element . "</i>. It should be <b>" . $format . "</b>");
                     }
                     break;
                 case NULL:
                     break;
             }
         }
     } catch (GR4PHP_Exception $e) {
         echo "<b>Error: " . $e->getMessage() . "</b>";
         exit;
     }
 }