for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Bluz Framework Component
*
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/framework
*/
declare(strict_types=1);
namespace Bluz\Response;
* Response Trait
* @package Bluz\Response
* @author Anton Shevchuk
trait ResponseTrait
{
* @return string
abstract public function jsonSerialize();
abstract public function __toString();
* Render object as HTML or JSON
* @param string $type
public function render($type = 'HTML') : string
// switch statement by response type
switch (strtoupper($type)) {
case 'CLI':
case 'JSON':
return $this->jsonSerialize();
case 'HTML':
default:
return $this->__toString();
}