Code Duplication    Length = 12-12 lines in 2 locations

_inc/lib/class.core-rest-api-endpoints.php 2 locations

@@ 763-774 (lines=12) @@
760
				$error = '';
761
762
				$activated_count = count( $activated );
763
				if ( $activated_count > 0 ) {
764
					$activated_last = array_pop( $activated );
765
					$activated_text = $activated_count > 1 ? sprintf(
766
						/* Translators: first variable is a list followed by a last item. Example: dog, cat and bird. */
767
						__( '%s and %s', 'jetpack' ),
768
						join( ', ', $activated ), $activated_last ) : $activated_last;
769
770
					$error = sprintf(
771
						/* Translators: the plural variable is a list followed by a last item. Example: dog, cat and bird. */
772
						_n( 'The module %s was activated.', 'The modules %s were activated.', $activated_count, 'jetpack' ),
773
						$activated_text ) . ' ';
774
				}
775
776
				$failed_count = count( $failed );
777
				if ( count( $failed ) > 0 ) {
@@ 777-788 (lines=12) @@
774
				}
775
776
				$failed_count = count( $failed );
777
				if ( count( $failed ) > 0 ) {
778
					$failed_last = array_pop( $failed );
779
					$failed_text = $failed_count > 1 ? sprintf(
780
						/* Translators: first variable is a list followed by a last item. Example: dog, cat and bird. */
781
						__( '%s and %s', 'jetpack' ),
782
						join( ', ', $failed ), $failed_last ) : $failed_last;
783
784
					$error = sprintf(
785
						/* Translators: the plural variable is a list followed by a last item. Example: dog, cat and bird. */
786
						_n( 'The module %s failed to be activated.', 'The modules %s failed to be activated.', $failed_count, 'jetpack' ),
787
						$failed_text ) . ' ';
788
				}
789
			}
790
			return new WP_Error( 'activation_failed', esc_html( $error ), array( 'status' => 424 ) );
791
		}