Completed
Push — master ( 9f3eac...f0c1b5 )
by David
02:49 queued 13s
created

Tasks_Page_Base::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 7
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Sets up the admin page for the plaats enhance features where the updater
5
 * process can be triggered.
6
 *
7
 * @link       https://wordlift.io
8
 * @since      1.0.0
9
 *
10
 * @package    Wordlift_Framework\Tasks\Admin
11
 */
12
13
namespace Wordlift\Tasks\Admin;
14
15
use Wordlift\Tasks\Task_Ajax_Adapters_Registry;
16
use Wordlift\Wordpress\Submenu_Page_Base;
17
use Wordlift\Wordpress\Page;
18
19
abstract class Tasks_Page_Base extends Submenu_Page_Base {
20
21
	/**
22
	 * The ID of this admin page.
23
	 *
24
	 * @since    1.0.0
25
	 * @access   private
26
	 * @var      string $menu_slug The ID of this page.
27
	 */
28
	private $menu_slug;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
29
30
	/**
31
	 * @var Task_Ajax_Adapters_Registry
32
	 */
33
	private $task_ajax_adapters_registry;
34
35
	/**
36
	 * @var string
37
	 */
38
	private $version;
39
40
	/**
41
	 * Define the {@link Wordlift_Admin_Page} constructor.
42
	 *
43
	 * @param Task_Ajax_Adapters_Registry $task_ajax_adapters_registry
44
	 *
45
	 * @param string $version
46
	 * @param string $menu_slug
47
	 * @param string $page_title
48
	 * @param string $capability
49
	 * @param string|null $parent_slug
50
	 * @param string|null $menu_title
51
	 *
52
	 * @since 1.0.0
53
	 */
54
	public function __construct( $task_ajax_adapters_registry, $version, $menu_slug, $page_title, $capability = 'manage_options', $parent_slug = null, $menu_title = null ) {
55
		parent::__construct( $menu_slug, $page_title, $capability, $parent_slug, $menu_title );
56
57
		$this->task_ajax_adapters_registry = $task_ajax_adapters_registry;
58
		$this->version                     = $version;
59
		$this->menu_slug                   = $menu_slug;
60
61
	}
62
63
	/**
64
	 * Register the stylesheets and scripts for the admin area.
65
	 *
66
	 * @since    1.0.0
67
	 */
68 View Code Duplication
	public function enqueue_scripts() {
0 ignored issues
show
Duplication introduced by
This method 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...
69
		wp_enqueue_style( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.css', array(), $this->version, 'all' );
70
		wp_enqueue_script( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.js', array(
71
			'jquery',
72
			'wp-util'
73
		), $this->version, true );
74
	}
75
76
	/**
77
	 * Render the page.
78
	 *
79
	 * @since 1.0.0
80
	 */
81
	public function render() {
82
83
		// Include the partial.
84
		include( plugin_dir_path( __FILE__ ) . 'assets/tasks-page.php' );
85
86
	}
87
88
}
89