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

Jetpack_Tiled_Gallery_Block::render()   F

Complexity

Conditions 19
Paths 3

Size

Total Lines 105

Duplication

Lines 32
Ratio 30.48 %

Importance

Changes 0
Metric Value
cc 19
nc 3
nop 2
dl 32
loc 105
rs 3.6133
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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