Files
piratepoet/lib/API/API.php
Vlad 8b13889c7a Adds one entry point for both JSON and MP APIs
Removes endpoints folder and moves versions to the root
JSON API folder
2017-05-16 20:56:55 -04:00

18 lines
390 B
PHP

<?php
namespace MailPoet\API;
if(!defined('ABSPATH')) exit;
class API {
static function JSON() {
return new \MailPoet\API\JSON\API();
}
static function MP($version) {
$api_class = sprintf('%s\MP\%s\API', __NAMESPACE__, $version);
if(class_exists($api_class)) {
return new $api_class();
}
throw new \Exception(__('Invalid API version.', 'mailpoet'));
}
}