Files
piratepoet/lib/API/API.php
Jan Jakeš 01a0fe96c4 Remove no longer necessary checks
[MAILPOET-1948]
2019-09-12 13:59:32 +02:00

24 lines
571 B
PHP

<?php
namespace MailPoet\API;
use MailPoet\DI\ContainerWrapper;
use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
class API {
/**
* @param string $version
* @return \MailPoet\API\MP\v1\API
* @throws \Exception
*/
static function MP($version) {
$api_class = sprintf('%s\MP\%s\API', __NAMESPACE__, $version);
try {
return ContainerWrapper::getInstance()->get($api_class);
} catch (ServiceNotFoundException $e) {
throw new \Exception(__('Invalid API version.', 'mailpoet'));
}
}
}