Added __toString() methods

This commit is contained in:
Cédric Belin
2018-11-20 22:11:22 +01:00
parent 643f8961d4
commit 2a68265df7
9 changed files with 81 additions and 0 deletions

View File

@ -55,6 +55,15 @@ class PayloadCommit implements \JsonSerializable {
$this->setMessage($message);
}
/**
* Returns a string representation of this object.
* @return string The string representation of this object.
*/
function __toString(): string {
$json = json_encode($this, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
return static::class." $json";
}
/**
* Creates a new commit from the specified JSON map.
* @param object $map A JSON map representing a commit.