Completed
Push — add/site-audit-simple-checksum ( ed3509...ac1d2f )
by
unknown
67:20 queued 60:20
created

Jetpack_Tiled_Gallery_Block   A

Complexity

Total Complexity 23

Size/Duplication

Total Lines 149
Duplicated Lines 21.48 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 32
loc 149
rs 10
c 0
b 0
f 0
wmc 23
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A tiled-gallery.php ➔ jetpack_tiled_gallery_load_block_assets() 0 14 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * Tiled Gallery block. Depends on the Photon module.
4
 *
5
 * @since 6.9.0
6
 *
7
 * @package Jetpack
8
 */
9
10
if (
11
	( defined( 'IS_WPCOM' ) && IS_WPCOM ) ||
12
	class_exists( 'Jetpack_Photon' ) && Jetpack::is_module_active( 'photon' )
13
) {
14
	jetpack_register_block(
15
		'jetpack/tiled-gallery',
16
		array(
17
			'render_callback' => 'jetpack_tiled_gallery_load_block_assets',
18
		)
19
	);
20
21
	/**
22
	 * Tiled gallery block registration/dependency declaration.
23
	 *
24
	 * @param array  $attr    Array containing the block attributes.
25
	 * @param string $content String containing the block content.
26
	 *
27
	 * @return string
28
	 */
29
	function jetpack_tiled_gallery_load_block_assets( $attr, $content ) {
30
		Jetpack_Gutenberg::load_assets_as_required( 'tiled-gallery' );
31
32
		/**
33
		 * Filter the output of the Tiled Galleries content.
34
		 *
35
		 * @module tiled-gallery
36
		 *
37
		 * @since 6.9.0
38
		 *
39
		 * @param string $content Tiled Gallery block content.
40
		 */
41
		return apply_filters( 'jetpack_tiled_galleries_block_content', $content );
42
	}
43
}
44