/** * 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; }
/** * 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; }
/** * 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}'"); } }