private function isValidRequirement($h5pData, $requirement, $library_name, $property_name) {
    $valid = TRUE;

    if (is_string($requirement)) {
      if ($requirement == 'boolean') {
        if (!is_bool($h5pData)) {
         $this->h5pF->setErrorMessage($this->h5pF->t("Invalid data provided for %property in %library. Boolean expected.", array('%property' => $property_name, '%library' => $library_name)));
         $valid = FALSE;
        }
      }
      else {
        // The requirement is a regexp, match it against the data
        if (is_string($h5pData) || is_int($h5pData)) {
          if (preg_match($requirement, $h5pData) === 0) {
             $this->h5pF->setErrorMessage($this->h5pF->t("Invalid data provided for %property in %library", array('%property' => $property_name, '%library' => $library_name)));
             $valid = FALSE;
          }
        }
        else {
          $this->h5pF->setErrorMessage($this->h5pF->t("Invalid data provided for %property in %library", array('%property' => $property_name, '%library' => $library_name)));
          $valid = FALSE;
        }
      }
    }
    elseif (is_array($requirement)) {
      // We have sub requirements
      if (is_array($h5pData)) {
        if (is_array(current($h5pData))) {
          foreach ($h5pData as $sub_h5pData) {
            $valid = $this->isValidRequiredH5pData($sub_h5pData, $requirement, $library_name) && $valid;
          }
        }
        else {
          $valid = $this->isValidRequiredH5pData($h5pData, $requirement, $library_name) && $valid;
        }
      }
      else {
        $this->h5pF->setErrorMessage($this->h5pF->t("Invalid data provided for %property in %library", array('%property' => $property_name, '%library' => $library_name)));
        $valid = FALSE;
      }
    }
    else {
      $this->h5pF->setErrorMessage($this->h5pF->t("Can't read the property %property in %library", array('%property' => $property_name, '%library' => $library_name)));
      $valid = FALSE;
    }
    return $valid;
  }
private function isValidRequirement($h5pData, $requirement, $library_name, $property_name) {
    $valid = TRUE;

    if (is_string($requirement)) {
      if ($requirement == 'boolean') {
        if (!is_bool($h5pData)) {
         $this->h5pF->setErrorMessage($this->h5pF->t("Invalid data provided for %property in %library. Boolean expected.", array('%property' => $property_name, '%library' => $library_name)));
         $valid = FALSE;
        }
      }
      else {
        // The requirement is a regexp, match it against the data
        if (is_string($h5pData) || is_int($h5pData)) {
          if (preg_match($requirement, $h5pData) === 0) {
             $this->h5pF->setErrorMessage($this->h5pF->t("Invalid data provided for %property in %library", array('%property' => $property_name, '%library' => $library_name)));
             $valid = FALSE;
          }
        }
        else {
          $this->h5pF->setErrorMessage($this->h5pF->t("Invalid data provided for %property in %library", array('%property' => $property_name, '%library' => $library_name)));
          $valid = FALSE;
        }
      }
    }
    elseif (is_array($requirement)) {
      // We have sub requirements
      if (is_array($h5pData)) {
        if (is_array(current($h5pData))) {
          foreach ($h5pData as $sub_h5pData) {
            $valid = $this->isValidRequiredH5pData($sub_h5pData, $requirement, $library_name) && $valid;
          }
        }
        else {
          $valid = $this->isValidRequiredH5pData($h5pData, $requirement, $library_name) && $valid;
        }
      }
      else {
        $this->h5pF->setErrorMessage($this->h5pF->t("Invalid data provided for %property in %library", array('%property' => $property_name, '%library' => $library_name)));
        $valid = FALSE;
      }
    }
    else {
      $this->h5pF->setErrorMessage($this->h5pF->t("Can't read the property %property in %library", array('%property' => $property_name, '%library' => $library_name)));
      $valid = FALSE;
    }
    return $valid;
  }
private function isValidRequirement ( $ h5pData , $ requirement , $ library_name , $ property_name ) { $ valid = TRUE ; if ( is_string ( $ requirement ) ) { if ( $ requirement == 'boolean' ) { if ( ! is_bool ( $ h5pData ) ) { $ this -> h5pF -> setErrorMessage ( $ this -> h5pF -> t ( "Invalid data provided for %property in %library. Boolean expected." , array ( '%property' => $ property_name , '%library' => $ library_name ) ) ) ; $ valid = FALSE ; } } else { // The requirement is a regexp, match it against the data if ( is_string ( $ h5pData ) || is_int ( $ h5pData ) ) { if ( preg_match ( $ requirement , $ h5pData ) === 0 ) { $ this -> h5pF -> setErrorMessage ( $ this -> h5pF -> t ( "Invalid data provided for %property in %library" , array ( '%property' => $ property_name , '%library' => $ library_name ) ) ) ; $ valid = FALSE ; } } else { $ this -> h5pF -> setErrorMessage ( $ this -> h5pF -> t ( "Invalid data provided for %property in %library" , array ( '%property' => $ property_name , '%library' => $ library_name ) ) ) ; $ valid = FALSE ; } } } elseif ( is_array ( $ requirement ) ) { // We have sub requirements if ( is_array ( $ h5pData ) ) { if ( is_array ( current ( $ h5pData ) ) ) { foreach ( $ h5pData as $ sub_h5pData ) { $ valid = $ this -> isValidRequiredH5pData ( $ sub_h5pData , $ requirement , $ library_name ) && $ valid ; } } else { $ valid = $ this -> isValidRequiredH5pData ( $ h5pData , $ requirement , $ library_name ) && $ valid ; } } else { $ this -> h5pF -> setErrorMessage ( $ this -> h5pF -> t ( "Invalid data provided for %property in %library" , array ( '%property' => $ property_name , '%library' => $ library_name ) ) ) ; $ valid = FALSE ; } } else { $ this -> h5pF -> setErrorMessage ( $ this -> h5pF -> t ( "Can't read the property %property in %library" , array ( '%property' => $ property_name , '%library' => $ library_name ) ) ) ; $ valid = FALSE ; } return $ valid ; }
Validate a requirement given as regexp or an array of requirements

@param mixed $h5pData
The data to be validated
@param mixed $requirement
The requirement the data is to be validated against, regexp or array of requirements
@param string $library_name
Name of the library we are validating(used in error messages)
@param string $property_name
Name of the property we are validating(used in error messages)
@return boolean
TRUE if valid, FALSE if invalid
Validate a requirement given as regexp or an array of requirements