Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
12 / 12 |
|
100.00% |
12 / 12 |
CRAP | |
100.00% |
1 / 1 |
| ImportContext | |
100.00% |
12 / 12 |
|
100.00% |
12 / 12 |
12 | |
100.00% |
1 / 1 |
| getCsvDelimiter | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setCsvDelimiter | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLbFactory | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setLbFactory | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTargetTableName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setTargetTableName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getCsvFilePath | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setCsvFilePath | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getBatchSize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setBatchSize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isQuiet | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setQuiet | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace PropertySuggester\UpdateTable; |
| 4 | |
| 5 | use Wikimedia\Rdbms\ILBFactory; |
| 6 | |
| 7 | /** |
| 8 | * Context for importing data from a csv file to a db table using a Importer strategy |
| 9 | * |
| 10 | * @author BP2013N2 |
| 11 | * @license GPL-2.0-or-later |
| 12 | */ |
| 13 | class ImportContext { |
| 14 | |
| 15 | /** |
| 16 | * file system path to the CSV to load data from |
| 17 | * @var string |
| 18 | */ |
| 19 | private $csvFilePath = ""; |
| 20 | |
| 21 | /** |
| 22 | * delimiter used in csv file |
| 23 | * @var string |
| 24 | */ |
| 25 | private $csvDelimiter = ","; |
| 26 | |
| 27 | /** |
| 28 | * table name of the table to import to |
| 29 | * @var string |
| 30 | */ |
| 31 | private $targetTableName = ""; |
| 32 | |
| 33 | /** |
| 34 | * @var ILBFactory|null |
| 35 | */ |
| 36 | private $lbFactory = null; |
| 37 | |
| 38 | /** |
| 39 | * @var int |
| 40 | */ |
| 41 | private $batchSize; |
| 42 | |
| 43 | /** |
| 44 | * @var bool |
| 45 | */ |
| 46 | private $quiet; |
| 47 | |
| 48 | /** |
| 49 | * @return string |
| 50 | */ |
| 51 | public function getCsvDelimiter() { |
| 52 | return $this->csvDelimiter; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * @param string $csvDelimiter |
| 57 | */ |
| 58 | public function setCsvDelimiter( $csvDelimiter ) { |
| 59 | $this->csvDelimiter = $csvDelimiter; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @return ILBFactory|null |
| 64 | */ |
| 65 | public function getLbFactory() { |
| 66 | return $this->lbFactory; |
| 67 | } |
| 68 | |
| 69 | public function setLbFactory( ILBFactory $lbFactory ) { |
| 70 | $this->lbFactory = $lbFactory; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @return string |
| 75 | */ |
| 76 | public function getTargetTableName() { |
| 77 | return $this->targetTableName; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * @param string $tableName |
| 82 | */ |
| 83 | public function setTargetTableName( $tableName ) { |
| 84 | $this->targetTableName = $tableName; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @return string |
| 89 | */ |
| 90 | public function getCsvFilePath() { |
| 91 | return $this->csvFilePath; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @param string $fullPath |
| 96 | */ |
| 97 | public function setCsvFilePath( $fullPath ) { |
| 98 | $this->csvFilePath = $fullPath; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @return int |
| 103 | */ |
| 104 | public function getBatchSize() { |
| 105 | return $this->batchSize; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * @param int $batchSize |
| 110 | */ |
| 111 | public function setBatchSize( $batchSize ) { |
| 112 | $this->batchSize = $batchSize; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * @return bool |
| 117 | */ |
| 118 | public function isQuiet() { |
| 119 | return $this->quiet; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * @param bool $quiet |
| 124 | */ |
| 125 | public function setQuiet( $quiet ) { |
| 126 | $this->quiet = $quiet; |
| 127 | } |
| 128 | |
| 129 | } |