mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Make all descendents of BaseObject compatible with var_export()
This commit is contained in:
parent
e527269633
commit
67047c0939
1 changed files with 16 additions and 0 deletions
|
|
@ -45,6 +45,22 @@ class BaseObject
|
|||
$this->setError($error);
|
||||
$this->setMessage($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set state for var_export()
|
||||
*
|
||||
* @param array $vars
|
||||
* @return object
|
||||
*/
|
||||
public static function __set_state(array $vars)
|
||||
{
|
||||
$instance = new static;
|
||||
foreach ($vars as $key => $val)
|
||||
{
|
||||
$instance->{$key} = $val;
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter to set error code or message
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue