adbario / php-dot-notation

Dot notation access to PHP arrays

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add __set_state() for var_export() support

mattsah opened this issue · comments

Using var export to export executable PHP into a cache file is good for performance, especially if the collection is being packed with lots of data from lots of config files. I'd like to be able to export the whole collection and restore... should be as simple as:

static public function __set_state($data)
{
    return new static($data['items']);
}

Good idea, you can make the pull request with this code to get credit for it! 👍