Completed
Pull Request — master (#133)
by Sébastien
01:53
created

ALNP_Storefront   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 30
loc 30
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 4 4 1
A add_theme_support() 8 8 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
 * Auto Load Next Post Theme Support: Storefront
4
 *
5
 * Applies support for WooCommerce Storefront Theme.
6
 *
7
 * @since    1.5.0
8
 * @author   Sébastien Dumont
9
 * @category Theme Support
10
 * @package  Auto Load Next Post/Theme Support
11
 * @license  GPL-2.0+
12
 */
13
14
// Exit if accessed directly.
15
if ( ! defined( 'ABSPATH' ) ) {
16
	exit;
17
}
18
19
/**
20
 * ALNP_Storefront class.
21
 */
22 View Code Duplication
class ALNP_Storefront {
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
24
	/**
25
	 * Initlize Theme.
26
	 *
27
	 * @access public
28
	 * @static
29
	 */
30
	public static function init() {
31
		// Add theme support and preset the theme selectors.
32
		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
33
	} // END init()
34
35
	/**
36
	 * Add theme support by providing the theme selectors
37
	 * to be applied once the theme is activated.
38
	 *
39
	 * @access public
40
	 * @static
41
	 */
42
	public static function add_theme_support() {
43
		add_theme_support( 'auto-load-next-post', array(
44
			'content_container'    => 'main.site-main',
45
			'title_selector'       => 'h1.entry-title',
46
			'navigation_container' => 'nav.post-navigation',
47
			'comments_container'   => 'section#comments',
48
		) );
49
	} // END add_theme_support()
50
51
} // END class
52
53
ALNP_Storefront::init();
54