Skip to content

Commit

Permalink
Added flush method to reset payload data
Browse files Browse the repository at this point in the history
  • Loading branch information
shahburhan committed Feb 22, 2021
1 parent 966602f commit 512703b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shahburhan/payload-struct",
"description": "A simple utility to create payloads in an easy object oriented construct and transform it into different data structures viz. array, objects, string(json).",
"description": "A simple utility to create payloads in an easy object oriented construct",
"type": "library",
"license": "MIT",
"authors": [{
Expand Down
9 changes: 9 additions & 0 deletions src/PayloadStruct.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,13 @@ public function getObject()
{
return (object) $this->payload;
}
/**
* Reset Payload data
* @return self
*/
public function flush()
{
$this->payload = [];
return $this;
}
}

0 comments on commit 512703b

Please sign in to comment.