21 lines
530 B
PHP
21 lines
530 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Phred\Http\Contracts;
|
|
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
|
|
interface ErrorFormatNegotiatorInterface
|
|
{
|
|
/**
|
|
* Determine desired API format based on the request (e.g., Accept header).
|
|
* Should return 'rest', 'jsonapi', or 'xml'.
|
|
*/
|
|
public function apiFormat(ServerRequestInterface $request): string;
|
|
|
|
/**
|
|
* Determine if the client prefers an HTML error representation.
|
|
*/
|
|
public function wantsHtml(ServerRequestInterface $request): bool;
|
|
}
|