| 1 | <?php |
||
| 15 | abstract class ResponseDecorator implements ResponseFactory |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * The factory being decorated. |
||
| 19 | * |
||
| 20 | * @var \Flugg\Responder\Contracts\ResponseFactory |
||
| 21 | */ |
||
| 22 | protected $factory; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Construct the decorator class. |
||
| 26 | * |
||
| 27 | * @param \Flugg\Responder\Contracts\ResponseFactory $factory |
||
| 28 | */ |
||
| 29 | 59 | public function __construct(ResponseFactory $factory) |
|
| 30 | { |
||
| 31 | 59 | $this->factory = $factory; |
|
| 32 | 59 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * Generate a JSON response. |
||
| 36 | * |
||
| 37 | * @param array $data |
||
| 38 | * @param int $status |
||
| 39 | * @param array $headers |
||
| 40 | * @return \Illuminate\Http\JsonResponse |
||
| 41 | */ |
||
| 42 | abstract public function make(array $data, int $status, array $headers = []): JsonResponse; |
||
| 43 | } |
||
| 44 |