@@ -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 | ); |
@@ -15,10 +15,10 @@ |
||
| 15 | 15 | * |
| 16 | 16 | * @return bool |
| 17 | 17 | */ |
| 18 | - public static function onCreateSchema( DatabaseUpdater $updater ) { |
|
| 19 | - $updater->addExtensionTable( 'wbqev_dump_information', __DIR__ . '/sql/create_wbqev_dump_information.sql' ); |
|
| 20 | - $updater->addExtensionTable( 'wbqev_external_data', __DIR__ . '/sql/create_wbqev_external_data.sql' ); |
|
| 21 | - $updater->addExtensionTable( 'wbqev_identifier_properties', __DIR__ . '/sql/create_wbqev_identifier_properties.sql' ); |
|
| 18 | + public static function onCreateSchema(DatabaseUpdater $updater) { |
|
| 19 | + $updater->addExtensionTable('wbqev_dump_information', __DIR__.'/sql/create_wbqev_dump_information.sql'); |
|
| 20 | + $updater->addExtensionTable('wbqev_external_data', __DIR__.'/sql/create_wbqev_external_data.sql'); |
|
| 21 | + $updater->addExtensionTable('wbqev_identifier_properties', __DIR__.'/sql/create_wbqev_identifier_properties.sql'); |
|
| 22 | 22 | |
| 23 | 23 | return true; |
| 24 | 24 | } |