21 lines
522 B
PHP
21 lines
522 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' or 'jsonapi'.
|
||
|
|
*/
|
||
|
|
public function apiFormat(ServerRequestInterface $request): string;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Determine if the client prefers an HTML error representation.
|
||
|
|
*/
|
||
|
|
public function wantsHtml(ServerRequestInterface $request): bool;
|
||
|
|
}
|