failureMessage = $failureMessage; $this->paramName = $name; $this->paramValue = $value; $this->settings = $settings; // Parent class needs some static English message. $msg = "Validation of `$name` failed: " . $failureMessage->getCode(); $data = $failureMessage->getData(); if ( $data ) { $msg .= ' ' . json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); } parent::__construct( $msg, 0, $previous ); } /** * Fetch the validation failure message * * Users are encouraged to use this with an appropriate message formatter rather * than relying on the limited English text returned by getMessage(). * * @return DataMessageValue */ public function getFailureMessage() { return $this->failureMessage; } /** * Fetch the parameter name that failed validation * @return string */ public function getParamName() { return $this->paramName; } /** * Fetch the parameter value that failed validation * @return mixed */ public function getParamValue() { return $this->paramValue; } /** * Fetch the settings array that failed validation * @return array */ public function getSettings() { return $this->settings; } }