Go to the documentation of this file.00001 <?php
00002
00007 class oxExceptionToDisplay implements oxIDisplayError
00008 {
00009
00015 private $_sMessage;
00016
00022 protected $_blDebug = false;
00023
00029 private $_sStackTrace;
00030
00036 private $_aValues;
00037
00043 private $_sType;
00044
00050 public function setStackTrace($sStackTrace)
00051 {
00052 $this->_sStackTrace = $sStackTrace;
00053 }
00054
00060 public function getStackTrace()
00061 {
00062 return $this->_sStackTrace;
00063 }
00064
00070 public function setValues($aValues)
00071 {
00072 $this->_aValues = $aValues;
00073 }
00074
00081 public function addValue($sName, $sValue)
00082 {
00083 $this->_aValues[$sName] = $sValue;
00084 }
00085
00091 public function setExceptionType($sType)
00092 {
00093 $this->_sType = $sType;
00094 }
00095
00101 public function getErrorClassType()
00102 {
00103 return $this->_sType;
00104 }
00105
00113 public function getValue($sName)
00114 {
00115 return $this->_aValues[$sName];
00116 }
00117
00123 public function setDebug($bl)
00124 {
00125 $this->_blDebug = $bl;
00126 }
00127
00133 public function setMessage($sMessage)
00134 {
00135 $this->_sMessage = $sMessage;
00136 }
00137
00142 public function setMessageArgs()
00143 {
00144 $this->_aMessageArgs = func_get_args();
00145 }
00146
00152 public function getOxMessage()
00153 {
00154 if ($this->_blDebug) {
00155 return $this;
00156 } else {
00157 $sString = oxRegistry::getLang()->translateString($this->_sMessage);
00158
00159 if (!empty($this->_aMessageArgs)) {
00160 $sString = vsprintf($sString, $this->_aMessageArgs);
00161 }
00162
00163 return $sString;
00164 }
00165 }
00166
00172 public function __toString()
00173 {
00174 $sRes = $this->getErrorClassType() . " (time: " . date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime()) . "): " . $this->getOxMessage() . " \n Stack Trace: " . $this->getStackTrace() . "\n";
00175 foreach ($this->_aValues as $key => $value) {
00176 $sRes .= $key . " => " . $value . "\n";
00177 }
00178
00179 return $sRes;
00180 }
00181 }