Users::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace DummyPress\Views;
3
use DummyPress\Abstracts as Abs;
4
use DummyPress\Types as Type;
5
6
/**
7
 * Generate view for creating and deleting posts.
8
 *
9
 * @abstract
10
 * @package    WordPress
11
 * @subpackage Test Content
12
 * @author     Mike Selander
13
 */
14
class Users extends Abs\View {
15
16
	public function __construct() {
17
18
		$this->title	= __( 'Users', 'dummybot' );
19
		$this->type		= 'user';
20
		$this->priority	= 4;
21
22
	}
23
24
	/**
25
	 * Our sections action block - button to create and delete.
26
	 *
27
	 * @access protected
28
	 *
29
	 * @return string HTML content.
30
	 */
31
	protected function actions_section() {
32
		$html = '';
33
34
		$user_class = new Type\User;
35
		$roles = $user_class->get_roles();
36
37
		foreach ( $roles as $role ) :
38
39
			$html .= "<div class='test-data-cpt'>";
40
41
				$html .= "<h3>";
42
43
					$html .= "<span class='label'>" . esc_html( $role['name'] ) . "</span>";
44
					$html .= $this->build_button( 'create', $role['slug'], esc_html__( 'Create Users', 'dummybot' ) );
45
					$html .= $this->build_button( 'delete', $role['slug'], esc_html__( 'Delete Users', 'dummybot' ) );
46
47
				$html .= "</h3>";
48
49
			$html .= "</div>";
50
51
		endforeach;
52
53
		return $html;
54
	}
55
56
}
57