Code Duplication    Length = 22-23 lines in 2 locations

classes/stencil/hierarchy/author.php 1 location

@@ 11-33 (lines=23) @@
8
/**
9
 * Class Stencil_Hierarchy_Author
10
 */
11
class Stencil_Hierarchy_Author extends Stencil_Abstract_Hierarchy {
12
	/**
13
	 * Stencil_Hierarchy_Author constructor.
14
	 */
15
	public function __construct() {
16
		$options = array();
17
18
		$author = get_queried_object();
19
20
		if ( is_a( $author, 'WP_User' ) ) {
21
			$options[] = 'single/author' . $author->user_nicename;
22
			$options[] = 'author-' . $author->user_nicename;
23
24
			$options[] = 'single/author' . $author->ID;
25
			$options[] = 'author-' . $author->ID;
26
		}
27
28
		$options[] = 'archive/author';
29
		$options[] = 'author';
30
31
		$this->set_options( $options );
32
	}
33
}
34

classes/stencil/hierarchy/category.php 1 location

@@ 11-32 (lines=22) @@
8
/**
9
 * Class Stencil_Hierarchy_Category
10
 */
11
class Stencil_Hierarchy_Category extends Stencil_Abstract_Hierarchy {
12
	/**
13
	 * Stencil_Hierarchy_Category constructor.
14
	 */
15
	public function __construct() {
16
		$category = get_queried_object();
17
18
		$options = array();
19
20
		if ( ! empty( $category->slug ) ) {
21
			$options[] = 'archive/category-' . $category->slug;
22
			$options[] = 'category-' . $category->slug;
23
24
			$options[] = 'archive/category-' . $category->term_id;
25
			$options[] = 'category-' . $category->term_id;
26
		}
27
		$options[] = 'archive/category';
28
		$options[] = 'category';
29
30
		$this->set_options( $options );
31
	}
32
}
33