J-CORE Wiki
Brought to you by:
longstone
the error object takes (up to) 3 values in the constructor arguments array: code, message, data.
When calling the "getError" method will return an array consisting of the arguments and their set values. calling "getError" with $args["obj"] = TRUE; (boolean) will return an object with the named values as used in the constructor.
$args = array(); $args["code"] = 'the code'; //code message data $args["message"] = 'the message'; $args["data"] = 'the data'; $ERROR = new ERROR($args); echo '@'.__LINE__.':ERROR1<pre>'.var_export($ERROR1, true).'</pre><br>'; unset($args); $args = null; $ERROR1 = $ERROR->getError($args); echo '@'.__LINE__.':ERROR1<pre>'.var_export($ERROR1, true).'</pre><br>';
array ( 'code' => 'the code', 'message' => 'the message', 'data' => 'the data', ); $args = array(); $args["obj"] = TRUE; $ERROR2 = $ERROR->getError($args); echo '@'.__LINE__.':ERROR2<pre>'.var_export($ERROR2, true).'</pre><br>';
stdClass :: _set_state(array( 'code' => 'the code', 'message' => 'the message', 'data' => 'the data', ));
Anonymous