import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -68,6 +68,15 @@ class Zend_Wildfire_Plugin_FirePhp_Message
|
||||
*/
|
||||
protected $_ruid = false;
|
||||
|
||||
/**
|
||||
* Options for the object
|
||||
* @var array
|
||||
*/
|
||||
protected $_options = array(
|
||||
'traceOffset' => null, /* The offset in the trace which identifies the source of the message */
|
||||
'includeLineNumbers' => null /* Whether to include line and file info for this message */
|
||||
);
|
||||
|
||||
/**
|
||||
* Creates a new message with the given style and message
|
||||
*
|
||||
@ -191,5 +200,46 @@ class Zend_Wildfire_Plugin_FirePhp_Message
|
||||
{
|
||||
return $this->_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a single option
|
||||
*
|
||||
* @param string $key The name of the option
|
||||
* @param mixed $value The value of the option
|
||||
* @return mixed The previous value of the option
|
||||
*/
|
||||
public function setOption($key, $value)
|
||||
{
|
||||
if(!array_key_exists($key,$this->_options)) {
|
||||
throw new Zend_Wildfire_Exception('Option with name "'.$key.'" does not exist!');
|
||||
}
|
||||
$previous = $this->_options[$key];
|
||||
$this->_options[$key] = $value;
|
||||
return $previous;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a single option
|
||||
*
|
||||
* @param string $key The name of the option
|
||||
* @return mixed The value of the option
|
||||
*/
|
||||
public function getOption($key)
|
||||
{
|
||||
if(!array_key_exists($key,$this->_options)) {
|
||||
throw new Zend_Wildfire_Exception('Option with name "'.$key.'" does not exist!');
|
||||
}
|
||||
return $this->_options[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all options
|
||||
*
|
||||
* @return array All options
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->_options;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,9 +90,75 @@ class Zend_Wildfire_Plugin_FirePhp_TableMessage extends Zend_Wildfire_Plugin_Fir
|
||||
public function getMessage()
|
||||
{
|
||||
$table = $this->_rows;
|
||||
array_unshift($table,$this->_header);
|
||||
if($this->_header) {
|
||||
array_unshift($table,$this->_header);
|
||||
}
|
||||
return $table;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns the row at the given index
|
||||
*
|
||||
* @param integer $index The index of the row
|
||||
* @return array Returns the row
|
||||
* @throws Zend_Wildfire_Exception
|
||||
*/
|
||||
public function getRowAt($index)
|
||||
{
|
||||
$count = $this->getRowCount();
|
||||
|
||||
if($index < 0 || $index > $count-1) {
|
||||
require_once 'Zend/Wildfire/Exception.php';
|
||||
throw new Zend_Wildfire_Exception('Row index('.$index.') out of bounds('.$count.')!');
|
||||
}
|
||||
|
||||
return $this->_rows[$index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the row on the given index to a new row
|
||||
*
|
||||
* @param integer $index The index of the row
|
||||
* @param array $row The new data for the row
|
||||
* @throws Zend_Wildfire_Exception
|
||||
*/
|
||||
public function setRowAt($index, $row)
|
||||
{
|
||||
$count = $this->getRowCount();
|
||||
|
||||
if($index < 0 || $index > $count-1) {
|
||||
require_once 'Zend/Wildfire/Exception.php';
|
||||
throw new Zend_Wildfire_Exception('Row index('.$index.') out of bounds('.$count.')!');
|
||||
}
|
||||
|
||||
$this->_rows[$index] = $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getRowCount()
|
||||
{
|
||||
return count($this->_rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last row of the table
|
||||
*
|
||||
* @return array Returns the last row
|
||||
* @throws Zend_Wildfire_Exception
|
||||
*/
|
||||
public function getLastRow()
|
||||
{
|
||||
$count = $this->getRowCount();
|
||||
|
||||
if($count==0) {
|
||||
require_once 'Zend/Wildfire/Exception.php';
|
||||
throw new Zend_Wildfire_Exception('Cannot get last row as no rows exist!');
|
||||
}
|
||||
|
||||
return $this->_rows[$count-1];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user