PluginProbe
MailPoet – Newsletters, Email Marketing, and Automation / 3.41.0
MailPoet – Newsletters, Email Marketing, and Automation v3.41.0
5.38.0 5.37.0 5.36.1 5.36.0 5.35.1 5.35.0 5.34.3 5.34.2 5.34.1 5.34.0 5.33.1 5.33.0 5.32.0 5.31.0 5.30.0 5.29.0 5.28.1 5.28.0 5.27.0 5.26.0 5.26.1 5.25.0 5.24.0 4.43.0 4.43.1 All 542 releases
mailpoet / lib / API / API.php

API.php in MailPoet – Newsletters, Email Marketing, and Automation 3.41.0, at lib/API/API.php

27 lines 604 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MailPoet\API;
4
5 if (!defined('ABSPATH')) exit;
6
7
8 use MailPoet\DI\ContainerWrapper;
9 use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
10
11 class API {
12
13 /**
14 * @param string $version
15 * @return \MailPoet\API\MP\v1\API
16 * @throws \Exception
17 */
18 static function MP($version) {
19 $api_class = sprintf('%s\MP\%s\API', __NAMESPACE__, $version);
20 try {
21 return ContainerWrapper::getInstance()->get($api_class);
22 } catch (ServiceNotFoundException $e) {
23 throw new \Exception(__('Invalid API version.', 'mailpoet'));
24 }
25 }
26 }
27