00001 <?php 00002 00007 class oxExceptionToDisplay implements oxIDisplayError 00008 { 00014 private $_sMessage; 00015 00021 protected $_blDebug = false; 00022 00028 private $_sStackTrace; 00029 00035 private $_aValues; 00036 00042 private $_sType; 00043 00051 public function setStackTrace($sStackTrace) 00052 { 00053 $this->_sStackTrace = $sStackTrace; 00054 } 00055 00061 public function getStackTrace() 00062 { 00063 return $this->_sStackTrace; 00064 } 00065 00073 public function setValues( $aValues ) 00074 { 00075 $this->_aValues = $aValues; 00076 } 00077 00086 public function addValue( $sName, $sValue ) 00087 { 00088 $this->_aValues[$sName] = $sValue; 00089 } 00090 00098 public function setExceptionType( $sType ) 00099 { 00100 $this->_sType = $sType; 00101 } 00102 00108 public function getErrorClassType() 00109 { 00110 return $this->_sType; 00111 } 00112 00120 public function getValue( $sName ) 00121 { 00122 return $this->_aValues[$sName]; 00123 } 00124 00132 public function setDebug( $bl ) 00133 { 00134 $this->_blDebug = $bl; 00135 } 00136 00144 public function setMessage($sMessage) 00145 { 00146 $this->_sMessage = $sMessage; 00147 } 00148 00154 public function getOxMessage() 00155 { 00156 return $this->_blDebug ? $this : oxLang::getInstance()->translateString($this->_sMessage); 00157 } 00158 00164 public function __toString() 00165 { 00166 $sRes = $this->getErrorClassType() . " (time: " . date('Y-m-d H:i:s', oxUtilsDate::getInstance()->getTime()) . "): " . $this->getOxMessage() . " \n Stack Trace: " . $this->getStackTrace() . "\n"; 00167 foreach ( $this->_aValues as $key => $value ) { 00168 $sRes .= $key. " => ". $value . "\n"; 00169 } 00170 return $sRes; 00171 } 00172 }