| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package WPEmerge |
| 4 |
* @author Atanas Angelov <hi@atanas.dev> |
| 5 |
* @copyright 2017-2019 Atanas Angelov |
| 6 |
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 |
| 7 |
* @link https://wpemerge.com/ |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace WPEmerge\Requests; |
| 11 |
|
| 12 |
use Psr\Http\Message\ServerRequestInterface; |
| 13 |
|
| 14 |
/** |
| 15 |
* A representation of a request to the server. |
| 16 |
*/ |
| 17 |
interface RequestInterface extends ServerRequestInterface { |
| 18 |
/** |
| 19 |
* Alias for ::getUri(). |
| 20 |
* Even though URI and URL are slightly different things this alias returns the URI for simplicity/familiarity. |
| 21 |
* |
| 22 |
* @return string |
| 23 |
*/ |
| 24 |
public function getUrl(); |
| 25 |
|
| 26 |
/** |
| 27 |
* Check if the request method is GET. |
| 28 |
* |
| 29 |
* @return boolean |
| 30 |
*/ |
| 31 |
public function isGet(); |
| 32 |
|
| 33 |
/** |
| 34 |
* Check if the request method is HEAD. |
| 35 |
* |
| 36 |
* @return boolean |
| 37 |
*/ |
| 38 |
public function isHead(); |
| 39 |
|
| 40 |
/** |
| 41 |
* Check if the request method is POST. |
| 42 |
* |
| 43 |
* @return boolean |
| 44 |
*/ |
| 45 |
public function isPost(); |
| 46 |
|
| 47 |
/** |
| 48 |
* Check if the request method is PUT. |
| 49 |
* |
| 50 |
* @return boolean |
| 51 |
*/ |
| 52 |
public function isPut(); |
| 53 |
|
| 54 |
/** |
| 55 |
* Check if the request method is PATCH. |
| 56 |
* |
| 57 |
* @return boolean |
| 58 |
*/ |
| 59 |
public function isPatch(); |
| 60 |
|
| 61 |
/** |
| 62 |
* Check if the request method is DELETE. |
| 63 |
* |
| 64 |
* @return boolean |
| 65 |
*/ |
| 66 |
public function isDelete(); |
| 67 |
|
| 68 |
/** |
| 69 |
* Check if the request method is OPTIONS. |
| 70 |
* |
| 71 |
* @return boolean |
| 72 |
*/ |
| 73 |
public function isOptions(); |
| 74 |
|
| 75 |
/** |
| 76 |
* Check if the request method is a "read" verb. |
| 77 |
* |
| 78 |
* @return boolean |
| 79 |
*/ |
| 80 |
public function isReadVerb(); |
| 81 |
|
| 82 |
/** |
| 83 |
* Check if the request is an ajax request. |
| 84 |
* |
| 85 |
* @return boolean |
| 86 |
*/ |
| 87 |
public function isAjax(); |
| 88 |
|
| 89 |
/** |
| 90 |
* Get a value from the request attributes. |
| 91 |
* |
| 92 |
* @param string $key |
| 93 |
* @param mixed $default |
| 94 |
* @return mixed |
| 95 |
*/ |
| 96 |
public function attributes( $key = '', $default = null ); |
| 97 |
|
| 98 |
/** |
| 99 |
* Get a value from the request query (i.e. $_GET). |
| 100 |
* |
| 101 |
* @param string $key |
| 102 |
* @param mixed $default |
| 103 |
* @return mixed |
| 104 |
*/ |
| 105 |
public function query( $key = '', $default = null ); |
| 106 |
|
| 107 |
/** |
| 108 |
* Get a value from the request body (i.e. $_POST). |
| 109 |
* |
| 110 |
* @param string $key |
| 111 |
* @param mixed $default |
| 112 |
* @return mixed |
| 113 |
*/ |
| 114 |
public function body( $key = '', $default = null ); |
| 115 |
|
| 116 |
/** |
| 117 |
* Get a value from the COOKIE parameters. |
| 118 |
* |
| 119 |
* @param string $key |
| 120 |
* @param mixed $default |
| 121 |
* @return mixed |
| 122 |
*/ |
| 123 |
public function cookies( $key = '', $default = null ); |
| 124 |
|
| 125 |
/** |
| 126 |
* Get a value from the FILES parameters. |
| 127 |
* |
| 128 |
* @param string $key |
| 129 |
* @param mixed $default |
| 130 |
* @return mixed |
| 131 |
*/ |
| 132 |
public function files( $key = '', $default = null ); |
| 133 |
|
| 134 |
/** |
| 135 |
* Get a value from the SERVER parameters. |
| 136 |
* |
| 137 |
* @param string $key |
| 138 |
* @param mixed $default |
| 139 |
* @return mixed |
| 140 |
*/ |
| 141 |
public function server( $key = '', $default = null ); |
| 142 |
|
| 143 |
/** |
| 144 |
* Get a value from the headers. |
| 145 |
* |
| 146 |
* @param string $key |
| 147 |
* @param mixed $default |
| 148 |
* @return mixed |
| 149 |
*/ |
| 150 |
public function headers( $key = '', $default = null ); |
| 151 |
} |
| 152 |
|