Showing 1,432 of 2,096 total issues
Method validateLabelText
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function validateLabelText( string $labelText, string $language ): ?ValidationError {
$result = $this->termValidatorFactory
->getLabelValidator( Property::ENTITY_TYPE )
->validate( $labelText );
if ( !$result->isValid() ) {
Method validateDescriptionText
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function validateDescriptionText( string $descriptionText, string $language ): ?ValidationError {
$result = $this->termValidatorFactory
->getDescriptionValidator()
->validate( $descriptionText );
if ( !$result->isValid() ) {
Method fixEditConflict
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function fixEditConflict( EntityDocument $newEntity ): ?EntityDocument {
$baseRev = $this->getBaseRevision();
$latestRev = $this->getLatestRevision();
if ( !$latestRev ) {
Method buildClaimSummary
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function buildClaimSummary( ?Statement $oldStatement, Statement $newStatement ) {
$summary = new Summary( $this->apiModuleName );
// Only one statement touched, so we're always having singular here.
$summary->addAutoCommentArgs( 1 );
$summary->addAutoSummaryArgs( [
Method validateAndDeserializeStatement
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function validateAndDeserializeStatement( $patchedStatement ): Statement {
if (
!is_array( $patchedStatement ) || ( count( $patchedStatement ) && array_is_list( $patchedStatement ) ) ) {
throw UseCaseError::newPatchResultInvalidValue( '', $patchedStatement );
}
Method handleStatementsValidationErrors
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function handleStatementsValidationErrors( ValidationError $validationError ): void {
$context = $validationError->getContext();
switch ( $validationError->getCode() ) {
case StatementsValidator::CODE_STATEMENTS_NOT_ASSOCIATIVE:
case StatementsValidator::CODE_STATEMENT_GROUP_NOT_SEQUENTIAL:
Method newStatementGroupListView
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function newStatementGroupListView(
$languageCode,
TermLanguageFallbackChain $termFallbackChain,
EditSectionGenerator $editSectionGenerator
) {
Method validateLabelText
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function validateLabelText( string $labelText, string $language ): ?ValidationError {
$result = $this->termValidatorFactory
->getLabelValidator( Item::ENTITY_TYPE )
->validate( $labelText );
if ( !$result->isValid() ) {
Method newSuccessHttpResponse
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function newSuccessHttpResponse( CreateItemResponse $useCaseResponse ): Response {
$response = $this->getResponseFactory()->create();
$response->setStatus( 201 );
$response->setHeader( 'Content-Type', 'application/json' );
$response->setHeader(
Method validateAndDeserialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function validateAndDeserialize( SitelinkEditRequest $request ): SiteLink {
$validationError = $this->validator->validate( $request->getItemId(), $request->getSiteId(), $request->getSitelink(), '/sitelink' );
if ( $validationError ) {
$context = $validationError->getContext();
Method execute
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute( AddPropertyAliasesInLanguageRequest $request ): AddPropertyAliasesInLanguageResponse {
$deserializedRequest = $this->validator->validateAndDeserialize( $request );
$propertyId = $deserializedRequest->getPropertyId();
$languageCode = $deserializedRequest->getLanguageCode();
Method handleLabelValidationErrors
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function handleLabelValidationErrors( ValidationError $validationError ): void {
$context = $validationError->getContext();
switch ( $validationError->getCode() ) {
case LabelsSyntaxValidator::CODE_LABELS_NOT_ASSOCIATIVE:
throw UseCaseError::newInvalidValue( '/item/labels' );
Method execute
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute( AddItemAliasesInLanguageRequest $request ): AddItemAliasesInLanguageResponse {
$deserializedRequest = $this->validator->validateAndDeserialize( $request );
$itemId = $deserializedRequest->getItemId();
$languageCode = $deserializedRequest->getLanguageCode();
Method addLanguageAndVariantsToChain
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function addLanguageAndVariantsToChain( $language, array &$chain, array &$fetched ): void {
$languageCode = is_string( $language ) ? $language : $language->getCode();
$this->addLanguageToChain( $language, $chain, $fetched );
Method newGlobeCoordinateFormatter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function newGlobeCoordinateFormatter( $format, FormatterOptions $options ) {
$isHtmlVerboseFormat = $this->snakFormat->isPossibleFormat( SnakFormatter::FORMAT_HTML_VERBOSE, $format );
if ( $isHtmlVerboseFormat && $this->kartographerEmbeddingHandler ) {
$isPreview = $format === SnakFormatter::FORMAT_HTML_VERBOSE_PREVIEW;
Method mapToTextInLangIds
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function mapToTextInLangIds(
array $termsArray,
ReplicaPrimaryAwareRecordIdsAcquirer $textInLangIdsAcquirer
) {
$flattenedLangTextIds = [];
Method buildFromBabel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function buildFromBabel( array $babel ) {
$chain = [];
$fetched = [];
// validate all the language codes and discard invalid ones
Method getMatchingTermIndexEntries
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getMatchingTermIndexEntries(
$text,
$languageCode,
$entityType,
array $termTypes
Method getReferencedEntityId
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getReferencedEntityId( EntityId $fromId, PropertyId $propertyId, array $toIds ) {
if ( !$toIds ) {
return null;
}
Method decode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function decode( string $string, array $loggingContext ): ?array {
$result = json_decode( $string );
if ( !is_array( $result ) || count( $result ) !== 3 ) {
$this->logger->alert( 'Unknown or invalid cache format', $loggingContext + [