PluginProbe
Premmerce / 1.3.12
Premmerce v1.3.12
trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.19 1.3.2 1.3.20 1.3.21 1.3.22 1.3.23 1.3.3 1.3.4 1.3.5 1.3.6 All 28 releases
premmerce / src / Container.php

Container.php in Premmerce 1.3.12, at src/Container.php

148 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Premmerce\Premmerce;
4
5 use Premmerce\Premmerce\Addons\AddonsManager ;
6 use Premmerce\Premmerce\Admin\Handlers\PluginsHandler ;
7 use Premmerce\Premmerce\Admin\Handlers\PremiumHandler ;
8 use Premmerce\Premmerce\Admin\Handlers\ToolbarHandler ;
9 use Premmerce\Premmerce\Admin\Handlers\WizardHandler ;
10 use Premmerce\Premmerce\Api\PluginApi ;
11 use Premmerce\Premmerce\Api\WizardApi ;
12 use Premmerce\SDK\V2\FileManager\FileManager ;
13 use Premmerce\SDK\V2\Notifications\AdminNotifier ;
14 /**
15 * Class Container
16 *
17 * This class responsive for instantiation on plugin classes
18 *
19 * @package Premmerce\Premmerce
20 */
21 class Container
22 {
23 /**
24 * @var FileManager
25 */
26 private $fileManager ;
27 /**
28 * @var PluginApi
29 */
30 private $pluginsApi ;
31 /**
32 * @var WizardApi
33 */
34 private $wizardApi ;
35 /**
36 * @var PluginsHandler
37 */
38 private $pluginsHandler ;
39 /**
40 * @var ToolbarHandler
41 */
42 private $toolbarHandler ;
43 /**
44 * @var WizardHandler
45 */
46 private $wizardHandler ;
47 /**
48 * @var PremiumHandler
49 */
50 private $premiumHandler ;
51 /**
52 * @var AdminNotifier
53 */
54 private $notifier ;
55 private $addonsManager ;
56 /**
57 * Container constructor.
58 *
59 * @param FileManager $fileManager
60 */
61 public function __construct( FileManager $fileManager )
62 {
63 $this->fileManager = $fileManager;
64 }
65
66 public function getAddonsManager()
67 {
68 if ( is_null( $this->addonsManager ) ) {
69 $this->addonsManager = new AddonsManager( $this->fileManager );
70 }
71 return $this->addonsManager;
72 }
73
74 /**
75 * @return PluginApi
76 */
77 public function getPluginsApi()
78 {
79 if ( is_null( $this->pluginsApi ) ) {
80 $this->pluginsApi = new PluginApi( $this->getFileManager() );
81 }
82 return $this->pluginsApi;
83 }
84
85 /**
86 * @return WizardApi
87 */
88 public function getWizardApi()
89 {
90 if ( is_null( $this->wizardApi ) ) {
91 $this->wizardApi = new WizardApi( $this->getPluginsApi() );
92 }
93 return $this->wizardApi;
94 }
95
96 /**
97 * @return PluginsHandler
98 */
99 public function getPluginsHandler()
100 {
101 if ( is_null( $this->pluginsHandler ) ) {
102 $this->pluginsHandler = new PluginsHandler( $this->getPluginsApi(), $this->getFileManager() );
103 }
104 return $this->pluginsHandler;
105 }
106
107 /**
108 * @return WizardHandler
109 */
110 public function getWizardHandler()
111 {
112 if ( is_null( $this->wizardHandler ) ) {
113 $this->wizardHandler = new WizardHandler( $this->getWizardApi(), $this->getFileManager() );
114 }
115 return $this->wizardHandler;
116 }
117
118 /**
119 * @return ToolbarHandler
120 */
121 public function getToolbarHandler()
122 {
123 if ( is_null( $this->toolbarHandler ) ) {
124 $this->toolbarHandler = new ToolbarHandler( $this->getPluginsApi(), $this->getWizardApi() );
125 }
126 return $this->toolbarHandler;
127 }
128
129 /**
130 * @return AdminNotifier
131 */
132 public function getNotifier()
133 {
134 if ( is_null( $this->notifier ) ) {
135 $this->notifier = new AdminNotifier();
136 }
137 return $this->notifier;
138 }
139
140 /**
141 * @return FileManager
142 */
143 public function getFileManager()
144 {
145 return $this->fileManager;
146 }
147
148 }