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