GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — feature/gutenberg ( 17a9e6 )
by Brad
66:37
created

init.php ➔ my_block_cgb_block_assets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 23 and the first side effect is on line 13.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Blocks Initializer
4
 *
5
 * Enqueue CSS/JS of all the blocks.
6
 *
7
 * @since   1.0.0
8
 * @package CGB
9
 */
10
11
// Exit if accessed directly.
12
if ( ! defined( 'ABSPATH' ) ) {
13
	exit;
14
}
15
16
/**
17
 * Enqueue Gutenberg block assets for both frontend + backend.
18
 *
19
 * `wp-blocks`: includes block type registration and related functions.
20
 *
21
 * @since 1.0.0
22
 */
23
function my_block_cgb_block_assets() {
24
	// Styles.
25
	wp_enqueue_style( 'my_block-cgb-style-css',
26
		plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ),
27
		array( 'wp-blocks' )
28
	);
29
}
30
31
// Hook: Frontend assets.
32
add_action( 'enqueue_block_assets', 'my_block_cgb_block_assets' );
33
34
/**
35
 * Enqueue Gutenberg block assets for backend editor.
36
 *
37
 * `wp-blocks`: includes block type registration and related functions.
38
 * `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks.
39
 * `wp-i18n`: To internationalize the block's text.
40
 *
41
 * @since 1.0.0
42
 */
43
function my_block_cgb_editor_assets() {
44
	// Scripts.
45
	wp_enqueue_script(
46
		'my_block-cgb-block-js', // Handle.
47
		plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
48
		array( 'wp-blocks', 'wp-i18n', 'wp-element' ), // Dependencies, defined above.
49
		// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ), // Version: filemtime — Gets file modification time.
0 ignored issues
show
Unused Code Comprehensibility introduced by
39% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
50
		true // Enqueue the script in the footer.
51
	);
52
53
	// Styles.
54
	wp_enqueue_style(
55
		'my_block-cgb-block-editor-css', // Handle.
56
		plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
57
		array( 'wp-edit-blocks' ) // Dependency to include the CSS after it.
58
		// filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: filemtime — Gets file modification time.
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
59
	);
60
} // End function my_block_cgb_editor_assets().
61
62
// Hook: Editor assets.
63
add_action( 'enqueue_block_editor_assets', 'my_block_cgb_editor_assets' );
64