| 1 | <?php declare(strict_types=1); | ||
| 7 | abstract class AbstractStrategy implements StrategyInterface | ||
| 8 | { | ||
| 9 | /** @var array */ | ||
| 10 | protected $defaultResponseHeaders = []; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * Get current default response headers | ||
| 14 | * | ||
| 15 | * @return array | ||
| 16 | */ | ||
| 17 | public function getDefaultResponseHeaders() : array | ||
| 21 | |||
| 22 | /** | ||
| 23 | * Add or replace a default response header | ||
| 24 | * | ||
| 25 | * @param string $name | ||
| 26 | * @param string $value | ||
| 27 | * @return static | ||
| 28 | */ | ||
| 29 | public function addDefaultResponseHeader(string $name, string $value) : AbstractStrategy | ||
| 35 | |||
| 36 | /** | ||
| 37 | * Add multiple default response headers | ||
| 38 | * | ||
| 39 | * @param array $headers | ||
| 40 | * @return static | ||
| 41 | */ | ||
| 42 | public function addDefaultResponseHeaders(array $headers) : AbstractStrategy | ||
| 50 | |||
| 51 | /** | ||
| 52 | * Apply default response headers | ||
| 53 | * | ||
| 54 | * Headers that already exist on the response will NOT be replaced. | ||
| 55 | * | ||
| 56 | * @param \Psr\Http\Message\ResponseInterface $response | ||
| 57 | * @return \Psr\Http\Message\ResponseInterface | ||
| 58 | */ | ||
| 59 | protected function applyDefaultResponseHeaders(ResponseInterface $response) : ResponseInterface | ||
| 69 | } | ||
| 70 |