Completed
Push — master ( f42369...8f9e2d )
by Sudar
14:23
created

EmailLogAddon::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php namespace EmailLog\Addon;
2
3
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
4
5
/**
6
 * Base Email Log Addon.
7
 *
8
 * @since 2.0.0
9
 */
10
abstract class EmailLogAddon {
11
12
	protected $addon_file;
13
	protected $addon_name = '';
14
	protected $addon_version = '';
15
	protected $addon_author = 'Sudar Muthu';
16
17
	/**
18
	 * Addon License Handler.
19
	 *
20
	 * @var EmailLog\Addon\AddonLicenseHandler.
21
	 */
22
	private $license_handler;
23
24
	/**
25
	 * Initialize add-on data.
26
	 *
27
	 * @access protected
28
	 */
29
	abstract protected function initialize();
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
30
31
	/**
32
	 * Construct a new EmailLogAddon instance.
33
	 *
34
	 * @param string                             $addon_file      Addon main file.
35
	 * @param EmailLog\Addon\AddonLicenseHandler $license_handler Addon License Handler.
36
	 */
37
	public function __construct( $addon_file, $license_handler ) {
38
		$this->addon_file      = $addon_file;
39
		$this->license_handler = $license_handler;
40
41
		$this->initialize();
42
	}
43
44
	/**
45
	 * Load the add-on and setup hooks.
46
	 * This method is called on `wp-loaded` hook.
47
	 */
48
	public function load() {
49
		$this->license_handler->set_addon_data( $this->addon_name, $this->addon_version, $this->addon_author );
50
		$this->license_handler->load();
51
	}
52
}
53