Skip to content

Commit

Permalink
Add merge method
Browse files Browse the repository at this point in the history
  • Loading branch information
abellion committed May 20, 2017
1 parent 0d76ac5 commit 7ca4282
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public function has(string $offset)
return isset($this->document[$offset]);
}

public function merge(array $document)
{
return self::fillFromSetter($document);
}

public function toArray()
{
return $this->document;
Expand Down Expand Up @@ -84,12 +89,16 @@ public function fill(array $document)
foreach ($document as $offset => $value) {
self::set($offset, $value);
}

return $this;
}

public function fillFromSetter(array $document)
{
foreach ($document as $offset => $value) {
self::setFromSetter($offset, $value);
}

return $this;
}
}

0 comments on commit 7ca4282

Please sign in to comment.