wikimedia/mediawiki-extensions-Wikibase

View on GitHub
repo/rest-api/src/Application/UseCaseRequestValidation/ItemSerializationRequestValidatingDeserializer.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method handleDescriptionValidationErrors has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function handleDescriptionValidationErrors( ValidationError $validationError ): void {
        $context = $validationError->getContext();
        switch ( $validationError->getCode() ) {
            case DescriptionsSyntaxValidator::CODE_DESCRIPTIONS_NOT_ASSOCIATIVE:
                throw UseCaseError::newInvalidValue( '/item/descriptions' );

    Method handleSitelinksValidationErrors has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function handleSitelinksValidationErrors( ValidationError $validationError, array $serialization ): void {
            $context = $validationError->getContext();
            $siteId = fn() => $context[SitelinkValidator::CONTEXT_SITE_ID];
    
            switch ( $validationError->getCode() ) {

      Method handleStatementsValidationErrors has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      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 handleLabelValidationErrors has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function handleLabelValidationErrors( ValidationError $validationError ): void {
                $context = $validationError->getContext();
                switch ( $validationError->getCode() ) {
                    case LabelsSyntaxValidator::CODE_LABELS_NOT_ASSOCIATIVE:
                        throw UseCaseError::newInvalidValue( '/item/labels' );

          There are no issues that match your filters.

          Category
          Status