コード例 #1
0
 /**
  * Returns an instance of ValidatorSettings.
  *
  * @since 0.5
  *
  * @return ValidatorSettings
  */
 public static function singleton()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
 /**
  * Returns an array containing the parameter info.
  * @see ParserHook::getParameterInfo
  * 
  * @since 0.4
  * 
  * @return array of Parameter
  */
 protected function getParameterInfo($type)
 {
     global $egValidatorErrListMin;
     $params = array();
     $params['minseverity'] = new Parameter('minseverity');
     $params['minseverity']->setDefault(ValidatorSettings::get('errorListMinSeverity'));
     $params['minseverity']->addCriteria(new CriterionInArray(array_keys(self::$severityMap)));
     $params['minseverity']->setDescription(wfMsg('validator-listerrors-par-minseverity'));
     return $params;
 }
コード例 #3
0
ファイル: ValidationError.php プロジェクト: Tjorriemorrie/app
 /**
  * Returns the action associated with the errors severity.
  *
  * @since 0.4
  *
  * @return integer Element of the ValidationError::ACTION_ enum
  */
 public function getAction()
 {
     $errorActions = ValidatorSettings::get('errorActions');
     if ($this->severity === self::SEVERITY_FATAL) {
         // This action should not be configurable, as lowering it would break in the Validator class.
         return self::ACTION_DEMAND;
     } elseif (array_key_exists($this->severity, $errorActions)) {
         return $errorActions[$this->severity];
     } else {
         throw new Exception("No action associated with error severity '{$this->severity}'");
     }
 }