[MediaWiki-commits] [Gerrit] Minor clean-ups in EntityTermsView and related - change (mediawiki...Wikibase)
jenkins-bot has submitted this change and it was merged. Change subject: Minor clean-ups in EntityTermsView and related .. Minor clean-ups in EntityTermsView and related More specific type hints and splitting not so well readable code. Change-Id: I376aaf29b183b612667ffcb1e84c7f6768c9766c --- M view/src/EditSectionGenerator.php M view/src/EntityTermsView.php M view/src/TextInjector.php 3 files changed, 24 insertions(+), 26 deletions(-) Approvals: Jonas Kress (WMDE): Verified Daniel Kinzler: Looks good to me, approved jenkins-bot: Verified diff --git a/view/src/EditSectionGenerator.php b/view/src/EditSectionGenerator.php index 83b2603..fa068f3 100644 --- a/view/src/EditSectionGenerator.php +++ b/view/src/EditSectionGenerator.php @@ -22,7 +22,7 @@ * @since 0.5 * * @param EntityId|null $entityId -* @return string +* @return string HTML */ public function getSiteLinksEditSection( EntityId $entityId = null ); @@ -33,7 +33,7 @@ * * @param string $languageCode * @param EntityId|null $entityId -* @return string +* @return string HTML */ public function getLabelDescriptionAliasesEditSection( $languageCode, EntityId $entityId = null ); @@ -43,7 +43,7 @@ * @since 0.5 * * @param Statement $statement -* @return string +* @return string HTML */ public function getStatementEditSection( Statement $statement ); @@ -54,7 +54,7 @@ * * @param PropertyId $propertyId The property of the statement group * @param EntityId|null $entityId The id of the entity on which to add a statement -* @return string +* @return string HTML */ public function getAddStatementToGroupSection( PropertyId $propertyId, EntityId $entityId = null ); diff --git a/view/src/EntityTermsView.php b/view/src/EntityTermsView.php index 6bb7e6b..5344bc9 100644 --- a/view/src/EntityTermsView.php +++ b/view/src/EntityTermsView.php @@ -68,7 +68,7 @@ * @param string $termBoxHtml * @param TextInjector $textInjector * -* @return string +* @return string HTML */ public function getHtml( Fingerprint $fingerprint, @@ -78,6 +78,9 @@ ) { $descriptions = $fingerprint->getDescriptions(); $aliasGroups = $fingerprint->getAliasGroups(); + $marker = $textInjector->newMarker( + 'entityViewPlaceholder-entitytermsview-entitytermsforlanguagelistview-class' + ); return $this->templateFactory->render( 'wikibase-entitytermsview', $descriptions->hasTermForLanguage( $this->languageCode ) ? '' : 'wb-empty', @@ -85,9 +88,7 @@ $aliasGroups->hasGroupForLanguage( $this->languageCode ) ? '' : 'wb-empty', $this->getHtmlForAliases( $aliasGroups ), $termBoxHtml, - $textInjector->newMarker( - 'entityViewPlaceholder-entitytermsview-entitytermsforlanguagelistview-class' - ), + $marker, $this->getHtmlForLabelDescriptionAliasesEditSection( $entityId ) ); } @@ -96,7 +97,7 @@ * @param Fingerprint $fingerprint * @param EntityId $entityId * -* @return string +* @return string HTML */ public function getTitleHtml( Fingerprint $fingerprint, @@ -128,7 +129,7 @@ /** * @param TermList $descriptions the list of descriptions to render * -* @return string +* @return string HTML */ private function getDescriptionText( TermList $descriptions ) { if ( $descriptions->hasTermForLanguage( $this->languageCode ) ) { @@ -142,7 +143,7 @@ /** * @param AliasGroupList $aliasGroups the list of alias groups to render * -* @return string +* @return string HTML */ private function getHtmlForAliases( AliasGroupList $aliasGroups ) { if ( $aliasGroups->hasGroupForLanguage( $this->languageCode ) ) { @@ -168,7 +169,7 @@ * @param string[] $languageCodes The languages the user requested to be shown * @param Title|null $title * -* @return string +* @return string HTML */ public function getEntityTermsForLanguageListView( Fingerprint $fingerprint, @@ -199,17 +200,16 @@ * @param string $languageCode * @param Title|null $title * -* @return string +* @return string HTML */ private function getEntityTermsForLanguageView(
[MediaWiki-commits] [Gerrit] Minor clean-ups in EntityTermsView and related - change (mediawiki...Wikibase)
Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/249087 Change subject: Minor clean-ups in EntityTermsView and related .. Minor clean-ups in EntityTermsView and related More specific type hints and splitting not so well readable code. Change-Id: I376aaf29b183b612667ffcb1e84c7f6768c9766c --- M view/src/EditSectionGenerator.php M view/src/EntityTermsView.php M view/src/TextInjector.php 3 files changed, 24 insertions(+), 26 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/87/249087/1 diff --git a/view/src/EditSectionGenerator.php b/view/src/EditSectionGenerator.php index 83b2603..fa068f3 100644 --- a/view/src/EditSectionGenerator.php +++ b/view/src/EditSectionGenerator.php @@ -22,7 +22,7 @@ * @since 0.5 * * @param EntityId|null $entityId -* @return string +* @return string HTML */ public function getSiteLinksEditSection( EntityId $entityId = null ); @@ -33,7 +33,7 @@ * * @param string $languageCode * @param EntityId|null $entityId -* @return string +* @return string HTML */ public function getLabelDescriptionAliasesEditSection( $languageCode, EntityId $entityId = null ); @@ -43,7 +43,7 @@ * @since 0.5 * * @param Statement $statement -* @return string +* @return string HTML */ public function getStatementEditSection( Statement $statement ); @@ -54,7 +54,7 @@ * * @param PropertyId $propertyId The property of the statement group * @param EntityId|null $entityId The id of the entity on which to add a statement -* @return string +* @return string HTML */ public function getAddStatementToGroupSection( PropertyId $propertyId, EntityId $entityId = null ); diff --git a/view/src/EntityTermsView.php b/view/src/EntityTermsView.php index 6bb7e6b..5344bc9 100644 --- a/view/src/EntityTermsView.php +++ b/view/src/EntityTermsView.php @@ -68,7 +68,7 @@ * @param string $termBoxHtml * @param TextInjector $textInjector * -* @return string +* @return string HTML */ public function getHtml( Fingerprint $fingerprint, @@ -78,6 +78,9 @@ ) { $descriptions = $fingerprint->getDescriptions(); $aliasGroups = $fingerprint->getAliasGroups(); + $marker = $textInjector->newMarker( + 'entityViewPlaceholder-entitytermsview-entitytermsforlanguagelistview-class' + ); return $this->templateFactory->render( 'wikibase-entitytermsview', $descriptions->hasTermForLanguage( $this->languageCode ) ? '' : 'wb-empty', @@ -85,9 +88,7 @@ $aliasGroups->hasGroupForLanguage( $this->languageCode ) ? '' : 'wb-empty', $this->getHtmlForAliases( $aliasGroups ), $termBoxHtml, - $textInjector->newMarker( - 'entityViewPlaceholder-entitytermsview-entitytermsforlanguagelistview-class' - ), + $marker, $this->getHtmlForLabelDescriptionAliasesEditSection( $entityId ) ); } @@ -96,7 +97,7 @@ * @param Fingerprint $fingerprint * @param EntityId $entityId * -* @return string +* @return string HTML */ public function getTitleHtml( Fingerprint $fingerprint, @@ -128,7 +129,7 @@ /** * @param TermList $descriptions the list of descriptions to render * -* @return string +* @return string HTML */ private function getDescriptionText( TermList $descriptions ) { if ( $descriptions->hasTermForLanguage( $this->languageCode ) ) { @@ -142,7 +143,7 @@ /** * @param AliasGroupList $aliasGroups the list of alias groups to render * -* @return string +* @return string HTML */ private function getHtmlForAliases( AliasGroupList $aliasGroups ) { if ( $aliasGroups->hasGroupForLanguage( $this->languageCode ) ) { @@ -168,7 +169,7 @@ * @param string[] $languageCodes The languages the user requested to be shown * @param Title|null $title * -* @return string +* @return string HTML */ public function getEntityTermsForLanguageListView( Fingerprint $fingerprint, @@ -199,17 +200,16 @@ * @param string $languageCode * @param Title|null $title * -* @return string +* @return string HTML */ private function