Refactor JSON API to use container for creating endpoints

[MAILPOET-1637]
This commit is contained in:
Rostislav Wolny
2018-11-14 21:23:32 +01:00
parent a42787d10d
commit d49b2a72a9
7 changed files with 57 additions and 21 deletions

View File

@@ -2,7 +2,6 @@
namespace MailPoet\API;
use MailPoet\Config\AccessControl;
use MailPoet\Dependencies\Symfony\Component\DependencyInjection\Container;
use MailPoet\Dependencies\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
@@ -17,8 +16,9 @@ class API {
self::$container = $container;
}
static function JSON(AccessControl $access_control) {
return new \MailPoet\API\JSON\API($access_control);
static function JSON() {
self::checkContainer();
return self::$container->get(JSON\API::class);
}
static function MP($version) {