OperationResultList   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 49
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addOperationResult() 0 6 1
A append() 0 6 1
A count() 0 4 1
A getIterator() 0 4 1
1
<?php
2
3
namespace Storeman;
4
5
class OperationResultList implements \Countable, \IteratorAggregate
6
{
7
    /**
8
     * @var OperationResult[]
9
     */
10
    protected $operationResults = [];
11
12
    /**
13
     * Adds an operation result to the end of the list.
14
     *
15
     * @param OperationResult $operationResult
16
     * @return OperationResultList
17
     */
18
    public function addOperationResult(OperationResult $operationResult): OperationResultList
19
    {
20
        $this->operationResults[] = $operationResult;
21
22
        return $this;
23
    }
24
25
    /**
26
     * Appends another operation result list to the end of this list.
27
     *
28
     * @param OperationResultList $other
29
     * @return OperationResultList
30
     */
31
    public function append(OperationResultList $other): OperationResultList
32
    {
33
        $this->operationResults = array_merge($this->operationResults, $other->operationResults);
34
35
        return $this;
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function count()
42
    {
43
        return count($this->operationResults);
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function getIterator()
50
    {
51
        return new \ArrayIterator($this->operationResults);
52
    }
53
}
54