1 | <?php |
||
9 | class JsonSchema |
||
10 | { |
||
11 | /** @var string[] */ |
||
12 | private $schemas; |
||
13 | |||
14 | /** |
||
15 | * JsonSchema constructor. |
||
16 | * @param string[] $schemas [uri => file] An associative array of HTTP URI to validation schema. |
||
17 | */ |
||
18 | public function __construct(array $schemas) |
||
22 | |||
23 | /** |
||
24 | * Execute the middleware. |
||
25 | * |
||
26 | * @param ServerRequestInterface $request |
||
27 | * @param ResponseInterface $response |
||
28 | * @param callable $next |
||
29 | * |
||
30 | * @return ResponseInterface |
||
31 | */ |
||
32 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
||
66 | |||
67 | /** |
||
68 | * @param ResponseInterface $response |
||
69 | * @param string $reason |
||
70 | * @param string[] $headers |
||
71 | * @param string|null $body |
||
72 | * @return ResponseInterface |
||
73 | */ |
||
74 | private function invalidateResponse(ResponseInterface $response, $reason, array $headers = [], $body = null) |
||
89 | |||
90 | /** |
||
91 | * @param ServerRequestInterface $request |
||
92 | * @return object|null |
||
93 | */ |
||
94 | private function getSchema(ServerRequestInterface $request) |
||
111 | |||
112 | /** |
||
113 | * @param string |
||
114 | * @return string |
||
115 | */ |
||
116 | private function normalizeFilePath($path) |
||
125 | } |
||
126 |