-
Notifications
You must be signed in to change notification settings - Fork 5
/
ProcessPoolResults.php
82 lines (73 loc) · 1.54 KB
/
ProcessPoolResults.php
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace Illuminate\Process;
use ArrayAccess;
use Illuminate\Support\Collection;
class ProcessPoolResults implements ArrayAccess
{
/**
* The results of the processes.
*
* @var array
*/
protected $results = [];
/**
* Create a new process pool result set.
*
* @param array $results
* @return void
*/
public function __construct(array $results)
{
$this->results = $results;
}
/**
* Get the results as a collection.
*
* @return \Illuminate\Support\Collection
*/
public function collect()
{
return new Collection($this->results);
}
/**
* Determine if the given array offset exists.
*
* @param int $offset
* @return bool
*/
public function offsetExists($offset): bool
{
return isset($this->results[$offset]);
}
/**
* Get the result at the given offset.
*
* @param int $offset
* @return mixed
*/
public function offsetGet($offset): mixed
{
return $this->results[$offset];
}
/**
* Set the result at the given offset.
*
* @param int $offset
* @param mixed $value
* @return void
*/
public function offsetSet($offset, $value): void
{
$this->results[$offset] = $value;
}
/**
* Unset the result at the given offset.
*
* @param int $offset
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->results[$offset]);
}
}