Code Duplication    Length = 22-23 lines in 2 locations

src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1 location

@@ 1284-1305 (lines=22) @@
1281
			),
1282
		);
1283
1284
		if ( get_option( 'show_avatars' ) ) {
1285
			$avatar_properties = array();
1286
1287
			$avatar_sizes = rest_get_avatar_sizes();
1288
			foreach ( $avatar_sizes as $size ) {
1289
				$avatar_properties[ $size ] = array(
1290
					/* translators: %d: avatar image size in pixels */
1291
					'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),
1292
					'type'        => 'string',
1293
					'format'      => 'uri',
1294
					'context'     => array( 'embed', 'view', 'edit' ),
1295
				);
1296
			}
1297
1298
			$schema['properties']['author_avatar_urls'] = array(
1299
				'description'   => __( 'Avatar URLs for the object author.' ),
1300
				'type'          => 'object',
1301
				'context'       => array( 'view', 'edit', 'embed' ),
1302
				'readonly'      => true,
1303
				'properties'    => $avatar_properties,
1304
			);
1305
		}
1306
1307
		$schema['properties']['meta'] = $this->meta->get_field_schema();
1308

src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php 1 location

@@ 1273-1295 (lines=23) @@
1270
			),
1271
		);
1272
1273
		if ( get_option( 'show_avatars' ) ) {
1274
			$avatar_properties = array();
1275
1276
			$avatar_sizes = rest_get_avatar_sizes();
1277
1278
			foreach ( $avatar_sizes as $size ) {
1279
				$avatar_properties[ $size ] = array(
1280
					/* translators: %d: avatar image size in pixels */
1281
					'description' => sprintf( __( 'Avatar URL with image size of %d pixels.' ), $size ),
1282
					'type'        => 'string',
1283
					'format'      => 'uri',
1284
					'context'     => array( 'embed', 'view', 'edit' ),
1285
				);
1286
			}
1287
1288
			$schema['properties']['avatar_urls']  = array(
1289
				'description' => __( 'Avatar URLs for the user.' ),
1290
				'type'        => 'object',
1291
				'context'     => array( 'embed', 'view', 'edit' ),
1292
				'readonly'    => true,
1293
				'properties'  => $avatar_properties,
1294
			);
1295
		}
1296
1297
		$schema['properties']['meta'] = $this->meta->get_field_schema();
1298