New onsite patient portal, take 4.
[openemr.git] / portal / patient / fwk / libs / savant / Savant3 / Error.php
blobea6634a2e4326cd53c24d5d27fd3395f69ba2e56
1 <?php
3 /**
4 *
5 * Provides a simple error class for Savant.
7 * @package Savant3
8 *
9 * @author Paul M. Jones <pmjones@ciaweb.net>
11 * @license http://www.gnu.org/copyleft/lesser.html LGPL
13 * @version $Id: Error.php,v 1.5 2005/05/27 14:03:50 pmjones Exp $
17 /**
19 * Provides a simple error class for Savant.
21 * @package Savant3
23 * @author Paul M. Jones <pmjones@ciaweb.net>
27 class Savant3_Error {
29 /**
31 * The error code, typically a Savant 'ERR_*' string.
33 * @access public
35 * @var string
38 public $code = null;
40 /**
42 * An array of error-specific information.
44 * @access public
46 * @var array
49 public $info = array ();
51 /**
53 * The error severity level.
55 * @access public
57 * @var int
60 public $level = E_USER_ERROR;
62 /**
64 * A debug backtrace for the error, if any.
66 * @access public
68 * @var array
71 public $trace = null;
73 /**
75 * Constructor.
77 * @access public
79 * @param array $conf
80 * An associative array where the key is a
81 * Savant3_Error property and the value is the value for that
82 * property.
85 public function __construct($conf = array()) {
86 // set public properties
87 foreach ( $conf as $key => $val ) {
88 $this->$key = $val;
91 // add a backtrace
92 if ($conf ['trace'] === true) {
93 $this->trace = debug_backtrace ();
97 /**
99 * Magic method for output dump.
101 * @access public
103 * @return void
105 public function __toString() {
106 ob_start ();
107 echo get_class ( $this ) . ': ';
108 print_r ( get_object_vars ( $this ) );
109 return ob_get_clean ();