Completed
Pull Request — staging (#840)
by
unknown
19:06
created

PluginFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 2
A get_service_container() 0 13 1
1
<?php
2
/**
3
 * YIKES Inc. Easy Mailchimp Forms Plugin.
4
 *
5
 * @package   Yikes\EasyForms
6
 * @author    Freddie Mixell
7
 * @license   GPL2
8
 */
9
10
namespace YIKES\EasyForms;
11
12
// use YIKES\EasyForms\PluginHelper;
13
// use YIKES\EasyForms\Roles\Administrator;
14
// use YIKES\EasyForms\AdminPage\SettingsPage;
15
// use YIKES\EasyForms\Settings\SettingsManager;
16
17
/**
18
 * Class PluginFactory
19
 *
20
 * @since   %VERSION%
21
 *
22
 * @package Yikes\EasyForms
23
 * @author  Freddie Mixell
24
 */
25
final class PluginFactory {
26
27
	use PluginHelper;
28
29
	/**
30
	 * Create and return an instance of the plugin.
31
	 *
32
	 * This always returns a shared instance.
33
	 *
34
	 * @since %VERSION%
35
	 *
36
	 * @return Plugin The plugin instance.
37
	 */
38
	public function create() {
39
		static $plugin = null;
40
41
		if ( null === $plugin ) {
42
			$plugin = new Plugin( $this->get_service_container() );
43
		}
44
45
		return $plugin;
46
	}
47
48
	/**
49
	 * Get the service container for our class.
50
	 *
51
	 * @since %VERSION%
52
	 * @return Container
53
	 */
54
	private function get_service_container() {
55
56
		$services = new Container();
57
58
		// Settings & Settings Page
59
		// $services->add_service( SettingsPage::class );
60
		// $services->add_service( SettingsManager::class );
61
62
		// Roles
63
		// $services->add_service( Administrator::class );
64
65
		return $services;
66
	}
67
}