This commit is contained in:
emmymayo
2025-02-05 23:15:46 +01:00
commit 7269c99357
16995 changed files with 3389680 additions and 0 deletions
@@ -0,0 +1,28 @@
<?php declare(strict_types = 1);
namespace MailPoet\API\REST;
if (!defined('ABSPATH')) exit;
use MailPoet\InvalidStateException;
use MailPoetVendor\Psr\Container\ContainerInterface;
class EndpointContainer {
/** @var ContainerInterface */
private $container;
public function __construct(
ContainerInterface $container
) {
$this->container = $container;
}
public function get(string $class): Endpoint {
$endpoint = $this->container->get($class);
if (!$endpoint instanceof Endpoint) {
throw new InvalidStateException(sprintf("Class '%s' doesn't implement '%s'", $class, Endpoint::class));
}
return $endpoint;
}
}