| 1 |
<?php |
| 2 |
|
| 3 |
declare (strict_types=1); |
| 4 |
namespace WCPOS\Vendor\Sentry\Integration; |
| 5 |
|
| 6 |
use WCPOS\Vendor\GuzzleHttp\Psr7\ServerRequest; |
| 7 |
use WCPOS\Vendor\Psr\Http\Message\ServerRequestInterface; |
| 8 |
/** |
| 9 |
* Default implementation for RequestFetcherInterface. Creates a request object |
| 10 |
* from the PHP superglobals. |
| 11 |
*/ |
| 12 |
final class RequestFetcher implements RequestFetcherInterface |
| 13 |
{ |
| 14 |
/** |
| 15 |
* {@inheritdoc} |
| 16 |
*/ |
| 17 |
public function fetchRequest() : ?ServerRequestInterface |
| 18 |
{ |
| 19 |
if (!isset($_SERVER['REQUEST_METHOD']) || \PHP_SAPI === 'cli') { |
| 20 |
return null; |
| 21 |
} |
| 22 |
try { |
| 23 |
return ServerRequest::fromGlobals(); |
| 24 |
} catch (\InvalidArgumentException $e) { |
| 25 |
return null; |
| 26 |
} |
| 27 |
} |
| 28 |
} |
| 29 |
|