@@ -75,37 +75,35 @@ public function __construct(
7575 * Add Error Messages for Import
7676 *
7777 * @param ProcessingErrorAggregatorInterface $errorAggregator
78- * @return string|void
78+ * @return string
7979 */
8080 public function renderMessages (
8181 ProcessingErrorAggregatorInterface $ errorAggregator
82- ) {
83- if ($ errorAggregator ->getErrorsCount ()) {
84- $ message = '' ;
85- $ counter = 0 ;
86- $ escapedMessages = [];
87- foreach ($ this ->getErrorMessages ($ errorAggregator ) as $ error ) {
88- $ escapedMessages [] = (++$ counter ) . '. ' . $ this ->escaper ->escapeHtml ($ error );
89- if ($ counter >= ImportResult::LIMIT_ERRORS_MESSAGE ) {
90- break ;
91- }
82+ ): string {
83+ $ message = '' ;
84+ $ counter = 0 ;
85+ $ escapedMessages = [];
86+ foreach ($ this ->getErrorMessages ($ errorAggregator ) as $ error ) {
87+ $ escapedMessages [] = (++$ counter ) . '. ' . $ this ->escaper ->escapeHtml ($ error );
88+ if ($ counter >= ImportResult::LIMIT_ERRORS_MESSAGE ) {
89+ break ;
9290 }
93- if ( $ errorAggregator -> hasFatalExceptions ()) {
94- foreach ( $ this -> getSystemExceptions ( $ errorAggregator ) as $ error ) {
95- $ escapedMessages [] = $ this ->escaper -> escapeHtml ( $ error-> getErrorMessage ())
96- . ' <a href="#" onclick="$( this).next().show();$(this).hide();return false;"> '
97- . __ ( ' Show more ' ) . ' </a><div style="display:none;"> ' . __ ( ' Additional data ' ) . ' : '
98- . $ this -> escaper -> escapeHtml ( $ error -> getErrorDescription ()) . '</div> ' ;
99- }
91+ }
92+ if ( $ errorAggregator -> hasFatalExceptions () ) {
93+ foreach ( $ this ->getSystemExceptions ( $ errorAggregator ) as $ error) {
94+ $ escapedMessages [] = $ this -> escaper -> escapeHtml ( $ error -> getErrorMessage ())
95+ . ' <a href="#" onclick="$(this).next().show();$(this).hide();return false;"> '
96+ . __ ( ' Show more ' ) . ' </a><div style="display:none;"> ' . __ ( ' Additional data ' ) . ': '
97+ . $ this -> escaper -> escapeHtml ( $ error -> getErrorDescription ()) . ' </div> ' ;
10098 }
101- $ message .= implode ('<br> ' , $ escapedMessages );
102- return '<strong> ' . __ ('Following Error(s) has been occurred during importing process: ' ) . '</strong><br> '
103- . '<div class="import-error-wrapper"> ' . __ ('Only the first 100 errors are shown. ' )
104- . '<a href=" '
105- . $ this ->createDownloadUrlImportHistoryFile ($ this ->createErrorReport ($ errorAggregator ))
106- . '"> ' . __ ('Download full report ' ) . '</a><br> '
107- . '<div class="import-error-list"> ' . $ message . '</div></div> ' ;
10899 }
100+ $ message .= implode ('<br> ' , $ escapedMessages );
101+ return '<strong> ' . __ ('Following Error(s) has been occurred during importing process: ' ) . '</strong><br> '
102+ . '<div class="import-error-wrapper"> ' . __ ('Only the first 100 errors are shown. ' )
103+ . '<a href=" '
104+ . $ this ->createDownloadUrlImportHistoryFile ($ this ->createErrorReport ($ errorAggregator ))
105+ . '"> ' . __ ('Download full report ' ) . '</a><br> '
106+ . '<div class="import-error-list"> ' . $ message . '</div></div> ' ;
109107 }
110108
111109 /**
0 commit comments