@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | private $stringComparer; |
29 | 29 | |
30 | - public function __construct( TermIndex $termIndex, StringComparer $stringComparer ) { |
|
30 | + public function __construct(TermIndex $termIndex, StringComparer $stringComparer) { |
|
31 | 31 | $this->termIndex = $termIndex; |
32 | 32 | $this->stringComparer = $stringComparer; |
33 | 33 | } |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return string|null One of the ComparisonResult::STATUS_... constants. |
42 | 42 | */ |
43 | - public function compare( DataValue $value, DataValue $comparativeValue ) { |
|
44 | - Assert::parameterType( EntityIdValue::class, $value, '$value' ); |
|
45 | - Assert::parameterType( MonolingualTextValue::class, $comparativeValue, '$comparativeValue' ); |
|
43 | + public function compare(DataValue $value, DataValue $comparativeValue) { |
|
44 | + Assert::parameterType(EntityIdValue::class, $value, '$value'); |
|
45 | + Assert::parameterType(MonolingualTextValue::class, $comparativeValue, '$comparativeValue'); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @var EntityIdValue $value |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | |
52 | 52 | $entityId = $value->getEntityId(); |
53 | 53 | $language = $comparativeValue->getLanguageCode(); |
54 | - $terms = $this->getTerms( $entityId, $language ); |
|
54 | + $terms = $this->getTerms($entityId, $language); |
|
55 | 55 | |
56 | - if ( $terms ) { |
|
57 | - return $this->stringComparer->compareWithArray( $comparativeValue->getText(), $terms ); |
|
56 | + if ($terms) { |
|
57 | + return $this->stringComparer->compareWithArray($comparativeValue->getText(), $terms); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return null; |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return string[] |
70 | 70 | */ |
71 | - private function getTerms( EntityId $entityId, $language ) { |
|
71 | + private function getTerms(EntityId $entityId, $language) { |
|
72 | 72 | $terms = $this->termIndex->getTermsOfEntity( |
73 | 73 | $entityId, |
74 | 74 | [ |
75 | 75 | TermIndexEntry::TYPE_LABEL, |
76 | 76 | TermIndexEntry::TYPE_ALIAS |
77 | 77 | ], |
78 | - [ $language ] |
|
78 | + [$language] |
|
79 | 79 | ); |
80 | 80 | |
81 | 81 | return array_map( |
82 | - function( TermIndexEntry $term ) { |
|
82 | + function(TermIndexEntry $term) { |
|
83 | 83 | return $term->getText(); |
84 | 84 | }, |
85 | 85 | $terms |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param DataValue $comparativeValue |
94 | 94 | * @return bool |
95 | 95 | */ |
96 | - public function canCompare( DataValue $value, DataValue $comparativeValue ) { |
|
96 | + public function canCompare(DataValue $value, DataValue $comparativeValue) { |
|
97 | 97 | return $value instanceof EntityIdValue && $comparativeValue instanceof MonolingualTextValue; |
98 | 98 | } |
99 | 99 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | private $stringNormalizer; |
24 | 24 | |
25 | - public function __construct( StringNormalizer $stringNormalizer ) { |
|
25 | + public function __construct(StringNormalizer $stringNormalizer) { |
|
26 | 26 | $this->stringNormalizer = $stringNormalizer; |
27 | 27 | } |
28 | 28 | |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | * @param string $comparativeValue |
34 | 34 | * @return string |
35 | 35 | */ |
36 | - public function compare( $value, $comparativeValue ) { |
|
37 | - Assert::parameterType( 'string', $value, '$value' ); |
|
38 | - Assert::parameterType( 'string', $comparativeValue, '$comparativeValue' ); |
|
36 | + public function compare($value, $comparativeValue) { |
|
37 | + Assert::parameterType('string', $value, '$value'); |
|
38 | + Assert::parameterType('string', $comparativeValue, '$comparativeValue'); |
|
39 | 39 | |
40 | - $value = $this->cleanDataString( $value ); |
|
41 | - $comparativeValue = $this->cleanDataString( $comparativeValue ); |
|
40 | + $value = $this->cleanDataString($value); |
|
41 | + $comparativeValue = $this->cleanDataString($comparativeValue); |
|
42 | 42 | |
43 | - if ( $value === $comparativeValue ) { |
|
43 | + if ($value === $comparativeValue) { |
|
44 | 44 | return ComparisonResult::STATUS_MATCH; |
45 | - } elseif ( $this->checkSimilarity( $value, $comparativeValue ) ) { |
|
45 | + } elseif ($this->checkSimilarity($value, $comparativeValue)) { |
|
46 | 46 | return ComparisonResult::STATUS_PARTIAL_MATCH; |
47 | 47 | } else { |
48 | 48 | return ComparisonResult::STATUS_MISMATCH; |
@@ -56,19 +56,19 @@ discard block |
||
56 | 56 | * @param string[] $comparativeValues |
57 | 57 | * @return string |
58 | 58 | */ |
59 | - public function compareWithArray( $value, array $comparativeValues ) { |
|
60 | - Assert::parameterType( 'string', $value, '$value' ); |
|
61 | - Assert::parameterElementType( 'string', $comparativeValues, '$comparativeValues' ); |
|
59 | + public function compareWithArray($value, array $comparativeValues) { |
|
60 | + Assert::parameterType('string', $value, '$value'); |
|
61 | + Assert::parameterElementType('string', $comparativeValues, '$comparativeValues'); |
|
62 | 62 | |
63 | - $value = $this->cleanDataString( $value ); |
|
64 | - $comparativeValues = $this->cleanDataArray( $comparativeValues ); |
|
63 | + $value = $this->cleanDataString($value); |
|
64 | + $comparativeValues = $this->cleanDataArray($comparativeValues); |
|
65 | 65 | |
66 | - if ( in_array( $value, $comparativeValues ) ) { |
|
66 | + if (in_array($value, $comparativeValues)) { |
|
67 | 67 | return ComparisonResult::STATUS_MATCH; |
68 | 68 | } |
69 | 69 | |
70 | - foreach ( $comparativeValues as $comparativeValue ) { |
|
71 | - if ( $this->checkSimilarity( $comparativeValue, $value ) ) { |
|
70 | + foreach ($comparativeValues as $comparativeValue) { |
|
71 | + if ($this->checkSimilarity($comparativeValue, $value)) { |
|
72 | 72 | return ComparisonResult::STATUS_PARTIAL_MATCH; |
73 | 73 | } |
74 | 74 | } |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | * @param string $comparativeValue |
84 | 84 | * @return bool |
85 | 85 | */ |
86 | - private function checkSimilarity( $value, $comparativeValue ) { |
|
87 | - return $this->percentagePrefixSimilarity( $value, $comparativeValue ) > self::SIMILARITY_THRESHOLD |
|
88 | - || $this->percentageSuffixSimilarity( $value, $comparativeValue ) > self::SIMILARITY_THRESHOLD |
|
89 | - || $this->percentageLevenshteinDistance( $value, $comparativeValue ) > self::SIMILARITY_THRESHOLD; |
|
86 | + private function checkSimilarity($value, $comparativeValue) { |
|
87 | + return $this->percentagePrefixSimilarity($value, $comparativeValue) > self::SIMILARITY_THRESHOLD |
|
88 | + || $this->percentageSuffixSimilarity($value, $comparativeValue) > self::SIMILARITY_THRESHOLD |
|
89 | + || $this->percentageLevenshteinDistance($value, $comparativeValue) > self::SIMILARITY_THRESHOLD; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return string |
98 | 98 | */ |
99 | - private function cleanDataString( $value ) { |
|
100 | - $value = $this->stringNormalizer->trimToNFC( $value ); |
|
99 | + private function cleanDataString($value) { |
|
100 | + $value = $this->stringNormalizer->trimToNFC($value); |
|
101 | 101 | |
102 | - return mb_strtolower( $value ); |
|
102 | + return mb_strtolower($value); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string[] |
111 | 111 | */ |
112 | - private function cleanDataArray( array $array ) { |
|
112 | + private function cleanDataArray(array $array) { |
|
113 | 113 | return array_map( |
114 | - [ $this, 'cleanDataString' ], |
|
114 | + [$this, 'cleanDataString'], |
|
115 | 115 | $array ); |
116 | 116 | } |
117 | 117 | |
@@ -123,19 +123,19 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return float |
125 | 125 | */ |
126 | - private function percentagePrefixSimilarity( $value, $comparativeValue ) { |
|
126 | + private function percentagePrefixSimilarity($value, $comparativeValue) { |
|
127 | 127 | $prefixLength = 0; // common prefix length |
128 | - $localLength = strlen( $value ); |
|
129 | - $externalLength = strlen( $comparativeValue ); |
|
130 | - while ( $prefixLength < min( $localLength, $externalLength ) ) { |
|
128 | + $localLength = strlen($value); |
|
129 | + $externalLength = strlen($comparativeValue); |
|
130 | + while ($prefixLength < min($localLength, $externalLength)) { |
|
131 | 131 | $c = $value[$prefixLength]; |
132 | - if ( $externalLength > $prefixLength && $comparativeValue[$prefixLength] !== $c ) { |
|
132 | + if ($externalLength > $prefixLength && $comparativeValue[$prefixLength] !== $c) { |
|
133 | 133 | break; |
134 | 134 | } |
135 | 135 | $prefixLength++; |
136 | 136 | } |
137 | 137 | |
138 | - return $prefixLength / max( $localLength, $externalLength ); |
|
138 | + return $prefixLength / max($localLength, $externalLength); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return float |
148 | 148 | */ |
149 | - private function percentageSuffixSimilarity( $value, $comparativeValue ) { |
|
149 | + private function percentageSuffixSimilarity($value, $comparativeValue) { |
|
150 | 150 | $suffixLength = 0; // common suffix length |
151 | - $localLength = strlen( $value ); |
|
152 | - $externalLength = strlen( $comparativeValue ); |
|
153 | - while ( $suffixLength < min( $localLength, $externalLength ) ) { |
|
151 | + $localLength = strlen($value); |
|
152 | + $externalLength = strlen($comparativeValue); |
|
153 | + while ($suffixLength < min($localLength, $externalLength)) { |
|
154 | 154 | $c = $value[$localLength - 1 - $suffixLength]; |
155 | - if ( $externalLength > $suffixLength && $comparativeValue[$externalLength - 1 - $suffixLength] !== $c ) { |
|
155 | + if ($externalLength > $suffixLength && $comparativeValue[$externalLength - 1 - $suffixLength] !== $c) { |
|
156 | 156 | break; |
157 | 157 | } |
158 | 158 | $suffixLength++; |
159 | 159 | } |
160 | 160 | |
161 | - return $suffixLength / max( $localLength, $externalLength ); |
|
161 | + return $suffixLength / max($localLength, $externalLength); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return float |
171 | 171 | */ |
172 | - private function percentageLevenshteinDistance( $value, $comparativeValue ) { |
|
173 | - $distance = levenshtein( $value, $comparativeValue ); |
|
174 | - $percentage = 1.0 - $distance / max( strlen( $value ), strlen( $comparativeValue ) ); |
|
172 | + private function percentageLevenshteinDistance($value, $comparativeValue) { |
|
173 | + $distance = levenshtein($value, $comparativeValue); |
|
174 | + $percentage = 1.0 - $distance / max(strlen($value), strlen($comparativeValue)); |
|
175 | 175 | |
176 | 176 | return $percentage; |
177 | 177 | } |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | public function import() { |
48 | 48 | $dumpIds = $this->insertMetaInformation(); |
49 | 49 | |
50 | - $this->log( "\nDelete old database entries...\n" ); |
|
50 | + $this->log("\nDelete old database entries...\n"); |
|
51 | 51 | |
52 | - foreach ( $dumpIds as $dumpId ) { |
|
53 | - $this->externalDataRepo->deleteOfDump( $dumpId, $this->importSettings->getBatchSize() ); |
|
52 | + foreach ($dumpIds as $dumpId) { |
|
53 | + $this->externalDataRepo->deleteOfDump($dumpId, $this->importSettings->getBatchSize()); |
|
54 | 54 | } |
55 | 55 | |
56 | - $this->log( "\n" ); |
|
56 | + $this->log("\n"); |
|
57 | 57 | |
58 | 58 | $this->insertExternalValues(); |
59 | 59 | } |
@@ -64,52 +64,52 @@ discard block |
||
64 | 64 | * @return string[] |
65 | 65 | */ |
66 | 66 | protected function insertMetaInformation() { |
67 | - $this->log( "Insert new dump meta information\n" ); |
|
67 | + $this->log("Insert new dump meta information\n"); |
|
68 | 68 | |
69 | - $csvFile = fopen( $this->importSettings->getDumpInformationFilePath(), 'rb' ); |
|
70 | - if ( !$csvFile ) { |
|
71 | - exit( 'Error while reading CSV file.' ); |
|
69 | + $csvFile = fopen($this->importSettings->getDumpInformationFilePath(), 'rb'); |
|
70 | + if (!$csvFile) { |
|
71 | + exit('Error while reading CSV file.'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $i = 0; |
75 | 75 | $dumpIds = []; |
76 | - while ( $data = fgetcsv( $csvFile ) ) { |
|
76 | + while ($data = fgetcsv($csvFile)) { |
|
77 | 77 | $identifierPropertyIds = array_map( |
78 | - function ( $propertyId ) { |
|
79 | - return new PropertyId( $propertyId ); |
|
78 | + function($propertyId) { |
|
79 | + return new PropertyId($propertyId); |
|
80 | 80 | }, |
81 | - json_decode( $data[2] ) |
|
81 | + json_decode($data[2]) |
|
82 | 82 | ); |
83 | 83 | try { |
84 | 84 | $dumpMetaInformation = new DumpMetaInformation( |
85 | 85 | $data[0], |
86 | - new ItemId( $data[1] ), |
|
86 | + new ItemId($data[1]), |
|
87 | 87 | $identifierPropertyIds, |
88 | 88 | $data[3], |
89 | 89 | $data[4], |
90 | 90 | $data[5], |
91 | - intval( $data[6] ), |
|
92 | - new ItemId( $data[7] ) |
|
91 | + intval($data[6]), |
|
92 | + new ItemId($data[7]) |
|
93 | 93 | ); |
94 | - } catch ( \InvalidArgumentException $e ) { |
|
95 | - exit( 'Input file has bad formatted values.' ); |
|
94 | + } catch (\InvalidArgumentException $e) { |
|
95 | + exit('Input file has bad formatted values.'); |
|
96 | 96 | } |
97 | 97 | $dumpIds[] = $dumpMetaInformation->getDumpId(); |
98 | 98 | |
99 | 99 | try { |
100 | - $this->dumpMetaInformationStore->save( $dumpMetaInformation ); |
|
101 | - } catch ( DBError $e ) { |
|
102 | - exit( 'Unknown database error occurred.' ); |
|
100 | + $this->dumpMetaInformationStore->save($dumpMetaInformation); |
|
101 | + } catch (DBError $e) { |
|
102 | + exit('Unknown database error occurred.'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $i++; |
106 | - $this->log( "\r\033[K" ); |
|
107 | - $this->log( "$i rows inserted or updated" ); |
|
106 | + $this->log("\r\033[K"); |
|
107 | + $this->log("$i rows inserted or updated"); |
|
108 | 108 | } |
109 | 109 | |
110 | - fclose( $csvFile ); |
|
110 | + fclose($csvFile); |
|
111 | 111 | |
112 | - $this->log( "\n" ); |
|
112 | + $this->log("\n"); |
|
113 | 113 | |
114 | 114 | return $dumpIds; |
115 | 115 | } |
@@ -118,32 +118,32 @@ discard block |
||
118 | 118 | * Inserts external values stored in csv file into database |
119 | 119 | */ |
120 | 120 | private function insertExternalValues() { |
121 | - $this->log( "Insert new data values\n" ); |
|
121 | + $this->log("Insert new data values\n"); |
|
122 | 122 | |
123 | - $csvFile = fopen( $this->importSettings->getExternalValuesFilePath(), 'rb' ); |
|
124 | - if ( !$csvFile ) { |
|
125 | - exit( 'Error while reading CSV file.' ); |
|
123 | + $csvFile = fopen($this->importSettings->getExternalValuesFilePath(), 'rb'); |
|
124 | + if (!$csvFile) { |
|
125 | + exit('Error while reading CSV file.'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | $i = 0; |
129 | 129 | $accumulator = []; |
130 | 130 | $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); |
131 | - while ( true ) { |
|
132 | - $data = fgetcsv( $csvFile ); |
|
133 | - if ( $data === false || ++$i % $this->importSettings->getBatchSize() === 0 ) { |
|
131 | + while (true) { |
|
132 | + $data = fgetcsv($csvFile); |
|
133 | + if ($data === false || ++$i % $this->importSettings->getBatchSize() === 0) { |
|
134 | 134 | try { |
135 | - $this->externalDataRepo->insertBatch( $accumulator ); |
|
136 | - } catch ( DBError $e ) { |
|
137 | - exit( 'Unknown database error occurred.' ); |
|
135 | + $this->externalDataRepo->insertBatch($accumulator); |
|
136 | + } catch (DBError $e) { |
|
137 | + exit('Unknown database error occurred.'); |
|
138 | 138 | } |
139 | 139 | $lbFactory->waitForReplication(); |
140 | 140 | |
141 | - $this->log( "\r\033[K" ); |
|
142 | - $this->log( "$i rows inserted" ); |
|
141 | + $this->log("\r\033[K"); |
|
142 | + $this->log("$i rows inserted"); |
|
143 | 143 | |
144 | 144 | $accumulator = []; |
145 | 145 | |
146 | - if ( $data === false ) { |
|
146 | + if ($data === false) { |
|
147 | 147 | break; |
148 | 148 | } |
149 | 149 | } |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | $accumulator[] = $data; |
152 | 152 | } |
153 | 153 | |
154 | - fclose( $csvFile ); |
|
154 | + fclose($csvFile); |
|
155 | 155 | |
156 | - $this->log( "\n" ); |
|
156 | + $this->log("\n"); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | 160 | * @param string $text |
161 | 161 | */ |
162 | - private function log( $text ) { |
|
163 | - if ( !$this->importSettings->isQuiet() ) { |
|
162 | + private function log($text) { |
|
163 | + if (!$this->importSettings->isQuiet()) { |
|
164 | 164 | print $text; |
165 | 165 | } |
166 | 166 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | EntityIdHtmlLinkFormatterFactory $entityIdHtmlLinkFormatterFactory, |
50 | 50 | DumpMetaInformationLookup $dumpMetaInformationRepo |
51 | 51 | ) { |
52 | - parent::__construct( 'ExternalDatabases' ); |
|
52 | + parent::__construct('ExternalDatabases'); |
|
53 | 53 | |
54 | 54 | $this->entityIdLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( |
55 | 55 | $this->getLanguage() |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return string |
74 | 74 | */ |
75 | 75 | public function getDescription() { |
76 | - return $this->msg( 'wbqev-externaldbs' )->text(); |
|
76 | + return $this->msg('wbqev-externaldbs')->text(); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -81,51 +81,51 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @param string|null $subPage |
83 | 83 | */ |
84 | - public function execute( $subPage ) { |
|
84 | + public function execute($subPage) { |
|
85 | 85 | $out = $this->getOutput(); |
86 | 86 | |
87 | 87 | $this->setHeaders(); |
88 | 88 | |
89 | 89 | $out->addHTML( |
90 | - Html::openElement( 'p' ) |
|
91 | - . $this->msg( 'wbqev-externaldbs-instructions' )->parse() |
|
92 | - . Html::closeElement( 'p' ) |
|
93 | - . Html::openElement( 'h3' ) |
|
94 | - . $this->msg( 'wbqev-externaldbs-overview-headline' )->parse() |
|
95 | - . Html::closeElement( 'h3' ) |
|
90 | + Html::openElement('p') |
|
91 | + . $this->msg('wbqev-externaldbs-instructions')->parse() |
|
92 | + . Html::closeElement('p') |
|
93 | + . Html::openElement('h3') |
|
94 | + . $this->msg('wbqev-externaldbs-overview-headline')->parse() |
|
95 | + . Html::closeElement('h3') |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | $dumps = $this->dumpMetaInformationRepo->getAll(); |
99 | - if ( $dumps !== [] ) { |
|
99 | + if ($dumps !== []) { |
|
100 | 100 | $groupedDumpMetaInformation = []; |
101 | - foreach ( $dumps as $dump ) { |
|
101 | + foreach ($dumps as $dump) { |
|
102 | 102 | $sourceItemId = $dump->getSourceItemId()->getSerialization(); |
103 | 103 | $groupedDumpMetaInformation[$sourceItemId][] = $dump; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $table = new HtmlTableBuilder( |
107 | 107 | [ |
108 | - $this->msg( 'wbqev-externaldbs-name' )->escaped(), |
|
109 | - $this->msg( 'wbqev-externaldbs-id' )->escaped(), |
|
110 | - $this->msg( 'wbqev-externaldbs-import-date' )->escaped(), |
|
111 | - $this->msg( 'wbqev-externaldbs-language' )->escaped(), |
|
112 | - $this->msg( 'wbqev-externaldbs-source-urls' )->escaped(), |
|
113 | - $this->msg( 'wbqev-externaldbs-size' )->escaped(), |
|
114 | - $this->msg( 'wbqev-externaldbs-license' )->escaped() |
|
108 | + $this->msg('wbqev-externaldbs-name')->escaped(), |
|
109 | + $this->msg('wbqev-externaldbs-id')->escaped(), |
|
110 | + $this->msg('wbqev-externaldbs-import-date')->escaped(), |
|
111 | + $this->msg('wbqev-externaldbs-language')->escaped(), |
|
112 | + $this->msg('wbqev-externaldbs-source-urls')->escaped(), |
|
113 | + $this->msg('wbqev-externaldbs-size')->escaped(), |
|
114 | + $this->msg('wbqev-externaldbs-license')->escaped() |
|
115 | 115 | ], |
116 | 116 | true |
117 | 117 | ); |
118 | 118 | |
119 | - foreach ( $groupedDumpMetaInformation as $dumpMetaInformation ) { |
|
120 | - $table->appendRows( $this->getRowGroup( $dumpMetaInformation ) ); |
|
119 | + foreach ($groupedDumpMetaInformation as $dumpMetaInformation) { |
|
120 | + $table->appendRows($this->getRowGroup($dumpMetaInformation)); |
|
121 | 121 | } |
122 | 122 | |
123 | - $out->addHTML( $table->toHtml() ); |
|
123 | + $out->addHTML($table->toHtml()); |
|
124 | 124 | } else { |
125 | 125 | $out->addHTML( |
126 | - Html::openElement( 'p' ) |
|
127 | - . $this->msg( 'wbqev-externaldbs-no-databases' )->escaped() |
|
128 | - . Html::closeElement( 'p' ) |
|
126 | + Html::openElement('p') |
|
127 | + . $this->msg('wbqev-externaldbs-no-databases')->escaped() |
|
128 | + . Html::closeElement('p') |
|
129 | 129 | ); |
130 | 130 | } |
131 | 131 | } |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return array[] |
139 | 139 | */ |
140 | - private function getRowGroup( array $dumpMetaInformationGroup ) { |
|
140 | + private function getRowGroup(array $dumpMetaInformationGroup) { |
|
141 | 141 | $rows = []; |
142 | 142 | |
143 | - foreach ( $dumpMetaInformationGroup as $dumpMetaInformation ) { |
|
143 | + foreach ($dumpMetaInformationGroup as $dumpMetaInformation) { |
|
144 | 144 | $dumpId = $dumpMetaInformation->getDumpId(); |
145 | - $importDate = $this->getLanguage()->timeanddate( $dumpMetaInformation->getImportDate() ); |
|
145 | + $importDate = $this->getLanguage()->timeanddate($dumpMetaInformation->getImportDate()); |
|
146 | 146 | $language = Language::fetchLanguageName( |
147 | 147 | $dumpMetaInformation->getLanguageCode(), |
148 | 148 | $this->getLanguage()->getCode() |
@@ -151,23 +151,23 @@ discard block |
||
151 | 151 | $dumpMetaInformation->getSourceUrl(), |
152 | 152 | $dumpMetaInformation->getSourceUrl() |
153 | 153 | ); |
154 | - $size = $this->getLanguage()->formatSize( $dumpMetaInformation->getSize() ); |
|
155 | - $license = $this->entityIdLinkFormatter->formatEntityId( $dumpMetaInformation->getLicenseItemId() ); |
|
154 | + $size = $this->getLanguage()->formatSize($dumpMetaInformation->getSize()); |
|
155 | + $license = $this->entityIdLinkFormatter->formatEntityId($dumpMetaInformation->getLicenseItemId()); |
|
156 | 156 | $rows[] = [ |
157 | - new HtmlTableCellBuilder( $dumpId ), |
|
158 | - new HtmlTableCellBuilder( $importDate ), |
|
159 | - new HtmlTableCellBuilder( $language ), |
|
160 | - new HtmlTableCellBuilder( $sourceUrl, [], true ), |
|
161 | - new HtmlTableCellBuilder( $size ), |
|
162 | - new HtmlTableCellBuilder( $license, [], true ) |
|
157 | + new HtmlTableCellBuilder($dumpId), |
|
158 | + new HtmlTableCellBuilder($importDate), |
|
159 | + new HtmlTableCellBuilder($language), |
|
160 | + new HtmlTableCellBuilder($sourceUrl, [], true), |
|
161 | + new HtmlTableCellBuilder($size), |
|
162 | + new HtmlTableCellBuilder($license, [], true) |
|
163 | 163 | ]; |
164 | 164 | } |
165 | 165 | |
166 | 166 | array_unshift( |
167 | 167 | $rows[0], |
168 | 168 | new HtmlTableCellBuilder( |
169 | - $this->entityIdLinkFormatter->formatEntityId( $dumpMetaInformationGroup[0]->getSourceItemId() ), |
|
170 | - [ 'rowspan' => (string)count( $dumpMetaInformationGroup ) ], |
|
169 | + $this->entityIdLinkFormatter->formatEntityId($dumpMetaInformationGroup[0]->getSourceItemId()), |
|
170 | + ['rowspan' => (string)count($dumpMetaInformationGroup)], |
|
171 | 171 | true |
172 | 172 | ) |
173 | 173 | ); |