| 1 | <?php |
||
| 8 | class OriginComponent |
||
| 9 | { |
||
| 10 | private $client; |
||
| 11 | private $config; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * OriginComponent constructor. |
||
| 15 | * @param ServerConfig $config |
||
| 16 | * @param $client |
||
| 17 | */ |
||
| 18 | public function __construct(ServerConfig $config, $client) |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Checks if there is a compatible origin header came from client |
||
| 26 | * @param string $headers |
||
| 27 | * @return bool |
||
| 28 | */ |
||
| 29 | public function checkOrigin(string $headers): bool |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @param string $msg |
||
| 48 | * @throws \Exception |
||
| 49 | */ |
||
| 50 | private function sendAndClose(string $msg) |
||
| 56 | } |