API.php
6 months ago
AbstractListingEndpoint.php
1 month ago
ApiException.php
3 months ago
Endpoint.php
3 months ago
EndpointContainer.php
3 years ago
ErrorResponse.php
3 years ago
Exception.php
3 years ago
ListingRequestValidationTrait.php
1 month ago
Request.php
3 years ago
Response.php
1 year ago
index.php
3 years ago
Request.php
33 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\API\REST; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use WP_REST_Request; |
| 9 | |
| 10 | class Request { |
| 11 | /** @var WP_REST_Request */ |
| 12 | private $wpRequest; |
| 13 | |
| 14 | public function __construct( |
| 15 | WP_REST_Request $wpRequest |
| 16 | ) { |
| 17 | $this->wpRequest = $wpRequest; |
| 18 | } |
| 19 | |
| 20 | public function getHeader(string $key): ?string { |
| 21 | return $this->wpRequest->get_header($key); |
| 22 | } |
| 23 | |
| 24 | public function getParams(): array { |
| 25 | return $this->wpRequest->get_params(); |
| 26 | } |
| 27 | |
| 28 | /** @return mixed */ |
| 29 | public function getParam(string $name) { |
| 30 | return $this->wpRequest->get_param($name); |
| 31 | } |
| 32 | } |
| 33 |