@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | private $referenceSerializer; |
22 | 22 | |
23 | - public function __construct( Serializer $dataValueSerializer, Serializer $referenceSerializer ) { |
|
23 | + public function __construct(Serializer $dataValueSerializer, Serializer $referenceSerializer) { |
|
24 | 24 | $this->dataValueSerializer = $dataValueSerializer; |
25 | 25 | $this->referenceSerializer = $referenceSerializer; |
26 | 26 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return Serializer |
43 | 43 | */ |
44 | 44 | public function newComparisonResultSerializer() { |
45 | - return new ComparisonResultSerializer( $this->dataValueSerializer ); |
|
45 | + return new ComparisonResultSerializer($this->dataValueSerializer); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return Serializer |
74 | 74 | */ |
75 | 75 | public function newReferenceResultSerializer() { |
76 | - return new ReferenceResultSerializer( $this->referenceSerializer ); |
|
76 | + return new ReferenceResultSerializer($this->referenceSerializer); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | private $dataValueSerializer; |
20 | 20 | |
21 | - public function __construct( Serializer $dataValueSerializer ) { |
|
21 | + public function __construct(Serializer $dataValueSerializer) { |
|
22 | 22 | $this->dataValueSerializer = $dataValueSerializer; |
23 | 23 | } |
24 | 24 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return bool |
31 | 31 | */ |
32 | - public function isSerializerFor( $object ) { |
|
32 | + public function isSerializerFor($object) { |
|
33 | 33 | return $object instanceof ComparisonResult; |
34 | 34 | } |
35 | 35 | |
@@ -41,29 +41,29 @@ discard block |
||
41 | 41 | * @return array |
42 | 42 | * @throws UnsupportedObjectException |
43 | 43 | */ |
44 | - public function serialize( $object ) { |
|
45 | - if ( !$this->isSerializerFor( $object ) ) { |
|
44 | + public function serialize($object) { |
|
45 | + if (!$this->isSerializerFor($object)) { |
|
46 | 46 | throw new UnsupportedObjectException( |
47 | 47 | $object, |
48 | 48 | 'ComparisonResultSerializer can only serialize ComparisonResult objects.' |
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
52 | - return $this->getSerialized( $object ); |
|
52 | + return $this->getSerialized($object); |
|
53 | 53 | } |
54 | 54 | |
55 | - private function getSerialized( ComparisonResult $comparisonResult ) { |
|
55 | + private function getSerialized(ComparisonResult $comparisonResult) { |
|
56 | 56 | $dataValueSerializer = $this->dataValueSerializer; |
57 | 57 | $externalValues = array_map( |
58 | - function ( $dataValue ) use ( $dataValueSerializer ) { |
|
59 | - return $dataValueSerializer->serialize( $dataValue ); |
|
58 | + function($dataValue) use ($dataValueSerializer) { |
|
59 | + return $dataValueSerializer->serialize($dataValue); |
|
60 | 60 | }, |
61 | 61 | $comparisonResult->getExternalValues() |
62 | 62 | ); |
63 | - $this->setIndexedTagName( $externalValues, 'dataValue' ); |
|
63 | + $this->setIndexedTagName($externalValues, 'dataValue'); |
|
64 | 64 | |
65 | 65 | return [ |
66 | - 'localValue' => $this->dataValueSerializer->serialize( $comparisonResult->getLocalValue() ), |
|
66 | + 'localValue' => $this->dataValueSerializer->serialize($comparisonResult->getLocalValue()), |
|
67 | 67 | 'externalValues' => $externalValues, |
68 | 68 | 'result' => $comparisonResult->getStatus() |
69 | 69 | ]; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | private $crossCheckResultSerializer; |
20 | 20 | |
21 | - public function __construct( Serializer $crossCheckResultSerializer ) { |
|
21 | + public function __construct(Serializer $crossCheckResultSerializer) { |
|
22 | 22 | $this->crossCheckResultSerializer = $crossCheckResultSerializer; |
23 | 23 | } |
24 | 24 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return bool |
31 | 31 | */ |
32 | - public function isSerializerFor( $object ) { |
|
32 | + public function isSerializerFor($object) { |
|
33 | 33 | return $object instanceof CrossCheckResultList; |
34 | 34 | } |
35 | 35 | |
@@ -41,29 +41,29 @@ discard block |
||
41 | 41 | * @return array |
42 | 42 | * @throws UnsupportedObjectException |
43 | 43 | */ |
44 | - public function serialize( $object ) { |
|
45 | - if ( !$this->isSerializerFor( $object ) ) { |
|
44 | + public function serialize($object) { |
|
45 | + if (!$this->isSerializerFor($object)) { |
|
46 | 46 | throw new UnsupportedObjectException( |
47 | 47 | $object, |
48 | 48 | 'CrossCheckResultListSerializer can only serialize CrossCheckResultList objects.' |
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
52 | - return $this->getSerialized( $object ); |
|
52 | + return $this->getSerialized($object); |
|
53 | 53 | } |
54 | 54 | |
55 | - private function getSerialized( CrossCheckResultList $resultList ) { |
|
55 | + private function getSerialized(CrossCheckResultList $resultList) { |
|
56 | 56 | $serialization = []; |
57 | - $this->setKeyAttributeName( $serialization, 'property', 'id' ); |
|
57 | + $this->setKeyAttributeName($serialization, 'property', 'id'); |
|
58 | 58 | |
59 | - foreach ( $resultList->getPropertyIds() as $propertyId ) { |
|
59 | + foreach ($resultList->getPropertyIds() as $propertyId) { |
|
60 | 60 | $id = $propertyId->getSerialization(); |
61 | 61 | $resultSerialization = []; |
62 | 62 | |
63 | - $this->setIndexedTagName( $resultSerialization, 'result' ); |
|
63 | + $this->setIndexedTagName($resultSerialization, 'result'); |
|
64 | 64 | |
65 | - foreach ( $resultList->getByPropertyId( $propertyId ) as $result ) { |
|
66 | - $resultSerialization[] = $this->crossCheckResultSerializer->serialize( $result ); |
|
65 | + foreach ($resultList->getByPropertyId($propertyId) as $result) { |
|
66 | + $resultSerialization[] = $this->crossCheckResultSerializer->serialize($result); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $serialization[$id] = $resultSerialization; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | private $referenceSerializer; |
20 | 20 | |
21 | - public function __construct( Serializer $referenceSerializer ) { |
|
21 | + public function __construct(Serializer $referenceSerializer) { |
|
22 | 22 | $this->referenceSerializer = $referenceSerializer; |
23 | 23 | } |
24 | 24 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return bool |
31 | 31 | */ |
32 | - public function isSerializerFor( $object ) { |
|
32 | + public function isSerializerFor($object) { |
|
33 | 33 | return $object instanceof ReferenceResult; |
34 | 34 | } |
35 | 35 | |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | * @return array |
42 | 42 | * @throws UnsupportedObjectException |
43 | 43 | */ |
44 | - public function serialize( $object ) { |
|
45 | - if ( !$this->isSerializerFor( $object ) ) { |
|
44 | + public function serialize($object) { |
|
45 | + if (!$this->isSerializerFor($object)) { |
|
46 | 46 | throw new UnsupportedObjectException( |
47 | 47 | $object, |
48 | 48 | 'ReferenceResultSerializer can only serialize ReferenceResult objects.' |
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
52 | - return $this->getSerialized( $object ); |
|
52 | + return $this->getSerialized($object); |
|
53 | 53 | } |
54 | 54 | |
55 | - private function getSerialized( ReferenceResult $referenceResult ) { |
|
55 | + private function getSerialized(ReferenceResult $referenceResult) { |
|
56 | 56 | return [ |
57 | - 'reference' => $this->referenceSerializer->serialize( $referenceResult->getReference() ), |
|
57 | + 'reference' => $this->referenceSerializer->serialize($referenceResult->getReference()), |
|
58 | 58 | 'status' => $referenceResult->getStatus() |
59 | 59 | ]; |
60 | 60 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | EntityIdHtmlLinkFormatterFactory $entityIdHtmlLinkFormatterFactory, |
54 | 54 | DumpMetaInformationLookup $dumpMetaInformationRepo |
55 | 55 | ) { |
56 | - parent::__construct( 'ExternalDatabases' ); |
|
56 | + parent::__construct('ExternalDatabases'); |
|
57 | 57 | |
58 | 58 | $this->entityIdLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( |
59 | - new LanguageLabelDescriptionLookup( $termLookup, $this->getLanguage()->getCode() ) |
|
59 | + new LanguageLabelDescriptionLookup($termLookup, $this->getLanguage()->getCode()) |
|
60 | 60 | ); |
61 | 61 | |
62 | 62 | $this->dumpMetaInformationRepo = $dumpMetaInformationRepo; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return string |
78 | 78 | */ |
79 | 79 | public function getDescription() { |
80 | - return $this->msg( 'wbqev-externaldbs' )->text(); |
|
80 | + return $this->msg('wbqev-externaldbs')->text(); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -85,51 +85,51 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param string|null $subPage |
87 | 87 | */ |
88 | - public function execute( $subPage ) { |
|
88 | + public function execute($subPage) { |
|
89 | 89 | $out = $this->getOutput(); |
90 | 90 | |
91 | 91 | $this->setHeaders(); |
92 | 92 | |
93 | 93 | $out->addHTML( |
94 | - Html::openElement( 'p' ) |
|
95 | - . $this->msg( 'wbqev-externaldbs-instructions' )->parse() |
|
96 | - . Html::closeElement( 'p' ) |
|
97 | - . Html::openElement( 'h3' ) |
|
98 | - . $this->msg( 'wbqev-externaldbs-overview-headline' )->parse() |
|
99 | - . Html::closeElement( 'h3' ) |
|
94 | + Html::openElement('p') |
|
95 | + . $this->msg('wbqev-externaldbs-instructions')->parse() |
|
96 | + . Html::closeElement('p') |
|
97 | + . Html::openElement('h3') |
|
98 | + . $this->msg('wbqev-externaldbs-overview-headline')->parse() |
|
99 | + . Html::closeElement('h3') |
|
100 | 100 | ); |
101 | 101 | |
102 | 102 | $dumps = $this->dumpMetaInformationRepo->getAll(); |
103 | - if ( count( $dumps ) > 0 ) { |
|
103 | + if (count($dumps) > 0) { |
|
104 | 104 | $groupedDumpMetaInformation = []; |
105 | - foreach ( $dumps as $dump ) { |
|
105 | + foreach ($dumps as $dump) { |
|
106 | 106 | $sourceItemId = $dump->getSourceItemId()->getSerialization(); |
107 | 107 | $groupedDumpMetaInformation[$sourceItemId][] = $dump; |
108 | 108 | } |
109 | 109 | |
110 | 110 | $table = new HtmlTableBuilder( |
111 | 111 | [ |
112 | - $this->msg( 'wbqev-externaldbs-name' )->escaped(), |
|
113 | - $this->msg( 'wbqev-externaldbs-id' )->escaped(), |
|
114 | - $this->msg( 'wbqev-externaldbs-import-date' )->escaped(), |
|
115 | - $this->msg( 'wbqev-externaldbs-language' )->escaped(), |
|
116 | - $this->msg( 'wbqev-externaldbs-source-urls' )->escaped(), |
|
117 | - $this->msg( 'wbqev-externaldbs-size' )->escaped(), |
|
118 | - $this->msg( 'wbqev-externaldbs-license' )->escaped() |
|
112 | + $this->msg('wbqev-externaldbs-name')->escaped(), |
|
113 | + $this->msg('wbqev-externaldbs-id')->escaped(), |
|
114 | + $this->msg('wbqev-externaldbs-import-date')->escaped(), |
|
115 | + $this->msg('wbqev-externaldbs-language')->escaped(), |
|
116 | + $this->msg('wbqev-externaldbs-source-urls')->escaped(), |
|
117 | + $this->msg('wbqev-externaldbs-size')->escaped(), |
|
118 | + $this->msg('wbqev-externaldbs-license')->escaped() |
|
119 | 119 | ], |
120 | 120 | true |
121 | 121 | ); |
122 | 122 | |
123 | - foreach ( $groupedDumpMetaInformation as $dumpMetaInformation ) { |
|
124 | - $table->appendRows( $this->getRowGroup( $dumpMetaInformation ) ); |
|
123 | + foreach ($groupedDumpMetaInformation as $dumpMetaInformation) { |
|
124 | + $table->appendRows($this->getRowGroup($dumpMetaInformation)); |
|
125 | 125 | } |
126 | 126 | |
127 | - $out->addHTML( $table->toHtml() ); |
|
127 | + $out->addHTML($table->toHtml()); |
|
128 | 128 | } else { |
129 | 129 | $out->addHTML( |
130 | - Html::openElement( 'p' ) |
|
131 | - . $this->msg( 'wbqev-externaldbs-no-databases' )->escaped() |
|
132 | - . Html::closeElement( 'p' ) |
|
130 | + Html::openElement('p') |
|
131 | + . $this->msg('wbqev-externaldbs-no-databases')->escaped() |
|
132 | + . Html::closeElement('p') |
|
133 | 133 | ); |
134 | 134 | } |
135 | 135 | } |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return array |
143 | 143 | */ |
144 | - private function getRowGroup( array $dumpMetaInformationGroup ) { |
|
144 | + private function getRowGroup(array $dumpMetaInformationGroup) { |
|
145 | 145 | $rows = []; |
146 | 146 | |
147 | - foreach ( $dumpMetaInformationGroup as $dumpMetaInformation ) { |
|
147 | + foreach ($dumpMetaInformationGroup as $dumpMetaInformation) { |
|
148 | 148 | $dumpId = $dumpMetaInformation->getDumpId(); |
149 | - $importDate = $this->getLanguage()->timeanddate( $dumpMetaInformation->getImportDate() ); |
|
149 | + $importDate = $this->getLanguage()->timeanddate($dumpMetaInformation->getImportDate()); |
|
150 | 150 | $language = Language::fetchLanguageName( |
151 | 151 | $dumpMetaInformation->getLanguageCode(), |
152 | 152 | $this->getLanguage()->getCode() |
@@ -155,23 +155,23 @@ discard block |
||
155 | 155 | $dumpMetaInformation->getSourceUrl(), |
156 | 156 | $dumpMetaInformation->getSourceUrl() |
157 | 157 | ); |
158 | - $size = $this->getLanguage()->formatSize( $dumpMetaInformation->getSize() ); |
|
159 | - $license = $this->entityIdLinkFormatter->formatEntityId( $dumpMetaInformation->getLicenseItemId() ); |
|
158 | + $size = $this->getLanguage()->formatSize($dumpMetaInformation->getSize()); |
|
159 | + $license = $this->entityIdLinkFormatter->formatEntityId($dumpMetaInformation->getLicenseItemId()); |
|
160 | 160 | $rows[] = [ |
161 | - new HtmlTableCellBuilder( $dumpId ), |
|
162 | - new HtmlTableCellBuilder( $importDate ), |
|
163 | - new HtmlTableCellBuilder( $language ), |
|
164 | - new HtmlTableCellBuilder( $sourceUrl, [], true ), |
|
165 | - new HtmlTableCellBuilder( $size ), |
|
166 | - new HtmlTableCellBuilder( $license, [], true ) |
|
161 | + new HtmlTableCellBuilder($dumpId), |
|
162 | + new HtmlTableCellBuilder($importDate), |
|
163 | + new HtmlTableCellBuilder($language), |
|
164 | + new HtmlTableCellBuilder($sourceUrl, [], true), |
|
165 | + new HtmlTableCellBuilder($size), |
|
166 | + new HtmlTableCellBuilder($license, [], true) |
|
167 | 167 | ]; |
168 | 168 | } |
169 | 169 | |
170 | 170 | array_unshift( |
171 | 171 | $rows[0], |
172 | 172 | new HtmlTableCellBuilder( |
173 | - $this->entityIdLinkFormatter->formatEntityId( $dumpMetaInformationGroup[0]->getSourceItemId() ), |
|
174 | - [ 'rowspan' => (string)count( $dumpMetaInformationGroup ) ], |
|
173 | + $this->entityIdLinkFormatter->formatEntityId($dumpMetaInformationGroup[0]->getSourceItemId()), |
|
174 | + ['rowspan' => (string)count($dumpMetaInformationGroup)], |
|
175 | 175 | true |
176 | 176 | ) |
177 | 177 | ); |