-
-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathParameterSetsCollection.php
More file actions
74 lines (64 loc) · 1.86 KB
/
Copy pathParameterSetsCollection.php
File metadata and controls
74 lines (64 loc) · 1.86 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
66
67
68
69
70
71
72
73
74
<?php
namespace PhpBench\Model;
use ArrayIterator;
use Countable;
use IteratorAggregate;
/**
* @implements IteratorAggregate<int, ParameterSets>
*/
final class ParameterSetsCollection implements IteratorAggregate, Countable
{
/**
* @var ParameterSets[]
*/
private $parameterSets;
public function __construct(ParameterSets ...$parameterSets)
{
$this->parameterSets = $parameterSets;
}
/**
* @param array<array<array<string>>> $parameterSets
*/
public static function fromSerializedParameterSetsCollection(array $parameterSets): self
{
return new self(...array_map(function (array $parameterSets) {
return ParameterSets::fromSerializedParameterSets($parameterSets);
}, $parameterSets));
}
/**
* @param array<int,array<string,array<string,mixed>>> $parameterSets
*/
public static function fromUnserializedParameterSetsCollection(array $parameterSets): self
{
return new self(...array_map(function (array $parameterSets) {
return ParameterSets::fromUnserializedParameterSets($parameterSets);
}, $parameterSets));
}
/**
* @return ArrayIterator<int, ParameterSets>
*/
public function getIterator(): ArrayIterator
{
return new ArrayIterator($this->parameterSets);
}
/**
* {@inheritDoc}
*/
public function count(): int
{
return count($this->parameterSets);
}
public static function empty(): self
{
return new self(ParameterSets::empty());
}
/**
* @return array<int, array<string, array<string, mixed>>>
*/
public function toUnserializedParameterSetsCollection(): array
{
return array_map(function (ParameterSets $parameterSets) {
return $parameterSets->toUnserializedParameterSets();
}, $this->parameterSets);
}
}