-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathChunk.php
More file actions
65 lines (59 loc) · 1.26 KB
/
Chunk.php
File metadata and controls
65 lines (59 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
namespace Utopia\Fetch;
/**
* Chunk class
* Represents a chunk of data received from an HTTP response
* @package Utopia\Fetch
*/
class Chunk
{
/**
* @param string $data The raw chunk data
* @param int $size The size of the chunk in bytes
* @param float $timestamp The timestamp when the chunk was received
* @param int $index The sequential index of this chunk in the response
*/
public function __construct(
private readonly string $data,
private readonly int $size,
private readonly float $timestamp,
private readonly int $index,
) {
}
/**
* Get the raw chunk data
*
* @return string
*/
public function getData(): string
{
return $this->data;
}
/**
* Get the size of the chunk in bytes
*
* @return int
*/
public function getSize(): int
{
return $this->size;
}
/**
* Get the timestamp when the chunk was received
*
* @return float
*/
public function getTimestamp(): float
{
return $this->timestamp;
}
/**
* Get the sequential index of this chunk
*
* @return int
*/
public function getIndex(): int
{
return $this->index;
}
}