FieldReplaceResult::getReplacedCount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * @copyright   (c) 2017-present brian ridley
5
 * @author      brian ridley <[email protected]>
6
 * @license     http://opensource.org/licenses/MIT MIT
7
 */
8
9
namespace ptlis\GrepDb\Replace\Result;
10
11
use ptlis\GrepDb\Metadata\MySQL\ColumnMetadata;
12
13
/**
14
 * Result of field replacements.
15
 */
16
final class FieldReplaceResult
17
{
18
    /** @var ColumnMetadata */
19
    private $columnMetadata;
20
21
    /** @var int */
22
    private $replacedCount;
23
24
    /** @var string[] */
25
    private $errorList;
26
27
    /** @var string */
28
    private $oldValue;
29
30
    /** @var string */
31
    private $newValue;
32
33
34
    /**
35
     * @param ColumnMetadata $columnMetadata
36
     * @param int $replacedCount
37
     * @param string[] $errorList
38
     * @param string $newValue
39
     */
40 14
    public function __construct(
41
        ColumnMetadata $columnMetadata,
42
        int $replacedCount,
43
        array $errorList,
44
        string $oldValue,
45
        string $newValue
46
    ) {
47 14
        $this->columnMetadata = $columnMetadata;
48 14
        $this->replacedCount = $replacedCount;
49 14
        $this->errorList = $errorList;
50 14
        $this->oldValue = $oldValue;
51 14
        $this->newValue = $newValue;
52 14
    }
53
54
    /**
55
     * Get the number of replacements in this field.
56
     */
57 14
    public function getReplacedCount(): int
58
    {
59 14
        return $this->replacedCount;
60
    }
61
62
    /**
63
     * @return string[]
64
     */
65 14
    public function getErrorList(): array
66
    {
67 14
        return $this->errorList;
68
    }
69
70 1
    public function getOldValue(): string
71
    {
72 1
        return $this->oldValue;
73
    }
74
75 14
    public function getNewValue(): string
76
    {
77 14
        return $this->newValue;
78
    }
79
80
    public function getColumnMetadata(): ColumnMetadata
81
    {
82
        return $this->columnMetadata;
83
    }
84
}