Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LocalizedException.php
Go to the documentation of this file.
1 <?php
9 
12 
17 class LocalizedException extends \Exception
18 {
22  protected $phrase;
23 
27  protected $logMessage;
28 
34  public function __construct(Phrase $phrase, \Exception $cause = null, $code = 0)
35  {
36  $this->phrase = $phrase;
37  parent::__construct($phrase->render(), intval($code), $cause);
38  }
39 
45  public function getRawMessage()
46  {
47  return $this->phrase->getText();
48  }
49 
55  public function getParameters()
56  {
57  return $this->phrase->getArguments();
58  }
59 
65  public function getLogMessage()
66  {
67  if ($this->logMessage === null) {
68  $renderer = new Placeholder();
69  $this->logMessage = $renderer->render([$this->getRawMessage()], $this->getParameters());
70  }
71  return $this->logMessage;
72  }
73 }
__construct(Phrase $phrase, \Exception $cause=null, $code=0)
$code
Definition: info.phtml:12