| 1 | <?php |
||
| 4 | class URLEncodedQueryStringRequestData implements RequestData |
||
| 5 | { |
||
| 6 | |||
| 7 | protected $queryString; |
||
| 8 | |||
| 9 | protected $parsedData = []; |
||
| 10 | |||
| 11 | 14 | public function __construct($queryString) |
|
| 16 | |||
| 17 | /** |
||
| 18 | * Returns the raw data that the requestData tried to parse |
||
| 19 | * @return string |
||
| 20 | */ |
||
| 21 | 2 | public function getRawData(): string |
|
| 25 | |||
| 26 | /** |
||
| 27 | * Attempts to get a specific key from the parsed data. Returns NULL if non-existant key (use has($key) if |
||
| 28 | * there is a difference between a null value and a missing value) |
||
| 29 | * WARNING: Parsed data is not sanitized, and should be treated as regular user data |
||
| 30 | * @param string $key |
||
| 31 | * @return mixed |
||
| 32 | */ |
||
| 33 | 4 | public function get(string $key) |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Attempts to find a specific key in the parsed data. Returns true if found else false |
||
| 40 | * @param string $key |
||
| 41 | * @return mixed |
||
| 42 | */ |
||
| 43 | 6 | public function has(string $key): bool |
|
| 47 | |||
| 48 | /** |
||
| 49 | * Gets all parsed data as an associative array |
||
| 50 | * WARNING: Parsed data is not sanitized, and should be treated as regular user data |
||
| 51 | * @return array |
||
| 52 | */ |
||
| 53 | 2 | public function getAllAsAssociativeArray(): array |
|
| 57 | } |
||
| 58 |