_data = json_decode($data); return $req; } public static function create() { $req = new ProfileRequest(); $req->_id = uniqid(); return $req; } private function __construct() { $this->_data = ['log' => []]; } public function toArray() { return $this->_data; } public function toString() { return json_encode($this->_data); } public function getId() { return $this->_id; } public function after($request, $response) { $this->_data['queries'] = DB::getQueryLog(); } public function log($level, $message, $context) { $this->_data['log'][] = [ 'level' => $level, 'message' => $message ]; } }