Test Failed
Push — 1.x ( b19c89...b885b9 )
by Ulises Jeremias
05:56 queued 01:42
created

ImmutableArray::set()   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 2
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 Mbh\Collection\Exceptions\ImmutableException;
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
    /**
29
     * @inheritDoc
30
     */
31
    public function set($offset, $value)
32
    {
33
        throw ImmutableException::cannotModify(__CLASS__, __METHOD__);
34
    }
35
36
    /**
37
     * @inheritDoc
38
     */
39
    public function sort(callable $callback = null): SequenceableInterface
40
    {
41
        throw ImmutableException::cannotModify(__CLASS__, __METHOD__);
42
    }
43
44
    /**
45
     * @inheritDoc
46
     */
47
    public function offsetSet($offset, $value)
48
    {
49
        throw ImmutableException::cannotModify(__CLASS__, __METHOD__);
50
    }
51
52
    /**
53
     * @inheritDoc
54
     */
55
    public function offsetUnset($offset)
56
    {
57
        throw ImmutableException::cannotModify(__CLASS__, __METHOD__);
58
    }
59
60
    /**
61
     * @inheritDoc
62
     */
63
    public function clear()
64
    {
65
        throw ImmutableException::cannotModify(__CLASS__, __METHOD__);
66
    }
67
}
68