Replace symfony container types by PSR interface
[PREMIUM-99]
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace MailPoet\API;
|
namespace MailPoet\API;
|
||||||
|
|
||||||
use MailPoetVendor\Symfony\Component\DependencyInjection\Container;
|
use MailPoetVendor\Psr\Container\ContainerInterface;
|
||||||
use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||||
use MailPoet\DI\ContainerFactory;
|
use MailPoet\DI\ContainerFactory;
|
||||||
|
|
||||||
@ -10,10 +10,10 @@ if(!defined('ABSPATH')) exit;
|
|||||||
|
|
||||||
class API {
|
class API {
|
||||||
|
|
||||||
/** @var Container */
|
/** @var ContainerInterface */
|
||||||
private static $container;
|
private static $container;
|
||||||
|
|
||||||
static function injectContainer(Container $container) {
|
static function injectContainer(ContainerInterface $container) {
|
||||||
self::$container = $container;
|
self::$container = $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
namespace MailPoet\API\JSON;
|
namespace MailPoet\API\JSON;
|
||||||
|
|
||||||
use MailPoet\Config\AccessControl;
|
use MailPoet\Config\AccessControl;
|
||||||
use MailPoetVendor\Symfony\Component\DependencyInjection\Container;
|
use MailPoetVendor\Psr\Container\ContainerInterface;
|
||||||
use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||||
use MailPoet\Models\Setting;
|
use MailPoet\Models\Setting;
|
||||||
use MailPoet\Util\Helpers;
|
use MailPoet\Util\Helpers;
|
||||||
@ -22,7 +22,7 @@ class API {
|
|||||||
private $_available_api_versions = array(
|
private $_available_api_versions = array(
|
||||||
'v1'
|
'v1'
|
||||||
);
|
);
|
||||||
/** @var Container */
|
/** @var ContainerInterface */
|
||||||
private $container;
|
private $container;
|
||||||
|
|
||||||
/** @var AccessControl */
|
/** @var AccessControl */
|
||||||
@ -30,7 +30,7 @@ class API {
|
|||||||
|
|
||||||
const CURRENT_VERSION = 'v1';
|
const CURRENT_VERSION = 'v1';
|
||||||
|
|
||||||
function __construct(Container $container, AccessControl $access_control) {
|
function __construct(ContainerInterface $container, AccessControl $access_control) {
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
$this->access_control = $access_control;
|
$this->access_control = $access_control;
|
||||||
foreach($this->_available_api_versions as $available_api_version) {
|
foreach($this->_available_api_versions as $available_api_version) {
|
||||||
|
@ -4,7 +4,6 @@ namespace MailPoet\Config;
|
|||||||
|
|
||||||
use MailPoet\API;
|
use MailPoet\API;
|
||||||
use MailPoet\Cron\CronTrigger;
|
use MailPoet\Cron\CronTrigger;
|
||||||
use MailPoetVendor\Symfony\Component\DependencyInjection\Container;
|
|
||||||
use MailPoet\DI\ContainerFactory;
|
use MailPoet\DI\ContainerFactory;
|
||||||
use MailPoet\Models\Setting;
|
use MailPoet\Models\Setting;
|
||||||
use MailPoet\Router;
|
use MailPoet\Router;
|
||||||
@ -12,6 +11,7 @@ use MailPoet\Util\ConflictResolver;
|
|||||||
use MailPoet\Util\Helpers;
|
use MailPoet\Util\Helpers;
|
||||||
use MailPoet\Util\Notices\PermanentNotices;
|
use MailPoet\Util\Notices\PermanentNotices;
|
||||||
use MailPoet\WP\Notice as WPNotice;
|
use MailPoet\WP\Notice as WPNotice;
|
||||||
|
use MailPoetVendor\Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
if(!defined('ABSPATH')) exit;
|
if(!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
|||||||
class Initializer {
|
class Initializer {
|
||||||
private $access_control;
|
private $access_control;
|
||||||
private $renderer;
|
private $renderer;
|
||||||
/** @var Container */
|
/** @var ContainerInterface */
|
||||||
private $container;
|
private $container;
|
||||||
|
|
||||||
const INITIALIZED = 'MAILPOET_INITIALIZED';
|
const INITIALIZED = 'MAILPOET_INITIALIZED';
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace MailPoet\Router;
|
namespace MailPoet\Router;
|
||||||
|
|
||||||
use MailPoet\Config\AccessControl;
|
use MailPoet\Config\AccessControl;
|
||||||
use MailPoetVendor\Symfony\Component\DependencyInjection\Container;
|
use MailPoetVendor\Psr\Container\ContainerInterface;
|
||||||
use MailPoet\Util\Helpers;
|
use MailPoet\Util\Helpers;
|
||||||
|
|
||||||
if(!defined('ABSPATH')) exit;
|
if(!defined('ABSPATH')) exit;
|
||||||
@ -13,13 +13,13 @@ class Router {
|
|||||||
public $endpoint;
|
public $endpoint;
|
||||||
public $action;
|
public $action;
|
||||||
public $data;
|
public $data;
|
||||||
/** @var Container */
|
/** @var ContainerInterface */
|
||||||
private $container;
|
private $container;
|
||||||
const NAME = 'mailpoet_router';
|
const NAME = 'mailpoet_router';
|
||||||
const RESPONSE_ERROR = 404;
|
const RESPONSE_ERROR = 404;
|
||||||
const RESPONE_FORBIDDEN = 403;
|
const RESPONE_FORBIDDEN = 403;
|
||||||
|
|
||||||
function __construct(AccessControl $access_control, Container $container, $api_data = false) {
|
function __construct(AccessControl $access_control, ContainerInterface $container, $api_data = false) {
|
||||||
$api_data = ($api_data) ? $api_data : $_GET;
|
$api_data = ($api_data) ? $api_data : $_GET;
|
||||||
$this->api_request = isset($api_data[self::NAME]);
|
$this->api_request = isset($api_data[self::NAME]);
|
||||||
$this->endpoint = isset($api_data['endpoint']) ?
|
$this->endpoint = isset($api_data['endpoint']) ?
|
||||||
|
Reference in New Issue
Block a user