Debian Codegraph @

lib/3rdParty/composer/symfony/http-client-contracts/ChunkInterface.php

raw symbols SCIP
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Contracts\HttpClient;
13
14 use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
15
16 /**
17 * The interface of chunks returned by ResponseStreamInterface::current().
18 *
19 * When the chunk is first, last or timeout, the content MUST be empty.
20 * When an unchecked timeout or a network error occurs, a TransportExceptionInterface
21 * MUST be thrown by the destructor unless one was already thrown by another method.
22 *
23 * @author Nicolas Grekas <[email protected]>
24 */
25 interface ChunkInterface
26 {
27 /**
28 * Tells when the idle timeout has been reached.
29 *
30 * @throws TransportExceptionInterface on a network error
31 */
32 public function isTimeout(): bool;
33
34 /**
35 * Tells when headers just arrived.
36 *
37 * @throws TransportExceptionInterface on a network error or when the idle timeout is reached
38 */
39 public function isFirst(): bool;
40
41 /**
42 * Tells when the body just completed.
43 *
44 * @throws TransportExceptionInterface on a network error or when the idle timeout is reached
45 */
46 public function isLast(): bool;
47
48 /**
49 * Returns a [status code, headers] tuple when a 1xx status code was just received.
50 *
51 * @throws TransportExceptionInterface on a network error or when the idle timeout is reached
52 */
53 public function getInformationalStatus(): ?array;
54
55 /**
56 * Returns the content of the response chunk.
57 *
58 * @throws TransportExceptionInterface on a network error or when the idle timeout is reached
59 */
60 public function getContent(): string;
61
62 /**
63 * Returns the offset of the chunk in the response body.
64 */
65 public function getOffset(): int;
66
67 /**
68 * In case of error, returns the message that describes it.
69 */
70 public function getError(): ?string;
71 }