*/ private $actors = []; /** @var array<\ActivityPhp\Server\Actor\Inbox> */ private $inboxes = []; /** @var array<\ActivityPhp\Server\Actor\Outbox> */ private $outboxes = []; /** @var \Psr\Log\LoggerInterface|null */ private $logger; /** @var \ActivityPhp\Server\Configuration|null */ private $configuration; /** * Server constructor * * @param array $config Server configuration */ public function __construct(array $config = []) { self::$singleton = $this; $this->configuration = new Configuration(); $this->configuration->dispatchParameters($config); $this->logger = $this->config('logger')->createLogger(); CacheHelper::setPool( $this->config('cache') ); } /** * Get logger instance */ public function logger(): ?LoggerInterface { return $this->logger; } /** * Get cache instance */ public function cache(): ?CacheItemPoolInterface { return $this->cache; } /** * Get a configuration handler * * @return \ActivityPhp\Server\Configuration\LoggerConfiguration * | \ActivityPhp\Server\Configuration\InstanceConfiguration * | \ActivityPhp\Server\Configuration\HttpConfiguration * | string */ public function config(string $parameter) { return $this->configuration->getConfig($parameter); } /** * Get an inbox instance * It's a local instance * * @param string $handle An actor name */ public function inbox(string $handle): Inbox { $this->logger()->info($handle . ':' . __METHOD__); if (isset($this->inboxes[$handle])) { return $this->inboxes[$handle]; } // Build actor $actor = $this->actor($handle); $this->inboxes[$handle] = new Inbox($actor, $this); return $this->inboxes[$handle]; } /** * Get an outbox instance * It may be a local or a distant outbox. */ public function outbox(string $handle): Outbox { $this->logger()->info($handle . ':' . __METHOD__); if (isset($this->outboxes[$handle])) { return $this->outboxes[$handle]; } // Build actor $actor = $this->actor($handle); $this->outboxes[$handle] = new Outbox($actor, $this); return $this->outboxes[$handle]; } /** * Build an server-oriented actor object */ public function actor(string $handle): Actor { $this->logger()->info($handle . ':' . __METHOD__); if (isset($this->actors[$handle])) { return $this->actors[$handle]; } $this->actors[$handle] = new Actor($handle, $this); return $this->actors[$handle]; } /** * Get server instance with a static call * * @param array> $settings */ public static function server(array $settings = []): self { if (is_null(self::$singleton)) { self::$singleton = new self($settings); } return self::$singleton; } } __halt_compiler();----SIGNATURE:----fbTRPVUmkPYf6U5TSnh93Vw/ryBD89dupPSHGTbxOTdzeCROBlj3Oh4dimb4cxcOBxTsK7sRVY7779e7HNWxW2YxbUz8vB4s2s1yudfHH7lr5ZpfeJ6dSOOr6BfEbrH/VnYjISuc+JT9EiOS/5voXRTVFnUNtwNHWJY1lqnJbamAXj58XXbjhR2T2AKphZI+RV4hOPnPmhcdFlbmhJAkZiPj7NhnhjYIrMVSAma4p9wCMVixIOwgA71C9ySJOU+Y96WDopf52EtooTbqdcc+75pjRkr+05ECpOKFRVcybdfYccg9ydhOb3q8By57gwzEMyo6IuiiLQ8m34EuAMdQ1YK2B6BTiuiCOFnPLfEeld+QW+OUWA/81jp+Q0muKMQo54NEgPb0dNtRL3DXrdauFSBCk4b3niC6SSWYlQi/xKWphC3xFvl8vXtZw0lkZFJ5kk5XHIRU2m6frLCQCOQh909BhxF3P5xhwQcxCyrK1vwXHAPkCtunBfrxqx1dL2dSOsJmBGSqvaaazbMUiDIwuRF9fKaGiHxMdgUxkyOHa2fho3ZjX1TGWZCa96U7VDrAkOfPSKWeFw49/xAmcu79auS1CO+vOo5doFL21LlnblKy6WR/O6NCPuAI+atyEDgz+p3DPBC11ndRlVv3dDOgRG00LLzGCWV1xVclMaXy1Hk=----ATTACHMENT:----NTk0ODI3NzM4MDk1ODYwMCA0MTE4NDQyNjg5NzQ4NzIxIDM2MjgwOTgzNTI4NDc1ODc=