*/ 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:----vEm0SkYj7yAIivh2ubc2oWtA+sbFBPmkbXjhBwyp66zxyUIC3WW6kqe6jzL6ZBtvELeBQ6G7XQy59tNpUZjA+eywq9B90yGKLuedWY9j93pvDm32cjfk18YVxuML7kZwa4NXGDMLhINFn249hqqG3a0wzCL80lI9U+vc6j9AJy3Ihe7foyKjcGElJtm3JSj5fxbuar71XhzJUIlY0SBTKUp+BcN75X3tlsa+GXkw87VMGSY0OerkxipRXdwyE4HCC7RF0FAq/KrmhOPaXNVLru+Bx0GQ7Ny27hE4MqdqK+LwAiTuejUCgVQVpSq0gk5jtur6GAzLWu+1WuEjK2JSTjLgpolso2PMlyUgT5uDX5ZGhGpNFpYR3BHQwfWtxcYr2+63CyY5vHxBlw5zMFIIFT3l7CZwQDPAR+8f4CbFonc7Ub9t0fuQ5G4KG4phQwgT4ycYavXhyvQ4ttBBeZuXFuKcACNjeVZZwdrdtPYPRQW5mo4cWl+rIsO5MW3TcTTJke8D8e7It4dLgKBNIRoqGrndQVYiAVuXK94mwt37gkd5GFIQsvADFPBaSRT7epafexBW0FS341m9F9Y2OsrCgLNI8U1N4+c4rfJe25Q5opEfPLrDOK/nCm7qnB5Rk7XNz/AlSRnhkAUi3+Ds4rBKOr7bhKPkjZFbLXBw5nSKTMI=----ATTACHMENT:----MTAxODM2NjY1Mjg5NjA3NiA3NTA0NzAzNzE3NTg3MTM4IDM1OTc3OTc0NzA1OTY5OTg=