public function createResponse(ApiProblem $apiProblem) { $response = new Response('php://memory', $apiProblem->getDetail('status'), ['Content-Type' => 'application/problem+json']); $json = Json::toJson($apiProblem); $response->getBody()->write($json); return $response; }
public function __toString() { $pattern = "ApiProblem exception '%s' with content '%s' in %s:%d\nStack trace:\n%s\nPrevious: %s"; return vsprintf($pattern, [__CLASS__, Json::toJson($this->apiProblem), $this->getFile(), $this->getLine(), $this->getTraceAsString(), $this->getPrevious()]); }