MutationErrorCollection   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 34
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A count() 0 4 1
A getAll() 0 4 1
A getIterator() 0 4 1
1
<?php declare(strict_types = 1);
2
3
namespace TomCizek\ResponseRecorder\Application\ResponseRecorder\MutationResponse;
4
5
use ArrayIterator;
6
use Countable;
7
use Iterator;
8
use IteratorAggregate;
9
use TomCizek\ResponseRecorder\Application\ResponseRecorder\MutationResponse\ErrorCollection\ShowableMutationError;
10
11
class MutationErrorCollection implements Countable, IteratorAggregate
12
{
13
	/** @var ShowableMutationError[] */
14
	protected $errors = [];
15
16
	/**
17
	 * @param ShowableMutationError[] $errorDomainEvents
18
	 */
19 9
	public function __construct(array $errorDomainEvents)
20
	{
21 9
		$this->errors = $errorDomainEvents;
22 9
	}
23
24 9
	public function count(): int
25
	{
26 9
		return count($this->errors);
27
	}
28
29
	/**
30
	 * @return ShowableMutationError[]
31
	 */
32 5
	public function getAll(): array
33
	{
34 5
		return $this->errors;
35
	}
36
37
	/**
38
	 * @return Iterator|ShowableMutationError[]
39
	 */
40
	public function getIterator(): Iterator
41
	{
42
		return new ArrayIterator($this->errors);
43
	}
44
}
45