Passed
Push — 1.x ( bace11...65e39f )
by Ulises Jeremias
02:35
created

ImmutableArray::sort()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php namespace Mbh\Collection;
2
3
/**
4
 * MBHFramework
5
 *
6
 * @link      https://github.com/MBHFramework/mbh-framework
7
 * @copyright Copyright (c) 2017 Ulises Jeremias Cornejo Fandos
8
 * @license   https://github.com/MBHFramework/mbh-framework/blob/master/LICENSE (MIT License)
9
 */
10
11
use Mbh\Collection\Interfaces\Sequenceable as SequenceableInterface;
12
use RuntimeException;
13
14
/**
15
 * The Immutable Array
16
 *
17
 * This provides special methods for quickly creating an immutable array,
18
 * either from any Traversable, or using a C-optimized fromArray() to directly
19
 * instantiate from. Also includes methods fundamental to functional
20
 * programming, e.g. map, filter, join, and sort.
21
 *
22
 * @package structures
23
 * @author Ulises Jeremias Cornejo Fandos <[email protected]>
24
 */
25
26
class ImmutableArray extends FixedArray
27
{
28
    public function sort(callable $callback = null): SequenceableInterface
29
    {
30
        throw new RuntimeException('Attempt to mutate immutable ' . __CLASS__ . ' object.');
31
    }
32
33
    public function offsetSet($offset, $value)
34
    {
35
        throw new RuntimeException('Attempt to mutate immutable ' . __CLASS__ . ' object.');
36
    }
37
38
    public function offsetUnset($offset)
39
    {
40
        throw new RuntimeException('Attempt to mutate immutable ' . __CLASS__ . ' object.');
41
    }
42
43
    public function clear()
44
    {
45
        throw new RuntimeException('Attempt to mutate immutable ' . __CLASS__ . ' object.');
46
    }
47
}
48