+ wfDeprecated( __METHOD__ );
+ return $this->getErrorsOrWarnings( $errors, 'error' );
+ }
+
+ /**
+ * Returns a formatted list of errors or warnings from the given elements.
+ *
+ * @param string|array|Status $elements The set of errors/warnings to process.
+ * @param string $elementsType Should warnings or errors be returned. This is meant
+ * for Status objects, all other valid types are always considered as errors.
+ * @return string
+ */
+ public function getErrorsOrWarnings( $elements, $elementsType ) {
+ if ( !in_array( $elementsType, [ 'error', 'warning' ], true ) ) {
+ throw new DomainException( $elementsType . ' is not a valid type.' );
+ }
+ $elementstr = false;
+ if ( $elements instanceof Status ) {
+ list( $errorStatus, $warningStatus ) = $elements->splitByErrorType();
+ $status = $elementsType === 'error' ? $errorStatus : $warningStatus;
+ if ( $status->isGood() ) {
+ $elementstr = '';