diff --git a/composer.json b/composer.json index 030669b..172e801 100644 --- a/composer.json +++ b/composer.json @@ -12,15 +12,15 @@ } ], "require": { - "php": ">=5.4.0" + "php": ">=5.4.0", + "psr/http-message": "dev-master" }, "require-dev": { - "phpunit/phpunit": "~4.5" + "phpunit/phpunit": "4.5.x" }, "autoload": { "psr-4": { - "WellRESTed\\" : "src/", - "Psr\\Http\\Message\\": "srcPsr/" + "WellRESTed\\" : "src/" }, "classmap": ["src/HttpExceptions.php"] } diff --git a/composer.lock b/composer.lock index d34c80c..000ee41 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,55 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f932f69dafff860d85b46ee774dd8aa2", - "packages": [], + "hash": "825703713a0e0eab25f1de28f7cc1c33", + "packages": [ + { + "name": "psr/http-message", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "9723465b3e7c8ecb0436f066bfb8a13e1bac1789" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/9723465b3e7c8ecb0436f066bfb8a13e1bac1789", + "reference": "9723465b3e7c8ecb0436f066bfb8a13e1bac1789", + "shasum": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2015-04-13 14:20:01" + } + ], "packages-dev": [ { "name": "doctrine/instantiator", @@ -234,33 +281,31 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.0", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, "autoload": { "classmap": [ - "src/" + "File/" ] }, "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], "license": [ "BSD-3-Clause" ], @@ -277,7 +322,7 @@ "filesystem", "iterator" ], - "time": "2015-04-02 05:19:05" + "time": "2013-10-10 15:34:57" }, { "name": "phpunit/php-text-template", @@ -418,16 +463,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.6.4", + "version": "4.5.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "163232991e652e6efed2f8470326fffa61e848e2" + "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/163232991e652e6efed2f8470326fffa61e848e2", - "reference": "163232991e652e6efed2f8470326fffa61e848e2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4", + "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4", "shasum": "" }, "require": { @@ -439,17 +484,17 @@ "php": ">=5.3.3", "phpspec/prophecy": "~1.3,>=1.3.1", "phpunit/php-code-coverage": "~2.0,>=2.0.11", - "phpunit/php-file-iterator": "~1.4", + "phpunit/php-file-iterator": "~1.3.2", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0", + "phpunit/php-timer": "~1.0.2", "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.2", + "sebastian/diff": "~1.1", "sebastian/environment": "~1.2", "sebastian/exporter": "~1.2", "sebastian/global-state": "~1.0", "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" + "symfony/yaml": "~2.0" }, "suggest": { "phpunit/php-invoker": "~1.1" @@ -460,7 +505,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.6.x-dev" + "dev-master": "4.5.x-dev" } }, "autoload": { @@ -486,7 +531,7 @@ "testing", "xunit" ], - "time": "2015-04-11 05:23:21" + "time": "2015-03-29 09:24:05" }, { "name": "phpunit/phpunit-mock-objects", @@ -967,7 +1012,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "psr/http-message": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/Message/Message.php b/src/Message/Message.php index 9f24daa..fc791da 100644 --- a/src/Message/Message.php +++ b/src/Message/Message.php @@ -3,14 +3,14 @@ namespace WellRESTed\Message; use Psr\Http\Message\MessageInterface; -use Psr\Http\Message\StreamableInterface; +use Psr\Http\Message\StreamInterface; use WellRESTed\Stream\NullStream; abstract class Message implements MessageInterface { /** @var HeaderCollection */ protected $headers; - /** @var StreamableInterface */ + /** @var StreamInterface */ protected $body; /** @var string */ protected $protcolVersion = "1.1"; @@ -224,7 +224,7 @@ abstract class Message implements MessageInterface /** * Gets the body of the message. * - * @return StreamableInterface Returns the body as a stream. + * @return StreamInterface Returns the body as a stream. */ public function getBody() { @@ -234,17 +234,17 @@ abstract class Message implements MessageInterface /** * Create a new instance, with the specified message body. * - * The body MUST be a StreamableInterface object. + * The body MUST be a StreamInterface object. * * This method MUST be implemented in such a way as to retain the * immutability of the message, and MUST return a new instance that has the * new body stream. * - * @param StreamableInterface $body Body. + * @param StreamInterface $body Body. * @return self * @throws \InvalidArgumentException When the body is not valid. */ - public function withBody(StreamableInterface $body) + public function withBody(StreamInterface $body) { $message = clone $this; $message->body = $body; diff --git a/src/Message/ServerRequest.php b/src/Message/ServerRequest.php index ec1a5b4..715c755 100644 --- a/src/Message/ServerRequest.php +++ b/src/Message/ServerRequest.php @@ -2,8 +2,9 @@ namespace WellRESTed\Message; +use Psr\Http\Message\An; use Psr\Http\Message\ServerRequestInterface; -use Psr\Http\Message\StreamableInterface; +use Psr\Http\Message\StreamInterface; use WellRESTed\Stream\Stream; class ServerRequest extends Request implements ServerRequestInterface @@ -338,9 +339,9 @@ class ServerRequest extends Request implements ServerRequestInterface /** * Return a stream representing the request's body. * - * Override this method to use a specific StreamableInterface implementation. + * Override this method to use a specific StreamInterface implementation. * - * @return StreamableInterface + * @return StreamInterface */ protected function getStreamForBody() { @@ -368,4 +369,37 @@ class ServerRequest extends Request implements ServerRequestInterface } return $headers; } + + /** + * Retrieve normalized file upload data. + * + * This method returns upload metadata in a normalized tree, with each leaf + * an instance of Psr\Http\Message\UploadedFileInterface. + * + * These values MAY be prepared from $_FILES or the message body during + * instantiation, or MAY be injected via withUploadedFiles(). + * + * @return array An array tree of UploadedFileInterface instances; an empty + * array MUST be returned if no data is present. + */ + public function getUploadedFiles() + { + // TODO: Implement getUploadedFiles() method. + } + + /** + * Create a new instance with the specified uploaded files. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param array An array tree of UploadedFileInterface instances. + * @return self + * @throws \InvalidArgumentException if an invalid structure is provided. + */ + public function withUploadedFiles(array $uploadedFiles) + { + // TODO: Implement withUploadedFiles() method. + } } diff --git a/src/Routing/Responder.php b/src/Routing/Responder.php index 06d47fd..c13141f 100644 --- a/src/Routing/Responder.php +++ b/src/Routing/Responder.php @@ -3,7 +3,7 @@ namespace WellRESTed\Routing; use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\StreamableInterface; +use Psr\Http\Message\StreamInterface; class Responder implements ResponderInterface { @@ -53,7 +53,7 @@ class Responder implements ResponderInterface } } - private function outputBody(StreamableInterface $body) + private function outputBody(StreamInterface $body) { if ($this->chunkSize > 0) { $body->rewind(); diff --git a/src/Stream/NullStream.php b/src/Stream/NullStream.php index 444ec96..c8d837e 100644 --- a/src/Stream/NullStream.php +++ b/src/Stream/NullStream.php @@ -2,9 +2,9 @@ namespace WellRESTed\Stream; -use Psr\Http\Message\StreamableInterface; +use Psr\Http\Message\StreamInterface; -class NullStream implements StreamableInterface +class NullStream implements StreamInterface { /** * Reads all data from the stream into a string, from the beginning to end. diff --git a/src/Stream/Stream.php b/src/Stream/Stream.php index 6257298..6f5b1e8 100644 --- a/src/Stream/Stream.php +++ b/src/Stream/Stream.php @@ -2,9 +2,9 @@ namespace WellRESTed\Stream; -use Psr\Http\Message\StreamableInterface; +use Psr\Http\Message\StreamInterface; -class Stream implements StreamableInterface +class Stream implements StreamInterface { /** @var resource */ private $resource; diff --git a/srcPsr/MessageInterface.php b/srcPsr/MessageInterface.php deleted file mode 100644 index f7f3560..0000000 --- a/srcPsr/MessageInterface.php +++ /dev/null @@ -1,190 +0,0 @@ -getHeaders() as $name => $values) { - * echo $name . ": " . implode(", ", $values); - * } - * - * // Emit headers iteratively: - * foreach ($message->getHeaders() as $name => $values) { - * foreach ($values as $value) { - * header(sprintf('%s: %s', $name, $value), false); - * } - * } - * - * While header names are not case-sensitive, getHeaders() will preserve the - * exact case in which headers were originally specified. - * - * @return array Returns an associative array of the message's headers. Each - * key MUST be a header name, and each value MUST be an array of strings - * for that header. - */ - public function getHeaders(); - - /** - * Checks if a header exists by the given case-insensitive name. - * - * @param string $name Case-insensitive header field name. - * @return bool Returns true if any header names match the given header - * name using a case-insensitive string comparison. Returns false if - * no matching header name is found in the message. - */ - public function hasHeader($name); - - /** - * Retrieves a message header value by the given case-insensitive name. - * - * This method returns an array of all the header values of the given - * case-insensitive header name. - * - * If the header does not appear in the message, this method MUST return an - * empty array. - * - * @param string $name Case-insensitive header field name. - * @return string[] An array of string values as provided for the given - * header. If the header does not appear in the message, this method MUST - * return an empty array. - */ - public function getHeader($name); - - /** - * Retrieves the line for a single header, with the header values as a - * comma-separated string. - * - * This method returns all of the header values of the given - * case-insensitive header name as a string concatenated together using - * a comma. - * - * NOTE: Not all header values may be appropriately represented using - * comma concatenation. For such headers, use getHeader() instead - * and supply your own delimiter when concatenating. - * - * If the header does not appear in the message, this method MUST return - * a null value. - * - * @param string $name Case-insensitive header field name. - * @return string|null A string of values as provided for the given header - * concatenated together using a comma. If the header does not appear in - * the message, this method MUST return a null value. - */ - public function getHeaderLine($name); - - /** - * Return an instance with the provided header, replacing any existing - * values of any headers with the same case-insensitive name. - * - * While header names are case-insensitive, the casing of the header will - * be preserved by this function, and returned from getHeaders(). - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * new and/or updated header and value. - * - * @param string $name Case-insensitive header field name. - * @param string|string[] $value Header value(s). - * @return self - * @throws \InvalidArgumentException for invalid header names or values. - */ - public function withHeader($name, $value); - - /** - * Return an instance with the specified header appended with the - * given value. - * - * Existing values for the specified header will be maintained. The new - * value(s) will be appended to the existing list. If the header did not - * exist previously, it will be added. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * new header and/or value. - * - * @param string $name Case-insensitive header field name to add. - * @param string|string[] $value Header value(s). - * @return self - * @throws \InvalidArgumentException for invalid header names or values. - */ - public function withAddedHeader($name, $value); - - /** - * Return an instance without the specified header. - * - * Header resolution MUST be done without case-sensitivity. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that removes - * the named header. - * - * @param string $name Case-insensitive header field name to remove. - * @return self - */ - public function withoutHeader($name); - - /** - * Gets the body of the message. - * - * @return StreamableInterface Returns the body as a stream. - */ - public function getBody(); - - /** - * Return an instance with the specified message body. - * - * The body MUST be a StreamableInterface object. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return a new instance that has the - * new body stream. - * - * @param StreamableInterface $body Body. - * @return self - * @throws \InvalidArgumentException When the body is not valid. - */ - public function withBody(StreamableInterface $body); -} diff --git a/srcPsr/RequestInterface.php b/srcPsr/RequestInterface.php deleted file mode 100644 index 2c6a2ea..0000000 --- a/srcPsr/RequestInterface.php +++ /dev/null @@ -1,179 +0,0 @@ -getQuery()` - * or from the `QUERY_STRING` server param. - * - * @return array - */ - public function getQueryParams(); - - /** - * Return an instance with the specified query string arguments. - * - * These values SHOULD remain immutable over the course of the incoming - * request. They MAY be injected during instantiation, such as from PHP's - * $_GET superglobal, or MAY be derived from some other value such as the - * URI. In cases where the arguments are parsed from the URI, the data - * MUST be compatible with what PHP's parse_str() would return for - * purposes of how duplicate query parameters are handled, and how nested - * sets are handled. - * - * Setting query string arguments MUST NOT change the URI stored by the - * request, nor the values in the server params. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * updated query string arguments. - * - * @param array $query Array of query string arguments, typically from - * $_GET. - * @return self - */ - public function withQueryParams(array $query); - - /** - * Retrieve the upload file metadata. - * - * This method MUST return file upload metadata in the same structure - * as PHP's $_FILES superglobal. - * - * These values MUST remain immutable over the course of the incoming - * request. They SHOULD be injected during instantiation, such as from PHP's - * $_FILES superglobal, but MAY be derived from other sources. - * - * @return array Upload file(s) metadata, if any. - */ - public function getFileParams(); - - /** - * Retrieve any parameters provided in the request body. - * - * If the request Content-Type is either application/x-www-form-urlencoded - * or multipart/form-data, and the request method is POST, this method MUST - * return the contents of $_POST. - * - * Otherwise, this method may return any results of deserializing - * the request body content; as parsing returns structured content, the - * potential types MUST be arrays or objects only. A null value indicates - * the absence of body content. - * - * @return null|array|object The deserialized body parameters, if any. - * These will typically be an array or object. - */ - public function getParsedBody(); - - /** - * Return an instance with the specified body parameters. - * - * These MAY be injected during instantiation. - * - * If the request Content-Type is either application/x-www-form-urlencoded - * or multipart/form-data, and the request method is POST, use this method - * ONLY to inject the contents of $_POST. - * - * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of - * deserializing the request body content. Deserialization/parsing returns - * structured data, and, as such, this method ONLY accepts arrays or objects, - * or a null value if nothing was available to parse. - * - * As an example, if content negotiation determines that the request data - * is a JSON payload, this method could be used to create a request - * instance with the deserialized parameters. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * updated body parameters. - * - * @param null|array|object $data The deserialized body data. This will - * typically be in an array or object. - * @return self - */ - public function withParsedBody($data); - - /** - * Retrieve attributes derived from the request. - * - * The request "attributes" may be used to allow injection of any - * parameters derived from the request: e.g., the results of path - * match operations; the results of decrypting cookies; the results of - * deserializing non-form-encoded message bodies; etc. Attributes - * will be application and request specific, and CAN be mutable. - * - * @return array Attributes derived from the request. - */ - public function getAttributes(); - - /** - * Retrieve a single derived request attribute. - * - * Retrieves a single derived request attribute as described in - * getAttributes(). If the attribute has not been previously set, returns - * the default value as provided. - * - * This method obviates the need for a hasAttribute() method, as it allows - * specifying a default value to return if the attribute is not found. - * - * @see getAttributes() - * @param string $name The attribute name. - * @param mixed $default Default value to return if the attribute does not exist. - * @return mixed - */ - public function getAttribute($name, $default = null); - - /** - * Return an instance with the specified derived request attribute. - * - * This method allows setting a single derived request attribute as - * described in getAttributes(). - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * updated attribute. - * - * @see getAttributes() - * @param string $name The attribute name. - * @param mixed $value The value of the attribute. - * @return self - */ - public function withAttribute($name, $value); - - /** - * Return an instance that removes the specified derived request - * attribute. - * - * This method allows removing a single derived request attribute as - * described in getAttributes(). - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that removes - * the attribute. - * - * @see getAttributes() - * @param string $name The attribute name. - * @return self - */ - public function withoutAttribute($name); -} diff --git a/srcPsr/StreamableInterface.php b/srcPsr/StreamableInterface.php deleted file mode 100644 index ec68121..0000000 --- a/srcPsr/StreamableInterface.php +++ /dev/null @@ -1,158 +0,0 @@ - - * [user-info@]host[:port] - * - * - * If the port component is not set or is the standard port for the current - * scheme, it SHOULD NOT be included. - * - * This method MUST return an empty string if no authority information is - * present. - * - * @return string Authority portion of the URI, in "[user-info@]host[:port]" - * format. - */ - public function getAuthority(); - - /** - * Retrieve the user information portion of the URI, if present. - * - * If a user is present in the URI, this will return that value; - * additionally, if the password is also present, it will be appended to the - * user value, with a colon (":") separating the values. - * - * Implementations MUST NOT return the "@" suffix when returning this value. - * - * @return string User information portion of the URI, if present, in - * "username[:password]" format. - */ - public function getUserInfo(); - - /** - * Retrieve the host component of the URI. - * - * This method MUST return a string; if no host component is present, an - * empty string MUST be returned. - * - * @return string Host component of the URI. - */ - public function getHost(); - - /** - * Retrieve the port component of the URI. - * - * If a port is present, and it is non-standard for the current scheme, - * this method MUST return it as an integer. If the port is the standard port - * used with the current scheme, this method SHOULD return null. - * - * If no port is present, and no scheme is present, this method MUST return - * a null value. - * - * If no port is present, but a scheme is present, this method MAY return - * the standard port for that scheme, but SHOULD return null. - * - * @return null|int The port for the URI. - */ - public function getPort(); - - /** - * Retrieve the path component of the URI. - * - * This method MUST return a string. - * - * Normally, the empty path "" and absolute path "/" are considered equal as - * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically - * do this normalization because in contexts with a trimmed base path, e.g. - * the front controller, this difference becomes significant. It's the task - * of the user to handle both "" and "/". - * - * The value returned MUST be percent-encoded, but MUST NOT double-encode - * any characters. To determine what characters to encode, please refer to - * RFC 3986, Sections 2 and 3.3. - * - * As an example, if the value should include a slash ("/") not intended as - * delimiter between path segments, that value MUST be encoded (e.g., "%2F") - * when passed to the instance. - * - * @see https://tools.ietf.org/html/rfc3986#section-2 - * @see https://tools.ietf.org/html/rfc3986#section-3.3 - * @return string The path component of the URI. - */ - public function getPath(); - - /** - * Retrieve the query string of the URI. - * - * This method MUST return a string; if no query string is present, it MUST - * return an empty string. - * - * The string returned MUST omit the leading "?" character. - * - * The value returned MUST be percent-encoded, but MUST NOT double-encode - * any characters. To determine what characters to encode, please refer to - * RFC 3986, Sections 2 and 3.4. - * - * As an example, if a value in a key/value pair of the query string should - * include an ampersand ("&") not intended as a delimiter between values, - * that value MUST be encoded (e.g., "%26") when passed to the instance. - * - * @see https://tools.ietf.org/html/rfc3986#section-2 - * @see https://tools.ietf.org/html/rfc3986#section-3.4 - * @return string The URI query string. - */ - public function getQuery(); - - /** - * Retrieve the fragment component of the URI. - * - * This method MUST return a string; if no fragment is present, it MUST - * return an empty string. - * - * The string returned MUST omit the leading "#" character. - * - * The value returned MUST be percent-encoded, but MUST NOT double-encode - * any characters. To determine what characters to encode, please refer to - * RFC 3986, Sections 2 and 3.5. - * - * @see https://tools.ietf.org/html/rfc3986#section-2 - * @see https://tools.ietf.org/html/rfc3986#section-3.5 - * @return string The URI fragment. - */ - public function getFragment(); - - /** - * Return an instance with the specified scheme. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified scheme. If the scheme - * provided includes the "://" delimiter, it MUST be removed. - * - * Implementations SHOULD restrict values to "http", "https", or an empty - * string but MAY accommodate other schemes if required. - * - * An empty scheme is equivalent to removing the scheme. - * - * @param string $scheme The scheme to use with the new instance. - * @return self A new instance with the specified scheme. - * @throws \InvalidArgumentException for invalid or unsupported schemes. - */ - public function withScheme($scheme); - - /** - * Return an instance with the specified user information. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified user information. - * - * Password is optional, but the user information MUST include the - * user; an empty string for the user is equivalent to removing user - * information. - * - * @param string $user User name to use for authority. - * @param null|string $password Password associated with $user. - * @return self A new instance with the specified user information. - */ - public function withUserInfo($user, $password = null); - - /** - * Return an instance with the specified host. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified host. - * - * An empty host value is equivalent to removing the host. - * - * @param string $host Hostname to use with the new instance. - * @return self A new instance with the specified host. - * @throws \InvalidArgumentException for invalid hostnames. - */ - public function withHost($host); - - /** - * Return an instance with the specified port. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified port. - * - * Implementations MUST raise an exception for ports outside the - * established TCP and UDP port ranges. - * - * A null value provided for the port is equivalent to removing the port - * information. - * - * @param null|int $port Port to use with the new instance; a null value - * removes the port information. - * @return self A new instance with the specified port. - * @throws \InvalidArgumentException for invalid ports. - */ - public function withPort($port); - - /** - * Return an instance with the specified path. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified path. - * - * The path MUST be prefixed with "/"; if not, the implementation MAY - * provide the prefix itself. - * - * An empty path value is equivalent to removing the path. - * - * @param string $path The path to use with the new instance. - * @return self A new instance with the specified path. - * @throws \InvalidArgumentException for invalid paths. - */ - public function withPath($path); - - /** - * Return an instance with the specified query string. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified query string. - * - * If the query string is prefixed by "?", that character MUST be removed. - * Additionally, the query string SHOULD be parseable by parse_str() in - * order to be valid. - * - * An empty query string value is equivalent to removing the query string. - * - * @param string $query The query string to use with the new instance. - * @return self A new instance with the specified query string. - * @throws \InvalidArgumentException for invalid query strings. - */ - public function withQuery($query); - - /** - * Return an instance with the specified URI fragment. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified URI fragment. - * - * If the fragment is prefixed by "#", that character MUST be removed. - * - * An empty fragment value is equivalent to removing the fragment. - * - * @param string $fragment The URI fragment to use with the new instance. - * @return self A new instance with the specified URI fragment. - */ - public function withFragment($fragment); - - /** - * Return the string representation of the URI. - * - * Concatenates the various components of the URI, using the appropriate - * delimiters: - * - * - If a scheme is present, "://" MUST append the value. - * - If the authority information is present, that value will be - * concatenated. - * - If a path is present, it MUST start with a "/" character. - * - If a query string is present, it MUST be prefixed by a "?" character. - * - If a URI fragment is present, it MUST be prefixed by a "#" character. - * - * @return string - */ - public function __toString(); -} diff --git a/test/tests/unit/Message/MessageTest.php b/test/tests/unit/Message/MessageTest.php index 7421f97..d8bde37 100644 --- a/test/tests/unit/Message/MessageTest.php +++ b/test/tests/unit/Message/MessageTest.php @@ -238,7 +238,7 @@ class MessageTest extends \PHPUnit_Framework_TestCase */ public function testGetBodyReturnsAttachedStream() { - $stream = $this->prophesize('\Psr\Http\Message\StreamableInterface'); + $stream = $this->prophesize('\Psr\Http\Message\StreamInterface'); $stream = $stream->reveal(); $message = $this->getMockForAbstractClass('\WellRESTed\Message\Message'); diff --git a/test/tests/unit/Message/ServerRequestTest.php b/test/tests/unit/Message/ServerRequestTest.php index e8a0db5..00800b9 100644 --- a/test/tests/unit/Message/ServerRequestTest.php +++ b/test/tests/unit/Message/ServerRequestTest.php @@ -110,7 +110,7 @@ class ServerRequestTest extends \PHPUnit_Framework_TestCase public function testServerRequestProvidesBody() { - $body = $this->prophesize('Psr\Http\Message\StreamableInterface'); + $body = $this->prophesize('Psr\Http\Message\StreamInterface'); MockServerRequestTest::$bodyStream = $body->reveal(); $request = MockServerRequestTest::getServerRequest(); $this->assertSame($body->reveal(), $request->getBody()); diff --git a/test/tests/unit/Routing/ResponderTest.php b/test/tests/unit/Routing/ResponderTest.php index c312d4c..a2d17bc 100644 --- a/test/tests/unit/Routing/ResponderTest.php +++ b/test/tests/unit/Routing/ResponderTest.php @@ -19,7 +19,7 @@ class ResponderTest extends \PHPUnit_Framework_TestCase public function setUp() { HeaderStack::reset(); - $this->body = $this->prophesize('\Psr\Http\Message\StreamableInterface'); + $this->body = $this->prophesize('\Psr\Http\Message\StreamInterface'); $this->body->isReadable()->willReturn(false); $this->response = $this->prophesize('\Psr\Http\Message\ResponseInterface'); $this->response->getHeaders()->willReturn([]);