Code Duplication    Length = 12-12 lines in 2 locations

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

@@ 786-797 (lines=12) @@
783
				$error = '';
784
785
				$activated_count = count( $activated );
786
				if ( $activated_count > 0 ) {
787
					$activated_last = array_pop( $activated );
788
					$activated_text = $activated_count > 1 ? sprintf(
789
						/* Translators: first variable is a list followed by a last item. Example: dog, cat and bird. */
790
						__( '%s and %s', 'jetpack' ),
791
						join( ', ', $activated ), $activated_last ) : $activated_last;
792
793
					$error = sprintf(
794
						/* Translators: the plural variable is a list followed by a last item. Example: dog, cat and bird. */
795
						_n( 'The module %s was activated.', 'The modules %s were activated.', $activated_count, 'jetpack' ),
796
						$activated_text ) . ' ';
797
				}
798
799
				$failed_count = count( $failed );
800
				if ( count( $failed ) > 0 ) {
@@ 800-811 (lines=12) @@
797
				}
798
799
				$failed_count = count( $failed );
800
				if ( count( $failed ) > 0 ) {
801
					$failed_last = array_pop( $failed );
802
					$failed_text = $failed_count > 1 ? sprintf(
803
						/* Translators: first variable is a list followed by a last item. Example: dog, cat and bird. */
804
						__( '%s and %s', 'jetpack' ),
805
						join( ', ', $failed ), $failed_last ) : $failed_last;
806
807
					$error = sprintf(
808
						/* Translators: the plural variable is a list followed by a last item. Example: dog, cat and bird. */
809
						_n( 'The module %s failed to be activated.', 'The modules %s failed to be activated.', $failed_count, 'jetpack' ),
810
						$failed_text ) . ' ';
811
				}
812
			}
813
			return new WP_Error( 'activation_failed', esc_html( $error ), array( 'status' => 424 ) );
814
		}