Skip to content

Commit b225c52

Browse files
committed
update reset method
1 parent 72128f1 commit b225c52

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Jsonq.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,22 @@ public function exists()
151151
* reset given data to the $_map
152152
*
153153
* @param mixed $data
154+
* @param bool $instance
154155
* @return jsonq
155156
*/
156-
public function reset($data = null)
157+
public function reset($data = null, $instance = false)
157158
{
158159
if (!is_null($data)) {
159160
$this->_baseContents = $data;
160161
}
161162

163+
if ($instance) {
164+
$self = new self();
165+
$self->collect($this->_baseContents);
166+
167+
return $self;
168+
}
169+
162170
$this->_map = $this->_baseContents;
163171
$this->reProcess();
164172

0 commit comments

Comments
 (0)