-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImmutable.php
More file actions
38 lines (31 loc) · 896 Bytes
/
Immutable.php
File metadata and controls
38 lines (31 loc) · 896 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
31
32
33
34
35
36
37
38
<?php
/*
* This file is part of the Koded package.
*
* (c) Mihail Binev <mihail@kodeart.com>
*
* Please view the LICENSE distributed with this source code
* for the full copyright and license information.
*/
namespace Koded\Stdlib;
use Countable;
use IteratorAggregate;
use JsonSerializable;
/**
* An IMMUTABLE, multipurpose class that encapsulates a read-only data.
* It is useful for passing it around as a DTO.
*/
class Immutable implements Data,
ArrayDataFilter,
TransformsToArguments,
IteratorAggregate,
Countable,
JsonSerializable
{
use AccessorTrait, ArrayDataFilterTrait;
public function __construct(protected array $data) {}
public function toArguments(): Arguments
{
return new Arguments($this->data);
}
}