OXID eShop CE  4.10.7
 All Classes Namespaces Files Functions Variables Pages
oxexceptiontodisplay.php
Go to the documentation of this file.
1 <?php
2 
8 {
9 
15  private $_sMessage;
16 
22  protected $_blDebug = false;
23 
29  private $_sStackTrace;
30 
36  private $_aValues;
37 
43  private $_sType;
44 
50  public function setStackTrace($sStackTrace)
51  {
52  $this->_sStackTrace = $sStackTrace;
53  }
54 
60  public function getStackTrace()
61  {
62  return $this->_sStackTrace;
63  }
64 
70  public function setValues($aValues)
71  {
72  $this->_aValues = $aValues;
73  }
74 
81  public function addValue($sName, $sValue)
82  {
83  $this->_aValues[$sName] = $sValue;
84  }
85 
91  public function setExceptionType($sType)
92  {
93  $this->_sType = $sType;
94  }
95 
101  public function getErrorClassType()
102  {
103  return $this->_sType;
104  }
105 
113  public function getValue($sName)
114  {
115  return $this->_aValues[$sName];
116  }
117 
123  public function setDebug($bl)
124  {
125  $this->_blDebug = $bl;
126  }
127 
133  public function setMessage($sMessage)
134  {
135  $this->_sMessage = $sMessage;
136  }
137 
142  public function setMessageArgs()
143  {
144  $this->_aMessageArgs = func_get_args();
145  }
146 
152  public function getOxMessage()
153  {
154  if ($this->_blDebug) {
155  return $this;
156  } else {
157  $sString = oxRegistry::getLang()->translateString($this->_sMessage);
158 
159  if (!empty($this->_aMessageArgs)) {
160  $sString = vsprintf($sString, $this->_aMessageArgs);
161  }
162 
163  return $sString;
164  }
165  }
166 
172  public function __toString()
173  {
174  $sRes = $this->getErrorClassType() . " (time: " . date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime()) . "): " . $this->getOxMessage() . " \n Stack Trace: " . $this->getStackTrace() . "\n";
175  foreach ($this->_aValues as $key => $value) {
176  $sRes .= $key . " => " . $value . "\n";
177  }
178 
179  return $sRes;
180  }
181 }