Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PhraseFactory.php
Go to the documentation of this file.
1 <?php
7 
9 
15 {
24  public function create($mainMessage, $subMessages, $separator = '; ')
25  {
26  $renderedErrors = '';
27  $eol = '';
29  foreach ($subMessages as $subMessage) {
30  if ($subMessage instanceof MessageInterface) {
31  $phrase = new Phrase($subMessage->getText());
32  } else {
33  $phrase = new Phrase('Cannot render error message!');
34  }
35  $renderedErrors .= $eol . $phrase->render();
36  $eol = $separator;
37  }
38 
39  //$mainMessage should contain %1 to be substituted by concatenated errors
40  return new Phrase($mainMessage, [$renderedErrors]);
41  }
42 }