Minor cleanups

This commit is contained in:
Eldad Fux committed 2020-10-31 10:42:41 +02:00
1 parent 10c4b093d2
commit 1e1e1a431f
9 files changed
+262 -241

No files matched your search

+26
View File
@@ -215,14 +215,40 @@ class Response extends SwooleResponse
/**
* Validate response objects and outputs
* the response according to given format type
*
* @param Document $document
* @param string $model
*
* return void
*/
public function dynamic(Document $document, string $model)
{
return $this->json($this->output($document, $model));
}
/**
* (Mocking method for avoiding IDE errors, remove when possible)
*
* Set status code
*
* Set HTTP response status code between available options. if status code is unknown an exception will be thrown
*
* @param int $code
* @return self
* @throws Exception
*/
public function setStatusCode(int $code = 200): self
{
return $this->setStatusCode($code);
}
/**
* Generate valid response object from document data
*
* @param Document $document
* @param string $model
*
* return array
*/
public function output(Document $document, string $model): array
{