PendingTransportOperations::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
namespace PSB\Core\Pipeline;
3
4
5
use PSB\Core\Transport\TransportOperation;
6
7
class PendingTransportOperations
8
{
9
    /**
10
     * @var TransportOperation[]
11
     */
12
    private $operations = [];
13
14
    /**
15
     * @param TransportOperation $transportOperation
16
     */
17 7
    public function add(TransportOperation $transportOperation)
18
    {
19 7
        $this->operations[] = $transportOperation;
20 7
    }
21
22
    /**
23
     * @param array $transportOperations
24
     */
25 1
    public function addAll(array $transportOperations)
26
    {
27 1
        foreach ($transportOperations as $transportOperation) {
28 1
            $this->add($transportOperation);
29
        }
30 1
    }
31
32
    /**
33
     * @return TransportOperation[]
34
     */
35 4
    public function getOperations()
36
    {
37 4
        return $this->operations;
38
    }
39
40
    /**
41
     * @return bool
42
     */
43 5
    public function hasOperations()
44
    {
45 5
        return count($this->operations) > 0;
46
    }
47
}
48