ImmutableCollectionTrait::addAll()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace Jmw\Collection;
3
4
use Jmw\Collection\Exception\UnsupportedOperationException;
5
/**
6
 * This trait is ensures immutability by throwing an exception
7
 * on all mutable CollectionInterface methods
8
 * @author john
9
 *
10
 */
11
trait ImmutableCollectionTrait
12
{
13
	/**
14
	 * add is not supported by immutable objects.
15
	 * @param multitype $element
16
	 * @throws UnsupportedOperationException
17
	 */
18
	public function add($element)
0 ignored issues
show
Unused Code introduced by
The parameter $element is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
19
	{
20
		throw new UnsupportedOperationException('add');
21
	}
22
	
23
	/**
24
	 * addAll is not supported by immutable objects.
25
	 * @param CollectionInterface $collection
26
 	 * @throws UnsupportedOperationException
27
	 */
28
	public function addAll(CollectionInterface $collection)
0 ignored issues
show
Unused Code introduced by
The parameter $collection is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
	{
30
		throw new UnsupportedOperationException('addAll');
31
	}
32
	
33
	/**
34
	 * clear is not supported by immutable objects.
35
 	 * @throws UnsupportedOperationException
36
	 */
37
	public function clear()
38
	{
39
		throw new UnsupportedOperationException('clear');
40
	}
41
42
	/**
43
	 * Remove is not supported by immutable objects.
44
	 * @param multitype $element
45
 	 * @throws UnsupportedOperationException
46
	 */
47
	public function remove($element)
0 ignored issues
show
Unused Code introduced by
The parameter $element is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
	{
49
		throw new UnsupportedOperationException('remove');
50
	}
51
	
52
	/**
53
	 * removeAll is not supported by immutable objects.
54
	 * @param CollectionInterface $collection
55
	 */
56
	public function removeAll(CollectionInterface $collection)
0 ignored issues
show
Unused Code introduced by
The parameter $collection is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
57
	{
58
		throw new UnsupportedOperationException('removeAll');
59
	}
60
61
	/**
62
	 * retainAll is not supported by immutable objects.
63
	 * @param CollectionInterface $collection
64
 	 * @throws UnsupportedOperationException
65
	 */
66
	public function retainAll(CollectionInterface $collection)
0 ignored issues
show
Unused Code introduced by
The parameter $collection is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
67
	{
68
		throw new UnsupportedOperationException('retainAll');
69
	}
70
	
71
}