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
|
|
|
} |