| 1 | <?php |
||
| 10 | class Request |
||
| 11 | { |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string Full URL |
||
| 15 | */ |
||
| 16 | protected $url; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var array POST data |
||
| 20 | */ |
||
| 21 | protected $post; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Get request URL path |
||
| 25 | * |
||
| 26 | * @return string URL path |
||
| 27 | */ |
||
| 28 | 2 | public function getPath() |
|
| 29 | { |
||
| 30 | 2 | $path = parse_url($this->url, PHP_URL_PATH); |
|
| 31 | |||
| 32 | 2 | if ($path === false) { |
|
| 33 | $path = ''; |
||
| 34 | } |
||
| 35 | |||
| 36 | 2 | return $path; |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param string $url URL of the request, trailing slash are removed automatically |
||
| 41 | * @param array $post URL post fields |
||
| 42 | */ |
||
| 43 | 1 | public function __construct($url, array $post) |
|
| 48 | } |
||
| 49 |