Code Duplication    Length = 12-12 lines in 2 locations

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

@@ 803-814 (lines=12) @@
800
				$error = '';
801
802
				$activated_count = count( $activated );
803
				if ( $activated_count > 0 ) {
804
					$activated_last = array_pop( $activated );
805
					$activated_text = $activated_count > 1 ? sprintf(
806
						/* Translators: first variable is a list followed by a last item. Example: dog, cat and bird. */
807
						__( '%s and %s', 'jetpack' ),
808
						join( ', ', $activated ), $activated_last ) : $activated_last;
809
810
					$error = sprintf(
811
						/* Translators: the plural variable is a list followed by a last item. Example: dog, cat and bird. */
812
						_n( 'The module %s was activated.', 'The modules %s were activated.', $activated_count, 'jetpack' ),
813
						$activated_text ) . ' ';
814
				}
815
816
				$failed_count = count( $failed );
817
				if ( count( $failed ) > 0 ) {
@@ 817-828 (lines=12) @@
814
				}
815
816
				$failed_count = count( $failed );
817
				if ( count( $failed ) > 0 ) {
818
					$failed_last = array_pop( $failed );
819
					$failed_text = $failed_count > 1 ? sprintf(
820
						/* Translators: first variable is a list followed by a last item. Example: dog, cat and bird. */
821
						__( '%s and %s', 'jetpack' ),
822
						join( ', ', $failed ), $failed_last ) : $failed_last;
823
824
					$error = sprintf(
825
						/* Translators: the plural variable is a list followed by a last item. Example: dog, cat and bird. */
826
						_n( 'The module %s failed to be activated.', 'The modules %s failed to be activated.', $failed_count, 'jetpack' ),
827
						$failed_text ) . ' ';
828
				}
829
			}
830
			return new WP_Error( 'activation_failed', esc_html( $error ), array( 'status' => 424 ) );
831
		}