| 1 | <?php |
||
| 14 | final class AddPathPlugin implements Plugin |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var UriInterface |
||
| 18 | */ |
||
| 19 | private $host; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param UriInterface $host |
||
| 23 | */ |
||
| 24 | 10 | public function __construct(UriInterface $host) |
|
| 25 | { |
||
| 26 | 10 | if (rtrim($host->getPath(), '/') === '') { |
|
| 27 | 1 | throw new \LogicException('Host path cannot be empty'); |
|
| 28 | } |
||
| 29 | |||
| 30 | 9 | $this->host = $host; |
|
| 31 | 9 | } |
|
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritdoc} |
||
| 35 | */ |
||
| 36 | 5 | public function handleRequest(RequestInterface $request, callable $next, callable $first) |
|
| 44 | } |
||
| 45 |