Code Duplication    Length = 9-9 lines in 2 locations

projects/plugins/jetpack/class.jetpack.php 1 location

@@ 1227-1235 (lines=9) @@
1224
			case 'jetpack_network_sites_page':
1225
				$caps = array( 'manage_sites' );
1226
				break;
1227
			case 'jetpack_admin_page':
1228
				$is_offline_mode = ( new Status() )->is_offline_mode();
1229
				if ( $is_offline_mode ) {
1230
					$caps = array( 'manage_options' );
1231
					break;
1232
				} else {
1233
					$caps = array( 'read' );
1234
				}
1235
				break;
1236
		}
1237
		return $caps;
1238
	}

projects/packages/connection/src/class-manager.php 1 location

@@ 1126-1134 (lines=9) @@
1123
				 */
1124
				$caps = apply_filters( 'jetpack_disconnect_cap', array( 'manage_options' ) );
1125
				break;
1126
			case 'jetpack_connect_user':
1127
				$is_offline_mode = ( new Status() )->is_offline_mode();
1128
				if ( $is_offline_mode ) {
1129
					$caps = array( 'do_not_allow' );
1130
					break;
1131
				}
1132
				// With user-less connections in mind, non-admin users can connect their account only if a connection owner exists.
1133
				$caps = $this->has_connected_owner() ? array( 'read' ) : array( 'manage_options' );
1134
				break;
1135
		}
1136
		return $caps;
1137
	}