forked from Respect/Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFiltered.php
More file actions
30 lines (23 loc) · 782 Bytes
/
Filtered.php
File metadata and controls
30 lines (23 loc) · 782 Bytes
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
<?php
declare(strict_types=1);
namespace Respect\Data\Collections;
use function array_values;
final class Filtered extends Collection
{
/** Fetch only the entity identifier */
public const string IDENTIFIER_ONLY = '*';
// phpcs:ignore PSR2.Classes.PropertyDeclaration
public bool $identifierOnly { get => $this->filters === [self::IDENTIFIER_ONLY]; }
/** @param list<string> $filters */
public function __construct(
string $name,
public private(set) readonly array $filters = [],
) {
parent::__construct($name);
}
/** @param array<scalar, string> $arguments */
public static function __callStatic(string $name, array $arguments): static
{
return new static($name, array_values($arguments));
}
}