1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the sauls/collections package. |
4
|
|
|
* |
5
|
|
|
* @author Saulius Vaičeliūnas <[email protected]> |
6
|
|
|
* @link http://saulius.vaiceliunas.lt |
7
|
|
|
* @copyright 2018 |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
10
|
|
|
* file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Sauls\Component\Collection; |
14
|
|
|
|
15
|
|
|
use Sauls\Component\Collection\Exception\UnsupportedOperationException; |
16
|
|
|
|
17
|
|
|
class ImmutableArrayCollection extends ArrayCollection |
18
|
|
|
{ |
19
|
|
|
public function __construct($elements = null) |
20
|
|
|
{ |
21
|
|
|
$this->assign((new ArrayCollection($elements))->all()); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
26
|
|
|
*/ |
27
|
|
|
public function set($key, $value): void |
28
|
|
|
{ |
29
|
|
|
throw new UnsupportedOperationException(); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
34
|
|
|
*/ |
35
|
|
|
public function add(array $elements): void |
36
|
|
|
{ |
37
|
|
|
throw new UnsupportedOperationException(); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
42
|
|
|
*/ |
43
|
|
|
public function merge(array $elements): void |
44
|
|
|
{ |
45
|
|
|
throw new UnsupportedOperationException(); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
50
|
|
|
*/ |
51
|
|
|
public function replace(array $elements): void |
52
|
|
|
{ |
53
|
|
|
throw new UnsupportedOperationException(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
58
|
|
|
*/ |
59
|
|
|
public function clear(): void |
60
|
|
|
{ |
61
|
|
|
throw new UnsupportedOperationException(); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
66
|
|
|
*/ |
67
|
|
|
public function removeKey($key) |
68
|
|
|
{ |
69
|
|
|
throw new UnsupportedOperationException(); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
74
|
|
|
*/ |
75
|
|
|
public function removeValue($element) |
76
|
|
|
{ |
77
|
|
|
throw new UnsupportedOperationException(); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
82
|
|
|
*/ |
83
|
|
|
public function unserialize($value): void |
84
|
|
|
{ |
85
|
|
|
throw new UnsupportedOperationException(); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
90
|
|
|
*/ |
91
|
|
|
public function map(\Closure $function) |
92
|
|
|
{ |
93
|
|
|
throw new UnsupportedOperationException(); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
98
|
|
|
*/ |
99
|
|
|
public function offsetSet($offset, $value) |
100
|
|
|
{ |
101
|
|
|
throw new UnsupportedOperationException(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @throws \Sauls\Component\Collection\Exception\UnsupportedOperationException |
106
|
|
|
*/ |
107
|
|
|
public function offsetUnset($offset) |
108
|
|
|
{ |
109
|
|
|
throw new UnsupportedOperationException(); |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|