| @@ -404,7 +404,7 @@ discard block | ||
| 404 | 404 |  		foreach ($keys as $key) { | 
| 405 | 405 |  			if (!array_key_exists($key, $arr)) { | 
| 406 | 406 | throw new MalformedArrayException( | 
| 407 | - 'source: ' . json_encode($arr) . ' - missing key: ' . $key | |
| 407 | + 'source: '.json_encode($arr).' - missing key: '.$key | |
| 408 | 408 | ); | 
| 409 | 409 | } | 
| 410 | 410 | } | 
| @@ -417,7 +417,7 @@ discard block | ||
| 417 | 417 |  	protected function cleanArray(array &$arr) { | 
| 418 | 418 | $arr = array_filter( | 
| 419 | 419 | $arr, | 
| 420 | -			function ($v) { | |
| 420 | +			function($v) { | |
| 421 | 421 |  				if (is_string($v)) { | 
| 422 | 422 | return ($v !== ''); | 
| 423 | 423 | } | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | 'index' => | 
| 68 | 68 | [ | 
| 69 | 69 | 'index' => $this->configService->getElasticIndex(), | 
| 70 | - 'id' => $document->getProviderId() . ':' . $document->getId(), | |
| 70 | + 'id' => $document->getProviderId().':'.$document->getId(), | |
| 71 | 71 | 'body' => $this->generateIndexBody($document) | 
| 72 | 72 | ] | 
| 73 | 73 | ]; | 
| @@ -95,7 +95,7 @@ discard block | ||
| 95 | 95 | 'index' => | 
| 96 | 96 | [ | 
| 97 | 97 | 'index' => $this->configService->getElasticIndex(), | 
| 98 | - 'id' => $document->getProviderId() . ':' . $document->getId(), | |
| 98 | + 'id' => $document->getProviderId().':'.$document->getId(), | |
| 99 | 99 | 'body' => ['doc' => $this->generateIndexBody($document)] | 
| 100 | 100 | ] | 
| 101 | 101 | ]; | 
| @@ -125,7 +125,7 @@ discard block | ||
| 125 | 125 | 'index' => | 
| 126 | 126 | [ | 
| 127 | 127 | 'index' => $this->configService->getElasticIndex(), | 
| 128 | - 'id' => $providerId . ':' . $documentId, | |
| 128 | + 'id' => $providerId.':'.$documentId, | |
| 129 | 129 | ] | 
| 130 | 130 | ]; | 
| 131 | 131 | |
| @@ -48,8 +48,7 @@ discard block | ||
| 48 | 48 | */ | 
| 49 | 49 |  class SearchMappingService { | 
| 50 | 50 | |
| 51 | - public function __construct | |
| 52 | - ( | |
| 51 | + public function __construct( | |
| 53 | 52 | private ConfigService $configService | 
| 54 | 53 |  	) { | 
| 55 | 54 | } | 
| @@ -275,7 +274,7 @@ discard block | ||
| 275 | 274 | |
| 276 | 275 |  		foreach ($request->getWildcardFields() as $field) { | 
| 277 | 276 |  			if (!$this->fieldIsOutLimit($request, $field)) { | 
| 278 | - $queryFields[] = ['wildcard' => [$field => '*' . $content->getWord() . '*']]; | |
| 277 | + $queryFields[] = ['wildcard' => [$field => '*'.$content->getWord().'*']]; | |
| 279 | 278 | } | 
| 280 | 279 | } | 
| 281 | 280 | |
| @@ -439,7 +438,7 @@ discard block | ||
| 439 | 438 |  	public function getDocumentQuery(string $providerId, string $documentId): array { | 
| 440 | 439 | return [ | 
| 441 | 440 | 'index' => $this->configService->getElasticIndex(), | 
| 442 | - 'id' => $providerId . ':' . $documentId | |
| 441 | + 'id' => $providerId.':'.$documentId | |
| 443 | 442 | ]; | 
| 444 | 443 | } | 
| 445 | 444 | |
| @@ -451,8 +450,8 @@ discard block | ||
| 451 | 450 | */ | 
| 452 | 451 |  	private function getPartsFields(ISearchRequest $request): array { | 
| 453 | 452 | return array_map( | 
| 454 | -			function (string $value): string { | |
| 455 | - return 'parts.' . $value; | |
| 453 | +			function(string $value): string { | |
| 454 | + return 'parts.'.$value; | |
| 456 | 455 | }, $request->getParts() | 
| 457 | 456 | ); | 
| 458 | 457 | } | 
| @@ -22,8 +22,7 @@ | ||
| 22 | 22 | * | 
| 23 | 23 | * @link http://tools.ietf.org/html/rfc3986 (the URI specification) | 
| 24 | 24 | */ | 
| 25 | -interface UriInterface | |
| 26 | -{ | |
| 25 | +interface UriInterface { | |
| 27 | 26 | /** | 
| 28 | 27 | * Retrieve the scheme component of the URI. | 
| 29 | 28 | * | 
| @@ -24,286 +24,286 @@ | ||
| 24 | 24 | */ | 
| 25 | 25 | interface UriInterface | 
| 26 | 26 |  { | 
| 27 | - /** | |
| 28 | - * Retrieve the scheme component of the URI. | |
| 29 | - * | |
| 30 | - * If no scheme is present, this method MUST return an empty string. | |
| 31 | - * | |
| 32 | - * The value returned MUST be normalized to lowercase, per RFC 3986 | |
| 33 | - * Section 3.1. | |
| 34 | - * | |
| 35 | - * The trailing ":" character is not part of the scheme and MUST NOT be | |
| 36 | - * added. | |
| 37 | - * | |
| 38 | - * @see https://tools.ietf.org/html/rfc3986#section-3.1 | |
| 39 | - * @return string The URI scheme. | |
| 40 | - */ | |
| 41 | - public function getScheme() : string; | |
| 42 | - /** | |
| 43 | - * Retrieve the authority component of the URI. | |
| 44 | - * | |
| 45 | - * If no authority information is present, this method MUST return an empty | |
| 46 | - * string. | |
| 47 | - * | |
| 48 | - * The authority syntax of the URI is: | |
| 49 | - * | |
| 50 | - * <pre> | |
| 51 | - * [user-info@]host[:port] | |
| 52 | - * </pre> | |
| 53 | - * | |
| 54 | - * If the port component is not set or is the standard port for the current | |
| 55 | - * scheme, it SHOULD NOT be included. | |
| 56 | - * | |
| 57 | - * @see https://tools.ietf.org/html/rfc3986#section-3.2 | |
| 58 | - * @return string The URI authority, in "[user-info@]host[:port]" format. | |
| 59 | - */ | |
| 60 | - public function getAuthority() : string; | |
| 61 | - /** | |
| 62 | - * Retrieve the user information component of the URI. | |
| 63 | - * | |
| 64 | - * If no user information is present, this method MUST return an empty | |
| 65 | - * string. | |
| 66 | - * | |
| 67 | - * If a user is present in the URI, this will return that value; | |
| 68 | - * additionally, if the password is also present, it will be appended to the | |
| 69 | -     * user value, with a colon (":") separating the values. | |
| 70 | - * | |
| 71 | - * The trailing "@" character is not part of the user information and MUST | |
| 72 | - * NOT be added. | |
| 73 | - * | |
| 74 | - * @return string The URI user information, in "username[:password]" format. | |
| 75 | - */ | |
| 76 | - public function getUserInfo() : string; | |
| 77 | - /** | |
| 78 | - * Retrieve the host component of the URI. | |
| 79 | - * | |
| 80 | - * If no host is present, this method MUST return an empty string. | |
| 81 | - * | |
| 82 | - * The value returned MUST be normalized to lowercase, per RFC 3986 | |
| 83 | - * Section 3.2.2. | |
| 84 | - * | |
| 85 | - * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 | |
| 86 | - * @return string The URI host. | |
| 87 | - */ | |
| 88 | - public function getHost() : string; | |
| 89 | - /** | |
| 90 | - * Retrieve the port component of the URI. | |
| 91 | - * | |
| 92 | - * If a port is present, and it is non-standard for the current scheme, | |
| 93 | - * this method MUST return it as an integer. If the port is the standard port | |
| 94 | - * used with the current scheme, this method SHOULD return null. | |
| 95 | - * | |
| 96 | - * If no port is present, and no scheme is present, this method MUST return | |
| 97 | - * a null value. | |
| 98 | - * | |
| 99 | - * If no port is present, but a scheme is present, this method MAY return | |
| 100 | - * the standard port for that scheme, but SHOULD return null. | |
| 101 | - * | |
| 102 | - * @return null|int The URI port. | |
| 103 | - */ | |
| 104 | - public function getPort() : ?int; | |
| 105 | - /** | |
| 106 | - * Retrieve the path component of the URI. | |
| 107 | - * | |
| 108 | - * The path can either be empty or absolute (starting with a slash) or | |
| 109 | - * rootless (not starting with a slash). Implementations MUST support all | |
| 110 | - * three syntaxes. | |
| 111 | - * | |
| 112 | - * Normally, the empty path "" and absolute path "/" are considered equal as | |
| 113 | - * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically | |
| 114 | - * do this normalization because in contexts with a trimmed base path, e.g. | |
| 115 | - * the front controller, this difference becomes significant. It's the task | |
| 116 | - * of the user to handle both "" and "/". | |
| 117 | - * | |
| 118 | - * The value returned MUST be percent-encoded, but MUST NOT double-encode | |
| 119 | - * any characters. To determine what characters to encode, please refer to | |
| 120 | - * RFC 3986, Sections 2 and 3.3. | |
| 121 | - * | |
| 122 | -     * As an example, if the value should include a slash ("/") not intended as | |
| 123 | - * delimiter between path segments, that value MUST be passed in encoded | |
| 124 | - * form (e.g., "%2F") to the instance. | |
| 125 | - * | |
| 126 | - * @see https://tools.ietf.org/html/rfc3986#section-2 | |
| 127 | - * @see https://tools.ietf.org/html/rfc3986#section-3.3 | |
| 128 | - * @return string The URI path. | |
| 129 | - */ | |
| 130 | - public function getPath() : string; | |
| 131 | - /** | |
| 132 | - * Retrieve the query string of the URI. | |
| 133 | - * | |
| 134 | - * If no query string is present, this method MUST return an empty string. | |
| 135 | - * | |
| 136 | - * The leading "?" character is not part of the query and MUST NOT be | |
| 137 | - * added. | |
| 138 | - * | |
| 139 | - * The value returned MUST be percent-encoded, but MUST NOT double-encode | |
| 140 | - * any characters. To determine what characters to encode, please refer to | |
| 141 | - * RFC 3986, Sections 2 and 3.4. | |
| 142 | - * | |
| 143 | - * As an example, if a value in a key/value pair of the query string should | |
| 144 | -     * include an ampersand ("&") not intended as a delimiter between values, | |
| 145 | - * that value MUST be passed in encoded form (e.g., "%26") to the instance. | |
| 146 | - * | |
| 147 | - * @see https://tools.ietf.org/html/rfc3986#section-2 | |
| 148 | - * @see https://tools.ietf.org/html/rfc3986#section-3.4 | |
| 149 | - * @return string The URI query string. | |
| 150 | - */ | |
| 151 | - public function getQuery() : string; | |
| 152 | - /** | |
| 153 | - * Retrieve the fragment component of the URI. | |
| 154 | - * | |
| 155 | - * If no fragment is present, this method MUST return an empty string. | |
| 156 | - * | |
| 157 | - * The leading "#" character is not part of the fragment and MUST NOT be | |
| 158 | - * added. | |
| 159 | - * | |
| 160 | - * The value returned MUST be percent-encoded, but MUST NOT double-encode | |
| 161 | - * any characters. To determine what characters to encode, please refer to | |
| 162 | - * RFC 3986, Sections 2 and 3.5. | |
| 163 | - * | |
| 164 | - * @see https://tools.ietf.org/html/rfc3986#section-2 | |
| 165 | - * @see https://tools.ietf.org/html/rfc3986#section-3.5 | |
| 166 | - * @return string The URI fragment. | |
| 167 | - */ | |
| 168 | - public function getFragment() : string; | |
| 169 | - /** | |
| 170 | - * Return an instance with the specified scheme. | |
| 171 | - * | |
| 172 | - * This method MUST retain the state of the current instance, and return | |
| 173 | - * an instance that contains the specified scheme. | |
| 174 | - * | |
| 175 | - * Implementations MUST support the schemes "http" and "https" case | |
| 176 | - * insensitively, and MAY accommodate other schemes if required. | |
| 177 | - * | |
| 178 | - * An empty scheme is equivalent to removing the scheme. | |
| 179 | - * | |
| 180 | - * @param string $scheme The scheme to use with the new instance. | |
| 181 | - * @return static A new instance with the specified scheme. | |
| 182 | - * @throws \InvalidArgumentException for invalid or unsupported schemes. | |
| 183 | - */ | |
| 184 | - public function withScheme(string $scheme) : UriInterface; | |
| 185 | - /** | |
| 186 | - * Return an instance with the specified user information. | |
| 187 | - * | |
| 188 | - * This method MUST retain the state of the current instance, and return | |
| 189 | - * an instance that contains the specified user information. | |
| 190 | - * | |
| 191 | - * Password is optional, but the user information MUST include the | |
| 192 | - * user; an empty string for the user is equivalent to removing user | |
| 193 | - * information. | |
| 194 | - * | |
| 195 | - * @param string $user The user name to use for authority. | |
| 196 | - * @param null|string $password The password associated with $user. | |
| 197 | - * @return static A new instance with the specified user information. | |
| 198 | - */ | |
| 199 | - public function withUserInfo(string $user, ?string $password = null) : UriInterface; | |
| 200 | - /** | |
| 201 | - * Return an instance with the specified host. | |
| 202 | - * | |
| 203 | - * This method MUST retain the state of the current instance, and return | |
| 204 | - * an instance that contains the specified host. | |
| 205 | - * | |
| 206 | - * An empty host value is equivalent to removing the host. | |
| 207 | - * | |
| 208 | - * @param string $host The hostname to use with the new instance. | |
| 209 | - * @return static A new instance with the specified host. | |
| 210 | - * @throws \InvalidArgumentException for invalid hostnames. | |
| 211 | - */ | |
| 212 | - public function withHost(string $host) : UriInterface; | |
| 213 | - /** | |
| 214 | - * Return an instance with the specified port. | |
| 215 | - * | |
| 216 | - * This method MUST retain the state of the current instance, and return | |
| 217 | - * an instance that contains the specified port. | |
| 218 | - * | |
| 219 | - * Implementations MUST raise an exception for ports outside the | |
| 220 | - * established TCP and UDP port ranges. | |
| 221 | - * | |
| 222 | - * A null value provided for the port is equivalent to removing the port | |
| 223 | - * information. | |
| 224 | - * | |
| 225 | - * @param null|int $port The port to use with the new instance; a null value | |
| 226 | - * removes the port information. | |
| 227 | - * @return static A new instance with the specified port. | |
| 228 | - * @throws \InvalidArgumentException for invalid ports. | |
| 229 | - */ | |
| 230 | - public function withPort(?int $port) : UriInterface; | |
| 231 | - /** | |
| 232 | - * Return an instance with the specified path. | |
| 233 | - * | |
| 234 | - * This method MUST retain the state of the current instance, and return | |
| 235 | - * an instance that contains the specified path. | |
| 236 | - * | |
| 237 | - * The path can either be empty or absolute (starting with a slash) or | |
| 238 | - * rootless (not starting with a slash). Implementations MUST support all | |
| 239 | - * three syntaxes. | |
| 240 | - * | |
| 241 | - * If the path is intended to be domain-relative rather than path relative then | |
| 242 | -     * it must begin with a slash ("/"). Paths not starting with a slash ("/") | |
| 243 | - * are assumed to be relative to some base path known to the application or | |
| 244 | - * consumer. | |
| 245 | - * | |
| 246 | - * Users can provide both encoded and decoded path characters. | |
| 247 | - * Implementations ensure the correct encoding as outlined in getPath(). | |
| 248 | - * | |
| 249 | - * @param string $path The path to use with the new instance. | |
| 250 | - * @return static A new instance with the specified path. | |
| 251 | - * @throws \InvalidArgumentException for invalid paths. | |
| 252 | - */ | |
| 253 | - public function withPath(string $path) : UriInterface; | |
| 254 | - /** | |
| 255 | - * Return an instance with the specified query string. | |
| 256 | - * | |
| 257 | - * This method MUST retain the state of the current instance, and return | |
| 258 | - * an instance that contains the specified query string. | |
| 259 | - * | |
| 260 | - * Users can provide both encoded and decoded query characters. | |
| 261 | - * Implementations ensure the correct encoding as outlined in getQuery(). | |
| 262 | - * | |
| 263 | - * An empty query string value is equivalent to removing the query string. | |
| 264 | - * | |
| 265 | - * @param string $query The query string to use with the new instance. | |
| 266 | - * @return static A new instance with the specified query string. | |
| 267 | - * @throws \InvalidArgumentException for invalid query strings. | |
| 268 | - */ | |
| 269 | - public function withQuery(string $query) : UriInterface; | |
| 270 | - /** | |
| 271 | - * Return an instance with the specified URI fragment. | |
| 272 | - * | |
| 273 | - * This method MUST retain the state of the current instance, and return | |
| 274 | - * an instance that contains the specified URI fragment. | |
| 275 | - * | |
| 276 | - * Users can provide both encoded and decoded fragment characters. | |
| 277 | - * Implementations ensure the correct encoding as outlined in getFragment(). | |
| 278 | - * | |
| 279 | - * An empty fragment value is equivalent to removing the fragment. | |
| 280 | - * | |
| 281 | - * @param string $fragment The fragment to use with the new instance. | |
| 282 | - * @return static A new instance with the specified fragment. | |
| 283 | - */ | |
| 284 | - public function withFragment(string $fragment) : UriInterface; | |
| 285 | - /** | |
| 286 | - * Return the string representation as a URI reference. | |
| 287 | - * | |
| 288 | - * Depending on which components of the URI are present, the resulting | |
| 289 | - * string is either a full URI or relative reference according to RFC 3986, | |
| 290 | - * Section 4.1. The method concatenates the various components of the URI, | |
| 291 | - * using the appropriate delimiters: | |
| 292 | - * | |
| 293 | - * - If a scheme is present, it MUST be suffixed by ":". | |
| 294 | - * - If an authority is present, it MUST be prefixed by "//". | |
| 295 | - * - The path can be concatenated without delimiters. But there are two | |
| 296 | - * cases where the path has to be adjusted to make the URI reference | |
| 297 | - * valid as PHP does not allow to throw an exception in __toString(): | |
| 298 | - * - If the path is rootless and an authority is present, the path MUST | |
| 299 | - * be prefixed by "/". | |
| 300 | - * - If the path is starting with more than one "/" and no authority is | |
| 301 | - * present, the starting slashes MUST be reduced to one. | |
| 302 | - * - If a query is present, it MUST be prefixed by "?". | |
| 303 | - * - If a fragment is present, it MUST be prefixed by "#". | |
| 304 | - * | |
| 305 | - * @see http://tools.ietf.org/html/rfc3986#section-4.1 | |
| 306 | - * @return string | |
| 307 | - */ | |
| 308 | - public function __toString() : string; | |
| 27 | + /** | |
| 28 | + * Retrieve the scheme component of the URI. | |
| 29 | + * | |
| 30 | + * If no scheme is present, this method MUST return an empty string. | |
| 31 | + * | |
| 32 | + * The value returned MUST be normalized to lowercase, per RFC 3986 | |
| 33 | + * Section 3.1. | |
| 34 | + * | |
| 35 | + * The trailing ":" character is not part of the scheme and MUST NOT be | |
| 36 | + * added. | |
| 37 | + * | |
| 38 | + * @see https://tools.ietf.org/html/rfc3986#section-3.1 | |
| 39 | + * @return string The URI scheme. | |
| 40 | + */ | |
| 41 | + public function getScheme() : string; | |
| 42 | + /** | |
| 43 | + * Retrieve the authority component of the URI. | |
| 44 | + * | |
| 45 | + * If no authority information is present, this method MUST return an empty | |
| 46 | + * string. | |
| 47 | + * | |
| 48 | + * The authority syntax of the URI is: | |
| 49 | + * | |
| 50 | + * <pre> | |
| 51 | + * [user-info@]host[:port] | |
| 52 | + * </pre> | |
| 53 | + * | |
| 54 | + * If the port component is not set or is the standard port for the current | |
| 55 | + * scheme, it SHOULD NOT be included. | |
| 56 | + * | |
| 57 | + * @see https://tools.ietf.org/html/rfc3986#section-3.2 | |
| 58 | + * @return string The URI authority, in "[user-info@]host[:port]" format. | |
| 59 | + */ | |
| 60 | + public function getAuthority() : string; | |
| 61 | + /** | |
| 62 | + * Retrieve the user information component of the URI. | |
| 63 | + * | |
| 64 | + * If no user information is present, this method MUST return an empty | |
| 65 | + * string. | |
| 66 | + * | |
| 67 | + * If a user is present in the URI, this will return that value; | |
| 68 | + * additionally, if the password is also present, it will be appended to the | |
| 69 | +	 * user value, with a colon (":") separating the values. | |
| 70 | + * | |
| 71 | + * The trailing "@" character is not part of the user information and MUST | |
| 72 | + * NOT be added. | |
| 73 | + * | |
| 74 | + * @return string The URI user information, in "username[:password]" format. | |
| 75 | + */ | |
| 76 | + public function getUserInfo() : string; | |
| 77 | + /** | |
| 78 | + * Retrieve the host component of the URI. | |
| 79 | + * | |
| 80 | + * If no host is present, this method MUST return an empty string. | |
| 81 | + * | |
| 82 | + * The value returned MUST be normalized to lowercase, per RFC 3986 | |
| 83 | + * Section 3.2.2. | |
| 84 | + * | |
| 85 | + * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 | |
| 86 | + * @return string The URI host. | |
| 87 | + */ | |
| 88 | + public function getHost() : string; | |
| 89 | + /** | |
| 90 | + * Retrieve the port component of the URI. | |
| 91 | + * | |
| 92 | + * If a port is present, and it is non-standard for the current scheme, | |
| 93 | + * this method MUST return it as an integer. If the port is the standard port | |
| 94 | + * used with the current scheme, this method SHOULD return null. | |
| 95 | + * | |
| 96 | + * If no port is present, and no scheme is present, this method MUST return | |
| 97 | + * a null value. | |
| 98 | + * | |
| 99 | + * If no port is present, but a scheme is present, this method MAY return | |
| 100 | + * the standard port for that scheme, but SHOULD return null. | |
| 101 | + * | |
| 102 | + * @return null|int The URI port. | |
| 103 | + */ | |
| 104 | + public function getPort() : ?int; | |
| 105 | + /** | |
| 106 | + * Retrieve the path component of the URI. | |
| 107 | + * | |
| 108 | + * The path can either be empty or absolute (starting with a slash) or | |
| 109 | + * rootless (not starting with a slash). Implementations MUST support all | |
| 110 | + * three syntaxes. | |
| 111 | + * | |
| 112 | + * Normally, the empty path "" and absolute path "/" are considered equal as | |
| 113 | + * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically | |
| 114 | + * do this normalization because in contexts with a trimmed base path, e.g. | |
| 115 | + * the front controller, this difference becomes significant. It's the task | |
| 116 | + * of the user to handle both "" and "/". | |
| 117 | + * | |
| 118 | + * The value returned MUST be percent-encoded, but MUST NOT double-encode | |
| 119 | + * any characters. To determine what characters to encode, please refer to | |
| 120 | + * RFC 3986, Sections 2 and 3.3. | |
| 121 | + * | |
| 122 | +	 * As an example, if the value should include a slash ("/") not intended as | |
| 123 | + * delimiter between path segments, that value MUST be passed in encoded | |
| 124 | + * form (e.g., "%2F") to the instance. | |
| 125 | + * | |
| 126 | + * @see https://tools.ietf.org/html/rfc3986#section-2 | |
| 127 | + * @see https://tools.ietf.org/html/rfc3986#section-3.3 | |
| 128 | + * @return string The URI path. | |
| 129 | + */ | |
| 130 | + public function getPath() : string; | |
| 131 | + /** | |
| 132 | + * Retrieve the query string of the URI. | |
| 133 | + * | |
| 134 | + * If no query string is present, this method MUST return an empty string. | |
| 135 | + * | |
| 136 | + * The leading "?" character is not part of the query and MUST NOT be | |
| 137 | + * added. | |
| 138 | + * | |
| 139 | + * The value returned MUST be percent-encoded, but MUST NOT double-encode | |
| 140 | + * any characters. To determine what characters to encode, please refer to | |
| 141 | + * RFC 3986, Sections 2 and 3.4. | |
| 142 | + * | |
| 143 | + * As an example, if a value in a key/value pair of the query string should | |
| 144 | +	 * include an ampersand ("&") not intended as a delimiter between values, | |
| 145 | + * that value MUST be passed in encoded form (e.g., "%26") to the instance. | |
| 146 | + * | |
| 147 | + * @see https://tools.ietf.org/html/rfc3986#section-2 | |
| 148 | + * @see https://tools.ietf.org/html/rfc3986#section-3.4 | |
| 149 | + * @return string The URI query string. | |
| 150 | + */ | |
| 151 | + public function getQuery() : string; | |
| 152 | + /** | |
| 153 | + * Retrieve the fragment component of the URI. | |
| 154 | + * | |
| 155 | + * If no fragment is present, this method MUST return an empty string. | |
| 156 | + * | |
| 157 | + * The leading "#" character is not part of the fragment and MUST NOT be | |
| 158 | + * added. | |
| 159 | + * | |
| 160 | + * The value returned MUST be percent-encoded, but MUST NOT double-encode | |
| 161 | + * any characters. To determine what characters to encode, please refer to | |
| 162 | + * RFC 3986, Sections 2 and 3.5. | |
| 163 | + * | |
| 164 | + * @see https://tools.ietf.org/html/rfc3986#section-2 | |
| 165 | + * @see https://tools.ietf.org/html/rfc3986#section-3.5 | |
| 166 | + * @return string The URI fragment. | |
| 167 | + */ | |
| 168 | + public function getFragment() : string; | |
| 169 | + /** | |
| 170 | + * Return an instance with the specified scheme. | |
| 171 | + * | |
| 172 | + * This method MUST retain the state of the current instance, and return | |
| 173 | + * an instance that contains the specified scheme. | |
| 174 | + * | |
| 175 | + * Implementations MUST support the schemes "http" and "https" case | |
| 176 | + * insensitively, and MAY accommodate other schemes if required. | |
| 177 | + * | |
| 178 | + * An empty scheme is equivalent to removing the scheme. | |
| 179 | + * | |
| 180 | + * @param string $scheme The scheme to use with the new instance. | |
| 181 | + * @return static A new instance with the specified scheme. | |
| 182 | + * @throws \InvalidArgumentException for invalid or unsupported schemes. | |
| 183 | + */ | |
| 184 | + public function withScheme(string $scheme) : UriInterface; | |
| 185 | + /** | |
| 186 | + * Return an instance with the specified user information. | |
| 187 | + * | |
| 188 | + * This method MUST retain the state of the current instance, and return | |
| 189 | + * an instance that contains the specified user information. | |
| 190 | + * | |
| 191 | + * Password is optional, but the user information MUST include the | |
| 192 | + * user; an empty string for the user is equivalent to removing user | |
| 193 | + * information. | |
| 194 | + * | |
| 195 | + * @param string $user The user name to use for authority. | |
| 196 | + * @param null|string $password The password associated with $user. | |
| 197 | + * @return static A new instance with the specified user information. | |
| 198 | + */ | |
| 199 | + public function withUserInfo(string $user, ?string $password = null) : UriInterface; | |
| 200 | + /** | |
| 201 | + * Return an instance with the specified host. | |
| 202 | + * | |
| 203 | + * This method MUST retain the state of the current instance, and return | |
| 204 | + * an instance that contains the specified host. | |
| 205 | + * | |
| 206 | + * An empty host value is equivalent to removing the host. | |
| 207 | + * | |
| 208 | + * @param string $host The hostname to use with the new instance. | |
| 209 | + * @return static A new instance with the specified host. | |
| 210 | + * @throws \InvalidArgumentException for invalid hostnames. | |
| 211 | + */ | |
| 212 | + public function withHost(string $host) : UriInterface; | |
| 213 | + /** | |
| 214 | + * Return an instance with the specified port. | |
| 215 | + * | |
| 216 | + * This method MUST retain the state of the current instance, and return | |
| 217 | + * an instance that contains the specified port. | |
| 218 | + * | |
| 219 | + * Implementations MUST raise an exception for ports outside the | |
| 220 | + * established TCP and UDP port ranges. | |
| 221 | + * | |
| 222 | + * A null value provided for the port is equivalent to removing the port | |
| 223 | + * information. | |
| 224 | + * | |
| 225 | + * @param null|int $port The port to use with the new instance; a null value | |
| 226 | + * removes the port information. | |
| 227 | + * @return static A new instance with the specified port. | |
| 228 | + * @throws \InvalidArgumentException for invalid ports. | |
| 229 | + */ | |
| 230 | + public function withPort(?int $port) : UriInterface; | |
| 231 | + /** | |
| 232 | + * Return an instance with the specified path. | |
| 233 | + * | |
| 234 | + * This method MUST retain the state of the current instance, and return | |
| 235 | + * an instance that contains the specified path. | |
| 236 | + * | |
| 237 | + * The path can either be empty or absolute (starting with a slash) or | |
| 238 | + * rootless (not starting with a slash). Implementations MUST support all | |
| 239 | + * three syntaxes. | |
| 240 | + * | |
| 241 | + * If the path is intended to be domain-relative rather than path relative then | |
| 242 | +	 * it must begin with a slash ("/"). Paths not starting with a slash ("/") | |
| 243 | + * are assumed to be relative to some base path known to the application or | |
| 244 | + * consumer. | |
| 245 | + * | |
| 246 | + * Users can provide both encoded and decoded path characters. | |
| 247 | + * Implementations ensure the correct encoding as outlined in getPath(). | |
| 248 | + * | |
| 249 | + * @param string $path The path to use with the new instance. | |
| 250 | + * @return static A new instance with the specified path. | |
| 251 | + * @throws \InvalidArgumentException for invalid paths. | |
| 252 | + */ | |
| 253 | + public function withPath(string $path) : UriInterface; | |
| 254 | + /** | |
| 255 | + * Return an instance with the specified query string. | |
| 256 | + * | |
| 257 | + * This method MUST retain the state of the current instance, and return | |
| 258 | + * an instance that contains the specified query string. | |
| 259 | + * | |
| 260 | + * Users can provide both encoded and decoded query characters. | |
| 261 | + * Implementations ensure the correct encoding as outlined in getQuery(). | |
| 262 | + * | |
| 263 | + * An empty query string value is equivalent to removing the query string. | |
| 264 | + * | |
| 265 | + * @param string $query The query string to use with the new instance. | |
| 266 | + * @return static A new instance with the specified query string. | |
| 267 | + * @throws \InvalidArgumentException for invalid query strings. | |
| 268 | + */ | |
| 269 | + public function withQuery(string $query) : UriInterface; | |
| 270 | + /** | |
| 271 | + * Return an instance with the specified URI fragment. | |
| 272 | + * | |
| 273 | + * This method MUST retain the state of the current instance, and return | |
| 274 | + * an instance that contains the specified URI fragment. | |
| 275 | + * | |
| 276 | + * Users can provide both encoded and decoded fragment characters. | |
| 277 | + * Implementations ensure the correct encoding as outlined in getFragment(). | |
| 278 | + * | |
| 279 | + * An empty fragment value is equivalent to removing the fragment. | |
| 280 | + * | |
| 281 | + * @param string $fragment The fragment to use with the new instance. | |
| 282 | + * @return static A new instance with the specified fragment. | |
| 283 | + */ | |
| 284 | + public function withFragment(string $fragment) : UriInterface; | |
| 285 | + /** | |
| 286 | + * Return the string representation as a URI reference. | |
| 287 | + * | |
| 288 | + * Depending on which components of the URI are present, the resulting | |
| 289 | + * string is either a full URI or relative reference according to RFC 3986, | |
| 290 | + * Section 4.1. The method concatenates the various components of the URI, | |
| 291 | + * using the appropriate delimiters: | |
| 292 | + * | |
| 293 | + * - If a scheme is present, it MUST be suffixed by ":". | |
| 294 | + * - If an authority is present, it MUST be prefixed by "//". | |
| 295 | + * - The path can be concatenated without delimiters. But there are two | |
| 296 | + * cases where the path has to be adjusted to make the URI reference | |
| 297 | + * valid as PHP does not allow to throw an exception in __toString(): | |
| 298 | + * - If the path is rootless and an authority is present, the path MUST | |
| 299 | + * be prefixed by "/". | |
| 300 | + * - If the path is starting with more than one "/" and no authority is | |
| 301 | + * present, the starting slashes MUST be reduced to one. | |
| 302 | + * - If a query is present, it MUST be prefixed by "?". | |
| 303 | + * - If a fragment is present, it MUST be prefixed by "#". | |
| 304 | + * | |
| 305 | + * @see http://tools.ietf.org/html/rfc3986#section-4.1 | |
| 306 | + * @return string | |
| 307 | + */ | |
| 308 | + public function __toString() : string; | |
| 309 | 309 | } | 
| @@ -2,8 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message; | 
| 4 | 4 | |
| 5 | -interface StreamFactoryInterface | |
| 6 | -{ | |
| 5 | +interface StreamFactoryInterface { | |
| 7 | 6 | /** | 
| 8 | 7 | * Create a new stream from a string. | 
| 9 | 8 | * | 
| @@ -4,40 +4,40 @@ | ||
| 4 | 4 | |
| 5 | 5 | interface StreamFactoryInterface | 
| 6 | 6 |  { | 
| 7 | - /** | |
| 8 | - * Create a new stream from a string. | |
| 9 | - * | |
| 10 | - * The stream SHOULD be created with a temporary resource. | |
| 11 | - * | |
| 12 | - * @param string $content String content with which to populate the stream. | |
| 13 | - * | |
| 14 | - * @return StreamInterface | |
| 15 | - */ | |
| 16 | - public function createStream(string $content = '') : StreamInterface; | |
| 17 | - /** | |
| 18 | - * Create a stream from an existing file. | |
| 19 | - * | |
| 20 | - * The file MUST be opened using the given mode, which may be any mode | |
| 21 | - * supported by the `fopen` function. | |
| 22 | - * | |
| 23 | - * The `$filename` MAY be any string supported by `fopen()`. | |
| 24 | - * | |
| 25 | - * @param string $filename Filename or stream URI to use as basis of stream. | |
| 26 | - * @param string $mode Mode with which to open the underlying filename/stream. | |
| 27 | - * | |
| 28 | - * @return StreamInterface | |
| 29 | - * @throws \RuntimeException If the file cannot be opened. | |
| 30 | - * @throws \InvalidArgumentException If the mode is invalid. | |
| 31 | - */ | |
| 32 | - public function createStreamFromFile(string $filename, string $mode = 'r') : StreamInterface; | |
| 33 | - /** | |
| 34 | - * Create a new stream from an existing resource. | |
| 35 | - * | |
| 36 | - * The stream MUST be readable and may be writable. | |
| 37 | - * | |
| 38 | - * @param resource $resource PHP resource to use as basis of stream. | |
| 39 | - * | |
| 40 | - * @return StreamInterface | |
| 41 | - */ | |
| 42 | - public function createStreamFromResource($resource) : StreamInterface; | |
| 7 | + /** | |
| 8 | + * Create a new stream from a string. | |
| 9 | + * | |
| 10 | + * The stream SHOULD be created with a temporary resource. | |
| 11 | + * | |
| 12 | + * @param string $content String content with which to populate the stream. | |
| 13 | + * | |
| 14 | + * @return StreamInterface | |
| 15 | + */ | |
| 16 | + public function createStream(string $content = '') : StreamInterface; | |
| 17 | + /** | |
| 18 | + * Create a stream from an existing file. | |
| 19 | + * | |
| 20 | + * The file MUST be opened using the given mode, which may be any mode | |
| 21 | + * supported by the `fopen` function. | |
| 22 | + * | |
| 23 | + * The `$filename` MAY be any string supported by `fopen()`. | |
| 24 | + * | |
| 25 | + * @param string $filename Filename or stream URI to use as basis of stream. | |
| 26 | + * @param string $mode Mode with which to open the underlying filename/stream. | |
| 27 | + * | |
| 28 | + * @return StreamInterface | |
| 29 | + * @throws \RuntimeException If the file cannot be opened. | |
| 30 | + * @throws \InvalidArgumentException If the mode is invalid. | |
| 31 | + */ | |
| 32 | + public function createStreamFromFile(string $filename, string $mode = 'r') : StreamInterface; | |
| 33 | + /** | |
| 34 | + * Create a new stream from an existing resource. | |
| 35 | + * | |
| 36 | + * The stream MUST be readable and may be writable. | |
| 37 | + * | |
| 38 | + * @param resource $resource PHP resource to use as basis of stream. | |
| 39 | + * | |
| 40 | + * @return StreamInterface | |
| 41 | + */ | |
| 42 | + public function createStreamFromResource($resource) : StreamInterface; | |
| 43 | 43 | } | 
| @@ -2,8 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message; | 
| 4 | 4 | |
| 5 | -interface UploadedFileFactoryInterface | |
| 6 | -{ | |
| 5 | +interface UploadedFileFactoryInterface { | |
| 7 | 6 | /** | 
| 8 | 7 | * Create a new uploaded file. | 
| 9 | 8 | * | 
| @@ -4,25 +4,25 @@ | ||
| 4 | 4 | |
| 5 | 5 | interface UploadedFileFactoryInterface | 
| 6 | 6 |  { | 
| 7 | - /** | |
| 8 | - * Create a new uploaded file. | |
| 9 | - * | |
| 10 | - * If a size is not provided it will be determined by checking the size of | |
| 11 | - * the file. | |
| 12 | - * | |
| 13 | - * @see http://php.net/manual/features.file-upload.post-method.php | |
| 14 | - * @see http://php.net/manual/features.file-upload.errors.php | |
| 15 | - * | |
| 16 | - * @param StreamInterface $stream Underlying stream representing the | |
| 17 | - * uploaded file content. | |
| 18 | - * @param int|null $size in bytes | |
| 19 | - * @param int $error PHP file upload error | |
| 20 | - * @param string|null $clientFilename Filename as provided by the client, if any. | |
| 21 | - * @param string|null $clientMediaType Media type as provided by the client, if any. | |
| 22 | - * | |
| 23 | - * @return UploadedFileInterface | |
| 24 | - * | |
| 25 | - * @throws \InvalidArgumentException If the file resource is not readable. | |
| 26 | - */ | |
| 27 | - public function createUploadedFile(StreamInterface $stream, ?int $size = null, int $error = \UPLOAD_ERR_OK, ?string $clientFilename = null, ?string $clientMediaType = null) : UploadedFileInterface; | |
| 7 | + /** | |
| 8 | + * Create a new uploaded file. | |
| 9 | + * | |
| 10 | + * If a size is not provided it will be determined by checking the size of | |
| 11 | + * the file. | |
| 12 | + * | |
| 13 | + * @see http://php.net/manual/features.file-upload.post-method.php | |
| 14 | + * @see http://php.net/manual/features.file-upload.errors.php | |
| 15 | + * | |
| 16 | + * @param StreamInterface $stream Underlying stream representing the | |
| 17 | + * uploaded file content. | |
| 18 | + * @param int|null $size in bytes | |
| 19 | + * @param int $error PHP file upload error | |
| 20 | + * @param string|null $clientFilename Filename as provided by the client, if any. | |
| 21 | + * @param string|null $clientMediaType Media type as provided by the client, if any. | |
| 22 | + * | |
| 23 | + * @return UploadedFileInterface | |
| 24 | + * | |
| 25 | + * @throws \InvalidArgumentException If the file resource is not readable. | |
| 26 | + */ | |
| 27 | + public function createUploadedFile(StreamInterface $stream, ?int $size = null, int $error = \UPLOAD_ERR_OK, ?string $clientFilename = null, ?string $clientMediaType = null) : UploadedFileInterface; | |
| 28 | 28 | } | 
| @@ -14,8 +14,7 @@ | ||
| 14 | 14 | * @link http://www.ietf.org/rfc/rfc7230.txt | 
| 15 | 15 | * @link http://www.ietf.org/rfc/rfc7231.txt | 
| 16 | 16 | */ | 
| 17 | -interface MessageInterface | |
| 18 | -{ | |
| 17 | +interface MessageInterface { | |
| 19 | 18 | /** | 
| 20 | 19 | * Retrieves the HTTP protocol version as a string. | 
| 21 | 20 | * | 
| @@ -16,162 +16,162 @@ | ||
| 16 | 16 | */ | 
| 17 | 17 | interface MessageInterface | 
| 18 | 18 |  { | 
| 19 | - /** | |
| 20 | - * Retrieves the HTTP protocol version as a string. | |
| 21 | - * | |
| 22 | - * The string MUST contain only the HTTP version number (e.g., "1.1", "1.0"). | |
| 23 | - * | |
| 24 | - * @return string HTTP protocol version. | |
| 25 | - */ | |
| 26 | - public function getProtocolVersion() : string; | |
| 27 | - /** | |
| 28 | - * Return an instance with the specified HTTP protocol version. | |
| 29 | - * | |
| 30 | - * The version string MUST contain only the HTTP version number (e.g., | |
| 31 | - * "1.1", "1.0"). | |
| 32 | - * | |
| 33 | - * This method MUST be implemented in such a way as to retain the | |
| 34 | - * immutability of the message, and MUST return an instance that has the | |
| 35 | - * new protocol version. | |
| 36 | - * | |
| 37 | - * @param string $version HTTP protocol version | |
| 38 | - * @return static | |
| 39 | - */ | |
| 40 | - public function withProtocolVersion(string $version) : MessageInterface; | |
| 41 | - /** | |
| 42 | - * Retrieves all message header values. | |
| 43 | - * | |
| 44 | - * The keys represent the header name as it will be sent over the wire, and | |
| 45 | - * each value is an array of strings associated with the header. | |
| 46 | - * | |
| 47 | - * // Represent the headers as a string | |
| 48 | -     *     foreach ($message->getHeaders() as $name => $values) { | |
| 49 | -     *         echo $name . ": " . implode(", ", $values); | |
| 50 | - * } | |
| 51 | - * | |
| 52 | - * // Emit headers iteratively: | |
| 53 | -     *     foreach ($message->getHeaders() as $name => $values) { | |
| 54 | -     *         foreach ($values as $value) { | |
| 55 | -     *             header(sprintf('%s: %s', $name, $value), false); | |
| 56 | - * } | |
| 57 | - * } | |
| 58 | - * | |
| 59 | - * While header names are not case-sensitive, getHeaders() will preserve the | |
| 60 | - * exact case in which headers were originally specified. | |
| 61 | - * | |
| 62 | - * @return string[][] Returns an associative array of the message's headers. Each | |
| 63 | - * key MUST be a header name, and each value MUST be an array of strings | |
| 64 | - * for that header. | |
| 65 | - */ | |
| 66 | - public function getHeaders() : array; | |
| 67 | - /** | |
| 68 | - * Checks if a header exists by the given case-insensitive name. | |
| 69 | - * | |
| 70 | - * @param string $name Case-insensitive header field name. | |
| 71 | - * @return bool Returns true if any header names match the given header | |
| 72 | - * name using a case-insensitive string comparison. Returns false if | |
| 73 | - * no matching header name is found in the message. | |
| 74 | - */ | |
| 75 | - public function hasHeader(string $name) : bool; | |
| 76 | - /** | |
| 77 | - * Retrieves a message header value by the given case-insensitive name. | |
| 78 | - * | |
| 79 | - * This method returns an array of all the header values of the given | |
| 80 | - * case-insensitive header name. | |
| 81 | - * | |
| 82 | - * If the header does not appear in the message, this method MUST return an | |
| 83 | - * empty array. | |
| 84 | - * | |
| 85 | - * @param string $name Case-insensitive header field name. | |
| 86 | - * @return string[] An array of string values as provided for the given | |
| 87 | - * header. If the header does not appear in the message, this method MUST | |
| 88 | - * return an empty array. | |
| 89 | - */ | |
| 90 | - public function getHeader(string $name) : array; | |
| 91 | - /** | |
| 92 | - * Retrieves a comma-separated string of the values for a single header. | |
| 93 | - * | |
| 94 | - * This method returns all of the header values of the given | |
| 95 | - * case-insensitive header name as a string concatenated together using | |
| 96 | - * a comma. | |
| 97 | - * | |
| 98 | - * NOTE: Not all header values may be appropriately represented using | |
| 99 | - * comma concatenation. For such headers, use getHeader() instead | |
| 100 | - * and supply your own delimiter when concatenating. | |
| 101 | - * | |
| 102 | - * If the header does not appear in the message, this method MUST return | |
| 103 | - * an empty string. | |
| 104 | - * | |
| 105 | - * @param string $name Case-insensitive header field name. | |
| 106 | - * @return string A string of values as provided for the given header | |
| 107 | - * concatenated together using a comma. If the header does not appear in | |
| 108 | - * the message, this method MUST return an empty string. | |
| 109 | - */ | |
| 110 | - public function getHeaderLine(string $name) : string; | |
| 111 | - /** | |
| 112 | - * Return an instance with the provided value replacing the specified header. | |
| 113 | - * | |
| 114 | - * While header names are case-insensitive, the casing of the header will | |
| 115 | - * be preserved by this function, and returned from getHeaders(). | |
| 116 | - * | |
| 117 | - * This method MUST be implemented in such a way as to retain the | |
| 118 | - * immutability of the message, and MUST return an instance that has the | |
| 119 | - * new and/or updated header and value. | |
| 120 | - * | |
| 121 | - * @param string $name Case-insensitive header field name. | |
| 122 | - * @param string|string[] $value Header value(s). | |
| 123 | - * @return static | |
| 124 | - * @throws \InvalidArgumentException for invalid header names or values. | |
| 125 | - */ | |
| 126 | - public function withHeader(string $name, $value) : MessageInterface; | |
| 127 | - /** | |
| 128 | - * Return an instance with the specified header appended with the given value. | |
| 129 | - * | |
| 130 | - * Existing values for the specified header will be maintained. The new | |
| 131 | - * value(s) will be appended to the existing list. If the header did not | |
| 132 | - * exist previously, it will be added. | |
| 133 | - * | |
| 134 | - * This method MUST be implemented in such a way as to retain the | |
| 135 | - * immutability of the message, and MUST return an instance that has the | |
| 136 | - * new header and/or value. | |
| 137 | - * | |
| 138 | - * @param string $name Case-insensitive header field name to add. | |
| 139 | - * @param string|string[] $value Header value(s). | |
| 140 | - * @return static | |
| 141 | - * @throws \InvalidArgumentException for invalid header names or values. | |
| 142 | - */ | |
| 143 | - public function withAddedHeader(string $name, $value) : MessageInterface; | |
| 144 | - /** | |
| 145 | - * Return an instance without the specified header. | |
| 146 | - * | |
| 147 | - * Header resolution MUST be done without case-sensitivity. | |
| 148 | - * | |
| 149 | - * This method MUST be implemented in such a way as to retain the | |
| 150 | - * immutability of the message, and MUST return an instance that removes | |
| 151 | - * the named header. | |
| 152 | - * | |
| 153 | - * @param string $name Case-insensitive header field name to remove. | |
| 154 | - * @return static | |
| 155 | - */ | |
| 156 | - public function withoutHeader(string $name) : MessageInterface; | |
| 157 | - /** | |
| 158 | - * Gets the body of the message. | |
| 159 | - * | |
| 160 | - * @return StreamInterface Returns the body as a stream. | |
| 161 | - */ | |
| 162 | - public function getBody() : StreamInterface; | |
| 163 | - /** | |
| 164 | - * Return an instance with the specified message body. | |
| 165 | - * | |
| 166 | - * The body MUST be a StreamInterface object. | |
| 167 | - * | |
| 168 | - * This method MUST be implemented in such a way as to retain the | |
| 169 | - * immutability of the message, and MUST return a new instance that has the | |
| 170 | - * new body stream. | |
| 171 | - * | |
| 172 | - * @param StreamInterface $body Body. | |
| 173 | - * @return static | |
| 174 | - * @throws \InvalidArgumentException When the body is not valid. | |
| 175 | - */ | |
| 176 | - public function withBody(StreamInterface $body) : MessageInterface; | |
| 19 | + /** | |
| 20 | + * Retrieves the HTTP protocol version as a string. | |
| 21 | + * | |
| 22 | + * The string MUST contain only the HTTP version number (e.g., "1.1", "1.0"). | |
| 23 | + * | |
| 24 | + * @return string HTTP protocol version. | |
| 25 | + */ | |
| 26 | + public function getProtocolVersion() : string; | |
| 27 | + /** | |
| 28 | + * Return an instance with the specified HTTP protocol version. | |
| 29 | + * | |
| 30 | + * The version string MUST contain only the HTTP version number (e.g., | |
| 31 | + * "1.1", "1.0"). | |
| 32 | + * | |
| 33 | + * This method MUST be implemented in such a way as to retain the | |
| 34 | + * immutability of the message, and MUST return an instance that has the | |
| 35 | + * new protocol version. | |
| 36 | + * | |
| 37 | + * @param string $version HTTP protocol version | |
| 38 | + * @return static | |
| 39 | + */ | |
| 40 | + public function withProtocolVersion(string $version) : MessageInterface; | |
| 41 | + /** | |
| 42 | + * Retrieves all message header values. | |
| 43 | + * | |
| 44 | + * The keys represent the header name as it will be sent over the wire, and | |
| 45 | + * each value is an array of strings associated with the header. | |
| 46 | + * | |
| 47 | + * // Represent the headers as a string | |
| 48 | +	 *     foreach ($message->getHeaders() as $name => $values) { | |
| 49 | +	 *         echo $name . ": " . implode(", ", $values); | |
| 50 | + * } | |
| 51 | + * | |
| 52 | + * // Emit headers iteratively: | |
| 53 | +	 *     foreach ($message->getHeaders() as $name => $values) { | |
| 54 | +	 *         foreach ($values as $value) { | |
| 55 | +	 *             header(sprintf('%s: %s', $name, $value), false); | |
| 56 | + * } | |
| 57 | + * } | |
| 58 | + * | |
| 59 | + * While header names are not case-sensitive, getHeaders() will preserve the | |
| 60 | + * exact case in which headers were originally specified. | |
| 61 | + * | |
| 62 | + * @return string[][] Returns an associative array of the message's headers. Each | |
| 63 | + * key MUST be a header name, and each value MUST be an array of strings | |
| 64 | + * for that header. | |
| 65 | + */ | |
| 66 | + public function getHeaders() : array; | |
| 67 | + /** | |
| 68 | + * Checks if a header exists by the given case-insensitive name. | |
| 69 | + * | |
| 70 | + * @param string $name Case-insensitive header field name. | |
| 71 | + * @return bool Returns true if any header names match the given header | |
| 72 | + * name using a case-insensitive string comparison. Returns false if | |
| 73 | + * no matching header name is found in the message. | |
| 74 | + */ | |
| 75 | + public function hasHeader(string $name) : bool; | |
| 76 | + /** | |
| 77 | + * Retrieves a message header value by the given case-insensitive name. | |
| 78 | + * | |
| 79 | + * This method returns an array of all the header values of the given | |
| 80 | + * case-insensitive header name. | |
| 81 | + * | |
| 82 | + * If the header does not appear in the message, this method MUST return an | |
| 83 | + * empty array. | |
| 84 | + * | |
| 85 | + * @param string $name Case-insensitive header field name. | |
| 86 | + * @return string[] An array of string values as provided for the given | |
| 87 | + * header. If the header does not appear in the message, this method MUST | |
| 88 | + * return an empty array. | |
| 89 | + */ | |
| 90 | + public function getHeader(string $name) : array; | |
| 91 | + /** | |
| 92 | + * Retrieves a comma-separated string of the values for a single header. | |
| 93 | + * | |
| 94 | + * This method returns all of the header values of the given | |
| 95 | + * case-insensitive header name as a string concatenated together using | |
| 96 | + * a comma. | |
| 97 | + * | |
| 98 | + * NOTE: Not all header values may be appropriately represented using | |
| 99 | + * comma concatenation. For such headers, use getHeader() instead | |
| 100 | + * and supply your own delimiter when concatenating. | |
| 101 | + * | |
| 102 | + * If the header does not appear in the message, this method MUST return | |
| 103 | + * an empty string. | |
| 104 | + * | |
| 105 | + * @param string $name Case-insensitive header field name. | |
| 106 | + * @return string A string of values as provided for the given header | |
| 107 | + * concatenated together using a comma. If the header does not appear in | |
| 108 | + * the message, this method MUST return an empty string. | |
| 109 | + */ | |
| 110 | + public function getHeaderLine(string $name) : string; | |
| 111 | + /** | |
| 112 | + * Return an instance with the provided value replacing the specified header. | |
| 113 | + * | |
| 114 | + * While header names are case-insensitive, the casing of the header will | |
| 115 | + * be preserved by this function, and returned from getHeaders(). | |
| 116 | + * | |
| 117 | + * This method MUST be implemented in such a way as to retain the | |
| 118 | + * immutability of the message, and MUST return an instance that has the | |
| 119 | + * new and/or updated header and value. | |
| 120 | + * | |
| 121 | + * @param string $name Case-insensitive header field name. | |
| 122 | + * @param string|string[] $value Header value(s). | |
| 123 | + * @return static | |
| 124 | + * @throws \InvalidArgumentException for invalid header names or values. | |
| 125 | + */ | |
| 126 | + public function withHeader(string $name, $value) : MessageInterface; | |
| 127 | + /** | |
| 128 | + * Return an instance with the specified header appended with the given value. | |
| 129 | + * | |
| 130 | + * Existing values for the specified header will be maintained. The new | |
| 131 | + * value(s) will be appended to the existing list. If the header did not | |
| 132 | + * exist previously, it will be added. | |
| 133 | + * | |
| 134 | + * This method MUST be implemented in such a way as to retain the | |
| 135 | + * immutability of the message, and MUST return an instance that has the | |
| 136 | + * new header and/or value. | |
| 137 | + * | |
| 138 | + * @param string $name Case-insensitive header field name to add. | |
| 139 | + * @param string|string[] $value Header value(s). | |
| 140 | + * @return static | |
| 141 | + * @throws \InvalidArgumentException for invalid header names or values. | |
| 142 | + */ | |
| 143 | + public function withAddedHeader(string $name, $value) : MessageInterface; | |
| 144 | + /** | |
| 145 | + * Return an instance without the specified header. | |
| 146 | + * | |
| 147 | + * Header resolution MUST be done without case-sensitivity. | |
| 148 | + * | |
| 149 | + * This method MUST be implemented in such a way as to retain the | |
| 150 | + * immutability of the message, and MUST return an instance that removes | |
| 151 | + * the named header. | |
| 152 | + * | |
| 153 | + * @param string $name Case-insensitive header field name to remove. | |
| 154 | + * @return static | |
| 155 | + */ | |
| 156 | + public function withoutHeader(string $name) : MessageInterface; | |
| 157 | + /** | |
| 158 | + * Gets the body of the message. | |
| 159 | + * | |
| 160 | + * @return StreamInterface Returns the body as a stream. | |
| 161 | + */ | |
| 162 | + public function getBody() : StreamInterface; | |
| 163 | + /** | |
| 164 | + * Return an instance with the specified message body. | |
| 165 | + * | |
| 166 | + * The body MUST be a StreamInterface object. | |
| 167 | + * | |
| 168 | + * This method MUST be implemented in such a way as to retain the | |
| 169 | + * immutability of the message, and MUST return a new instance that has the | |
| 170 | + * new body stream. | |
| 171 | + * | |
| 172 | + * @param StreamInterface $body Body. | |
| 173 | + * @return static | |
| 174 | + * @throws \InvalidArgumentException When the body is not valid. | |
| 175 | + */ | |
| 176 | + public function withBody(StreamInterface $body) : MessageInterface; | |
| 177 | 177 | } | 
| @@ -21,8 +21,7 @@ | ||
| 21 | 21 | * be implemented such that they retain the internal state of the current | 
| 22 | 22 | * message and return an instance that contains the changed state. | 
| 23 | 23 | */ | 
| 24 | -interface RequestInterface extends MessageInterface | |
| 25 | -{ | |
| 24 | +interface RequestInterface extends MessageInterface { | |
| 26 | 25 | /** | 
| 27 | 26 | * Retrieves the message's request target. | 
| 28 | 27 | * | 
| @@ -23,102 +23,102 @@ | ||
| 23 | 23 | */ | 
| 24 | 24 | interface RequestInterface extends MessageInterface | 
| 25 | 25 |  { | 
| 26 | - /** | |
| 27 | - * Retrieves the message's request target. | |
| 28 | - * | |
| 29 | - * Retrieves the message's request-target either as it will appear (for | |
| 30 | - * clients), as it appeared at request (for servers), or as it was | |
| 31 | - * specified for the instance (see withRequestTarget()). | |
| 32 | - * | |
| 33 | - * In most cases, this will be the origin-form of the composed URI, | |
| 34 | - * unless a value was provided to the concrete implementation (see | |
| 35 | - * withRequestTarget() below). | |
| 36 | - * | |
| 37 | - * If no URI is available, and no request-target has been specifically | |
| 38 | - * provided, this method MUST return the string "/". | |
| 39 | - * | |
| 40 | - * @return string | |
| 41 | - */ | |
| 42 | - public function getRequestTarget() : string; | |
| 43 | - /** | |
| 44 | - * Return an instance with the specific request-target. | |
| 45 | - * | |
| 46 | - * If the request needs a non-origin-form request-target — e.g., for | |
| 47 | - * specifying an absolute-form, authority-form, or asterisk-form — | |
| 48 | - * this method may be used to create an instance with the specified | |
| 49 | - * request-target, verbatim. | |
| 50 | - * | |
| 51 | - * This method MUST be implemented in such a way as to retain the | |
| 52 | - * immutability of the message, and MUST return an instance that has the | |
| 53 | - * changed request target. | |
| 54 | - * | |
| 55 | - * @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various | |
| 56 | - * request-target forms allowed in request messages) | |
| 57 | - * @param string $requestTarget | |
| 58 | - * @return static | |
| 59 | - */ | |
| 60 | - public function withRequestTarget(string $requestTarget) : RequestInterface; | |
| 61 | - /** | |
| 62 | - * Retrieves the HTTP method of the request. | |
| 63 | - * | |
| 64 | - * @return string Returns the request method. | |
| 65 | - */ | |
| 66 | - public function getMethod() : string; | |
| 67 | - /** | |
| 68 | - * Return an instance with the provided HTTP method. | |
| 69 | - * | |
| 70 | - * While HTTP method names are typically all uppercase characters, HTTP | |
| 71 | - * method names are case-sensitive and thus implementations SHOULD NOT | |
| 72 | - * modify the given string. | |
| 73 | - * | |
| 74 | - * This method MUST be implemented in such a way as to retain the | |
| 75 | - * immutability of the message, and MUST return an instance that has the | |
| 76 | - * changed request method. | |
| 77 | - * | |
| 78 | - * @param string $method Case-sensitive method. | |
| 79 | - * @return static | |
| 80 | - * @throws \InvalidArgumentException for invalid HTTP methods. | |
| 81 | - */ | |
| 82 | - public function withMethod(string $method) : RequestInterface; | |
| 83 | - /** | |
| 84 | - * Retrieves the URI instance. | |
| 85 | - * | |
| 86 | - * This method MUST return a UriInterface instance. | |
| 87 | - * | |
| 88 | - * @link http://tools.ietf.org/html/rfc3986#section-4.3 | |
| 89 | - * @return UriInterface Returns a UriInterface instance | |
| 90 | - * representing the URI of the request. | |
| 91 | - */ | |
| 92 | - public function getUri() : UriInterface; | |
| 93 | - /** | |
| 94 | - * Returns an instance with the provided URI. | |
| 95 | - * | |
| 96 | - * This method MUST update the Host header of the returned request by | |
| 97 | - * default if the URI contains a host component. If the URI does not | |
| 98 | - * contain a host component, any pre-existing Host header MUST be carried | |
| 99 | - * over to the returned request. | |
| 100 | - * | |
| 101 | - * You can opt-in to preserving the original state of the Host header by | |
| 102 | - * setting `$preserveHost` to `true`. When `$preserveHost` is set to | |
| 103 | - * `true`, this method interacts with the Host header in the following ways: | |
| 104 | - * | |
| 105 | - * - If the Host header is missing or empty, and the new URI contains | |
| 106 | - * a host component, this method MUST update the Host header in the returned | |
| 107 | - * request. | |
| 108 | - * - If the Host header is missing or empty, and the new URI does not contain a | |
| 109 | - * host component, this method MUST NOT update the Host header in the returned | |
| 110 | - * request. | |
| 111 | - * - If a Host header is present and non-empty, this method MUST NOT update | |
| 112 | - * the Host header in the returned request. | |
| 113 | - * | |
| 114 | - * This method MUST be implemented in such a way as to retain the | |
| 115 | - * immutability of the message, and MUST return an instance that has the | |
| 116 | - * new UriInterface instance. | |
| 117 | - * | |
| 118 | - * @link http://tools.ietf.org/html/rfc3986#section-4.3 | |
| 119 | - * @param UriInterface $uri New request URI to use. | |
| 120 | - * @param bool $preserveHost Preserve the original state of the Host header. | |
| 121 | - * @return static | |
| 122 | - */ | |
| 123 | - public function withUri(UriInterface $uri, bool $preserveHost = \false) : RequestInterface; | |
| 26 | + /** | |
| 27 | + * Retrieves the message's request target. | |
| 28 | + * | |
| 29 | + * Retrieves the message's request-target either as it will appear (for | |
| 30 | + * clients), as it appeared at request (for servers), or as it was | |
| 31 | + * specified for the instance (see withRequestTarget()). | |
| 32 | + * | |
| 33 | + * In most cases, this will be the origin-form of the composed URI, | |
| 34 | + * unless a value was provided to the concrete implementation (see | |
| 35 | + * withRequestTarget() below). | |
| 36 | + * | |
| 37 | + * If no URI is available, and no request-target has been specifically | |
| 38 | + * provided, this method MUST return the string "/". | |
| 39 | + * | |
| 40 | + * @return string | |
| 41 | + */ | |
| 42 | + public function getRequestTarget() : string; | |
| 43 | + /** | |
| 44 | + * Return an instance with the specific request-target. | |
| 45 | + * | |
| 46 | + * If the request needs a non-origin-form request-target — e.g., for | |
| 47 | + * specifying an absolute-form, authority-form, or asterisk-form — | |
| 48 | + * this method may be used to create an instance with the specified | |
| 49 | + * request-target, verbatim. | |
| 50 | + * | |
| 51 | + * This method MUST be implemented in such a way as to retain the | |
| 52 | + * immutability of the message, and MUST return an instance that has the | |
| 53 | + * changed request target. | |
| 54 | + * | |
| 55 | + * @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various | |
| 56 | + * request-target forms allowed in request messages) | |
| 57 | + * @param string $requestTarget | |
| 58 | + * @return static | |
| 59 | + */ | |
| 60 | + public function withRequestTarget(string $requestTarget) : RequestInterface; | |
| 61 | + /** | |
| 62 | + * Retrieves the HTTP method of the request. | |
| 63 | + * | |
| 64 | + * @return string Returns the request method. | |
| 65 | + */ | |
| 66 | + public function getMethod() : string; | |
| 67 | + /** | |
| 68 | + * Return an instance with the provided HTTP method. | |
| 69 | + * | |
| 70 | + * While HTTP method names are typically all uppercase characters, HTTP | |
| 71 | + * method names are case-sensitive and thus implementations SHOULD NOT | |
| 72 | + * modify the given string. | |
| 73 | + * | |
| 74 | + * This method MUST be implemented in such a way as to retain the | |
| 75 | + * immutability of the message, and MUST return an instance that has the | |
| 76 | + * changed request method. | |
| 77 | + * | |
| 78 | + * @param string $method Case-sensitive method. | |
| 79 | + * @return static | |
| 80 | + * @throws \InvalidArgumentException for invalid HTTP methods. | |
| 81 | + */ | |
| 82 | + public function withMethod(string $method) : RequestInterface; | |
| 83 | + /** | |
| 84 | + * Retrieves the URI instance. | |
| 85 | + * | |
| 86 | + * This method MUST return a UriInterface instance. | |
| 87 | + * | |
| 88 | + * @link http://tools.ietf.org/html/rfc3986#section-4.3 | |
| 89 | + * @return UriInterface Returns a UriInterface instance | |
| 90 | + * representing the URI of the request. | |
| 91 | + */ | |
| 92 | + public function getUri() : UriInterface; | |
| 93 | + /** | |
| 94 | + * Returns an instance with the provided URI. | |
| 95 | + * | |
| 96 | + * This method MUST update the Host header of the returned request by | |
| 97 | + * default if the URI contains a host component. If the URI does not | |
| 98 | + * contain a host component, any pre-existing Host header MUST be carried | |
| 99 | + * over to the returned request. | |
| 100 | + * | |
| 101 | + * You can opt-in to preserving the original state of the Host header by | |
| 102 | + * setting `$preserveHost` to `true`. When `$preserveHost` is set to | |
| 103 | + * `true`, this method interacts with the Host header in the following ways: | |
| 104 | + * | |
| 105 | + * - If the Host header is missing or empty, and the new URI contains | |
| 106 | + * a host component, this method MUST update the Host header in the returned | |
| 107 | + * request. | |
| 108 | + * - If the Host header is missing or empty, and the new URI does not contain a | |
| 109 | + * host component, this method MUST NOT update the Host header in the returned | |
| 110 | + * request. | |
| 111 | + * - If a Host header is present and non-empty, this method MUST NOT update | |
| 112 | + * the Host header in the returned request. | |
| 113 | + * | |
| 114 | + * This method MUST be implemented in such a way as to retain the | |
| 115 | + * immutability of the message, and MUST return an instance that has the | |
| 116 | + * new UriInterface instance. | |
| 117 | + * | |
| 118 | + * @link http://tools.ietf.org/html/rfc3986#section-4.3 | |
| 119 | + * @param UriInterface $uri New request URI to use. | |
| 120 | + * @param bool $preserveHost Preserve the original state of the Host header. | |
| 121 | + * @return static | |
| 122 | + */ | |
| 123 | + public function withUri(UriInterface $uri, bool $preserveHost = \false) : RequestInterface; | |
| 124 | 124 | } | 
| @@ -10,8 +10,7 @@ | ||
| 10 | 10 | * state of the current instance and return an instance that contains the | 
| 11 | 11 | * changed state. | 
| 12 | 12 | */ | 
| 13 | -interface UploadedFileInterface | |
| 14 | -{ | |
| 13 | +interface UploadedFileInterface { | |
| 15 | 14 | /** | 
| 16 | 15 | * Retrieve a stream representing the uploaded file. | 
| 17 | 16 | * | 
| @@ -12,107 +12,107 @@ | ||
| 12 | 12 | */ | 
| 13 | 13 | interface UploadedFileInterface | 
| 14 | 14 |  { | 
| 15 | - /** | |
| 16 | - * Retrieve a stream representing the uploaded file. | |
| 17 | - * | |
| 18 | - * This method MUST return a StreamInterface instance, representing the | |
| 19 | - * uploaded file. The purpose of this method is to allow utilizing native PHP | |
| 20 | - * stream functionality to manipulate the file upload, such as | |
| 21 | - * stream_copy_to_stream() (though the result will need to be decorated in a | |
| 22 | - * native PHP stream wrapper to work with such functions). | |
| 23 | - * | |
| 24 | - * If the moveTo() method has been called previously, this method MUST raise | |
| 25 | - * an exception. | |
| 26 | - * | |
| 27 | - * @return StreamInterface Stream representation of the uploaded file. | |
| 28 | - * @throws \RuntimeException in cases when no stream is available or can be | |
| 29 | - * created. | |
| 30 | - */ | |
| 31 | - public function getStream() : StreamInterface; | |
| 32 | - /** | |
| 33 | - * Move the uploaded file to a new location. | |
| 34 | - * | |
| 35 | - * Use this method as an alternative to move_uploaded_file(). This method is | |
| 36 | - * guaranteed to work in both SAPI and non-SAPI environments. | |
| 37 | - * Implementations must determine which environment they are in, and use the | |
| 38 | - * appropriate method (move_uploaded_file(), rename(), or a stream | |
| 39 | - * operation) to perform the operation. | |
| 40 | - * | |
| 41 | - * $targetPath may be an absolute path, or a relative path. If it is a | |
| 42 | - * relative path, resolution should be the same as used by PHP's rename() | |
| 43 | - * function. | |
| 44 | - * | |
| 45 | - * The original file or stream MUST be removed on completion. | |
| 46 | - * | |
| 47 | - * If this method is called more than once, any subsequent calls MUST raise | |
| 48 | - * an exception. | |
| 49 | - * | |
| 50 | - * When used in an SAPI environment where $_FILES is populated, when writing | |
| 51 | - * files via moveTo(), is_uploaded_file() and move_uploaded_file() SHOULD be | |
| 52 | - * used to ensure permissions and upload status are verified correctly. | |
| 53 | - * | |
| 54 | - * If you wish to move to a stream, use getStream(), as SAPI operations | |
| 55 | - * cannot guarantee writing to stream destinations. | |
| 56 | - * | |
| 57 | - * @see http://php.net/is_uploaded_file | |
| 58 | - * @see http://php.net/move_uploaded_file | |
| 59 | - * @param string $targetPath Path to which to move the uploaded file. | |
| 60 | - * @throws \InvalidArgumentException if the $targetPath specified is invalid. | |
| 61 | - * @throws \RuntimeException on any error during the move operation, or on | |
| 62 | - * the second or subsequent call to the method. | |
| 63 | - */ | |
| 64 | - public function moveTo(string $targetPath) : void; | |
| 65 | - /** | |
| 66 | - * Retrieve the file size. | |
| 67 | - * | |
| 68 | - * Implementations SHOULD return the value stored in the "size" key of | |
| 69 | - * the file in the $_FILES array if available, as PHP calculates this based | |
| 70 | - * on the actual size transmitted. | |
| 71 | - * | |
| 72 | - * @return int|null The file size in bytes or null if unknown. | |
| 73 | - */ | |
| 74 | - public function getSize() : ?int; | |
| 75 | - /** | |
| 76 | - * Retrieve the error associated with the uploaded file. | |
| 77 | - * | |
| 78 | - * The return value MUST be one of PHP's UPLOAD_ERR_XXX constants. | |
| 79 | - * | |
| 80 | - * If the file was uploaded successfully, this method MUST return | |
| 81 | - * UPLOAD_ERR_OK. | |
| 82 | - * | |
| 83 | - * Implementations SHOULD return the value stored in the "error" key of | |
| 84 | - * the file in the $_FILES array. | |
| 85 | - * | |
| 86 | - * @see http://php.net/manual/en/features.file-upload.errors.php | |
| 87 | - * @return int One of PHP's UPLOAD_ERR_XXX constants. | |
| 88 | - */ | |
| 89 | - public function getError() : int; | |
| 90 | - /** | |
| 91 | - * Retrieve the filename sent by the client. | |
| 92 | - * | |
| 93 | - * Do not trust the value returned by this method. A client could send | |
| 94 | - * a malicious filename with the intention to corrupt or hack your | |
| 95 | - * application. | |
| 96 | - * | |
| 97 | - * Implementations SHOULD return the value stored in the "name" key of | |
| 98 | - * the file in the $_FILES array. | |
| 99 | - * | |
| 100 | - * @return string|null The filename sent by the client or null if none | |
| 101 | - * was provided. | |
| 102 | - */ | |
| 103 | - public function getClientFilename() : ?string; | |
| 104 | - /** | |
| 105 | - * Retrieve the media type sent by the client. | |
| 106 | - * | |
| 107 | - * Do not trust the value returned by this method. A client could send | |
| 108 | - * a malicious media type with the intention to corrupt or hack your | |
| 109 | - * application. | |
| 110 | - * | |
| 111 | - * Implementations SHOULD return the value stored in the "type" key of | |
| 112 | - * the file in the $_FILES array. | |
| 113 | - * | |
| 114 | - * @return string|null The media type sent by the client or null if none | |
| 115 | - * was provided. | |
| 116 | - */ | |
| 117 | - public function getClientMediaType() : ?string; | |
| 15 | + /** | |
| 16 | + * Retrieve a stream representing the uploaded file. | |
| 17 | + * | |
| 18 | + * This method MUST return a StreamInterface instance, representing the | |
| 19 | + * uploaded file. The purpose of this method is to allow utilizing native PHP | |
| 20 | + * stream functionality to manipulate the file upload, such as | |
| 21 | + * stream_copy_to_stream() (though the result will need to be decorated in a | |
| 22 | + * native PHP stream wrapper to work with such functions). | |
| 23 | + * | |
| 24 | + * If the moveTo() method has been called previously, this method MUST raise | |
| 25 | + * an exception. | |
| 26 | + * | |
| 27 | + * @return StreamInterface Stream representation of the uploaded file. | |
| 28 | + * @throws \RuntimeException in cases when no stream is available or can be | |
| 29 | + * created. | |
| 30 | + */ | |
| 31 | + public function getStream() : StreamInterface; | |
| 32 | + /** | |
| 33 | + * Move the uploaded file to a new location. | |
| 34 | + * | |
| 35 | + * Use this method as an alternative to move_uploaded_file(). This method is | |
| 36 | + * guaranteed to work in both SAPI and non-SAPI environments. | |
| 37 | + * Implementations must determine which environment they are in, and use the | |
| 38 | + * appropriate method (move_uploaded_file(), rename(), or a stream | |
| 39 | + * operation) to perform the operation. | |
| 40 | + * | |
| 41 | + * $targetPath may be an absolute path, or a relative path. If it is a | |
| 42 | + * relative path, resolution should be the same as used by PHP's rename() | |
| 43 | + * function. | |
| 44 | + * | |
| 45 | + * The original file or stream MUST be removed on completion. | |
| 46 | + * | |
| 47 | + * If this method is called more than once, any subsequent calls MUST raise | |
| 48 | + * an exception. | |
| 49 | + * | |
| 50 | + * When used in an SAPI environment where $_FILES is populated, when writing | |
| 51 | + * files via moveTo(), is_uploaded_file() and move_uploaded_file() SHOULD be | |
| 52 | + * used to ensure permissions and upload status are verified correctly. | |
| 53 | + * | |
| 54 | + * If you wish to move to a stream, use getStream(), as SAPI operations | |
| 55 | + * cannot guarantee writing to stream destinations. | |
| 56 | + * | |
| 57 | + * @see http://php.net/is_uploaded_file | |
| 58 | + * @see http://php.net/move_uploaded_file | |
| 59 | + * @param string $targetPath Path to which to move the uploaded file. | |
| 60 | + * @throws \InvalidArgumentException if the $targetPath specified is invalid. | |
| 61 | + * @throws \RuntimeException on any error during the move operation, or on | |
| 62 | + * the second or subsequent call to the method. | |
| 63 | + */ | |
| 64 | + public function moveTo(string $targetPath) : void; | |
| 65 | + /** | |
| 66 | + * Retrieve the file size. | |
| 67 | + * | |
| 68 | + * Implementations SHOULD return the value stored in the "size" key of | |
| 69 | + * the file in the $_FILES array if available, as PHP calculates this based | |
| 70 | + * on the actual size transmitted. | |
| 71 | + * | |
| 72 | + * @return int|null The file size in bytes or null if unknown. | |
| 73 | + */ | |
| 74 | + public function getSize() : ?int; | |
| 75 | + /** | |
| 76 | + * Retrieve the error associated with the uploaded file. | |
| 77 | + * | |
| 78 | + * The return value MUST be one of PHP's UPLOAD_ERR_XXX constants. | |
| 79 | + * | |
| 80 | + * If the file was uploaded successfully, this method MUST return | |
| 81 | + * UPLOAD_ERR_OK. | |
| 82 | + * | |
| 83 | + * Implementations SHOULD return the value stored in the "error" key of | |
| 84 | + * the file in the $_FILES array. | |
| 85 | + * | |
| 86 | + * @see http://php.net/manual/en/features.file-upload.errors.php | |
| 87 | + * @return int One of PHP's UPLOAD_ERR_XXX constants. | |
| 88 | + */ | |
| 89 | + public function getError() : int; | |
| 90 | + /** | |
| 91 | + * Retrieve the filename sent by the client. | |
| 92 | + * | |
| 93 | + * Do not trust the value returned by this method. A client could send | |
| 94 | + * a malicious filename with the intention to corrupt or hack your | |
| 95 | + * application. | |
| 96 | + * | |
| 97 | + * Implementations SHOULD return the value stored in the "name" key of | |
| 98 | + * the file in the $_FILES array. | |
| 99 | + * | |
| 100 | + * @return string|null The filename sent by the client or null if none | |
| 101 | + * was provided. | |
| 102 | + */ | |
| 103 | + public function getClientFilename() : ?string; | |
| 104 | + /** | |
| 105 | + * Retrieve the media type sent by the client. | |
| 106 | + * | |
| 107 | + * Do not trust the value returned by this method. A client could send | |
| 108 | + * a malicious media type with the intention to corrupt or hack your | |
| 109 | + * application. | |
| 110 | + * | |
| 111 | + * Implementations SHOULD return the value stored in the "type" key of | |
| 112 | + * the file in the $_FILES array. | |
| 113 | + * | |
| 114 | + * @return string|null The media type sent by the client or null if none | |
| 115 | + * was provided. | |
| 116 | + */ | |
| 117 | + public function getClientMediaType() : ?string; | |
| 118 | 118 | } |