Test Failed
Push — main ( fc8ba5...9083af )
by Bingo
05:27
created

BatchConfiguration::setIds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Jabe\Engine\Impl\Batch;
4
5
class BatchConfiguration
6
{
7
    protected $ids = [];
8
    protected $idMappings;
9
    protected $failIfNotExists;
10
    protected $batchId;
11
12
    public function __construct(array $ids, $failIfNotExistsOrMappings = null, $failIfNotExistsOrBatchId = null)
13
    {
14
        $this->ids = $ids;
15
        if ($failIfNotExistsOrMappings === null && $failIfNotExists == null) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $failIfNotExists does not exist. Did you maybe mean $failIfNotExistsOrMappings?
Loading history...
16
            $this->failIfNotExists = true;
17
        } elseif (is_bool($failIfNotExistsOrMappings)) {
18
            $this->failIfNotExists = $failIfNotExistsOrMappings;
19
        } elseif ($failIfNotExistsOrMappings instanceof DeploymentMappings) {
20
            $this->idMappings = $failIfNotExistsOrMappings;
21
            if ($failIfNotExistsOrBatchId === null) {
22
                $this->failIfNotExists = true;
23
            } elseif (is_bool($failIfNotExistsOrBatchId)) {
24
                $this->failIfNotExists = $failIfNotExistsOrBatchId;
25
            } elseif (is_string($failIfNotExistsOrBatchId)) {
26
                $this->batchId = $failIfNotExistsOrBatchId;
27
            }
28
        }
29
    }
30
31
    public function getIds(): array
32
    {
33
        return $this->ids;
34
    }
35
36
    public function setIds(array $ids): void
37
    {
38
        $this->ids = $ids;
39
    }
40
41
    public function getIdMappings(): DeploymentMappings
42
    {
43
        return $this->idMappings;
44
    }
45
46
    public function setIdMappings(DeploymentMappings $idMappings): void
47
    {
48
        $this->idMappings = $idMappings;
49
    }
50
51
    public function isFailIfNotExists(): bool
52
    {
53
        return $this->failIfNotExists;
54
    }
55
56
    public function setFailIfNotExists(bool $failIfNotExists): void
57
    {
58
        $this->failIfNotExists = $failIfNotExists;
59
    }
60
61
    public function getBatchId(): string
62
    {
63
        return $this->batchId;
64
    }
65
66
    public function setBatchId(string $batchId): void
67
    {
68
        $this->batchId = $batchId;
69
    }
70
}
71