Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3namespace Tal\Psr7Extended;
4
5use Psr\Http\Message\RequestInterface;
6use Psr\Http\Message\StreamInterface;
7use Psr\Http\Message\UriInterface;
8
9interface ClientRequestInterface extends RequestInterface
10{
11    /**
12     * Sets the specific request-target.
13     *
14     * If the request needs a non-origin-form request-target — e.g., for
15     * specifying an absolute-form, authority-form, or asterisk-form —
16     * this method may be used to create an instance with the specified
17     * request-target, verbatim.
18     *
19     * @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
20     *     request-target forms allowed in request messages)
21     * @param mixed $requestTarget
22     * @return static
23     */
24    public function setRequestTarget($requestTarget);
25
26    /**
27     * Sets the provided HTTP method.
28     *
29     * While HTTP method names are typically all uppercase characters, HTTP
30     * method names are case-sensitive and thus implementations SHOULD NOT
31     * modify the given string.
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     * changed request method.
36     *
37     * @param string $method Case-sensitive method.
38     * @return static
39     * @throws \InvalidArgumentException for invalid HTTP methods.
40     */
41    public function setMethod($method);
42
43    /**
44     * Sets the provided URI.
45     *
46     * This method MUST update the Host header of the returned request by
47     * default if the URI contains a host component. If the URI does not
48     * contain a host component, any pre-existing Host header MUST be carried
49     * over to the returned request.
50     *
51     * You can opt-in to preserving the original state of the Host header by
52     * setting `$preserveHost` to `true`. When `$preserveHost` is set to
53     * `true`, this method interacts with the Host header in the following ways:
54     *
55     * - If the Host header is missing or empty, and the new URI contains
56     *   a host component, this method MUST update the Host header in the returned
57     *   request.
58     * - If the Host header is missing or empty, and the new URI does not contain a
59     *   host component, this method MUST NOT update the Host header in the returned
60     *   request.
61     * - If a Host header is present and non-empty, this method MUST NOT update
62     *   the Host header in the returned request.
63     *
64     * @link http://tools.ietf.org/html/rfc3986#section-4.3
65     * @param UriInterface $uri New request URI to use.
66     * @param bool $preserveHost Preserve the original state of the Host header.
67     * @return static
68     */
69    public function setUri(UriInterface $uri, $preserveHost = false);
70
71    /**
72     * Sets the specified HTTP protocol version.
73     *
74     * The version string MUST contain only the HTTP version number (e.g.,
75     * "1.1", "1.0").
76     *
77     * @param string $version HTTP protocol version
78     * @return static
79     */
80    public function setProtocolVersion($version);
81
82    /**
83     * Sets the provided value replacing the specified header.
84     *
85     * While header names are case-insensitive, the casing of the header will
86     * be preserved by this function, and returned from getHeaders().
87     *
88     * @param string $name Case-insensitive header field name.
89     * @param string|string[] $value Header value(s).
90     * @return static
91     * @throws \InvalidArgumentException for invalid header names or values.
92     */
93    public function setHeader($name, $value);
94
95    /**
96     * Adds the specified header appended with the given value.
97     *
98     * Existing values for the specified header will be maintained. The new
99     * value(s) will be appended to the existing list. If the header did not
100     * exist previously, it will be added.
101     *
102     * @param string $name Case-insensitive header field name to add.
103     * @param string|string[] $value Header value(s).
104     * @return static
105     * @throws \InvalidArgumentException for invalid header names or values.
106     */
107    public function addHeader($name, $value);
108
109    /**
110     * Deletes the specified header.
111     *
112     * Header resolution MUST be done without case-sensitivity.
113     *
114     * @param string $name Case-insensitive header field name to remove.
115     * @return static
116     */
117    public function deleteHeader($name);
118
119    /**
120     * Sets the specified message body.
121     *
122     * The body MUST be a StreamInterface object.
123     *
124     * @param StreamInterface $body Body.
125     * @return static
126     * @throws \InvalidArgumentException When the body is not valid.
127     */
128    public function setBody(StreamInterface $body);
129}