Completed
Push — master ( c5a3b4...fa0d52 )
by Arne
01:49
created

OperationResultList::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Archivr;
4
5 View Code Duplication
class OperationResultList implements \Countable, \IteratorAggregate
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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