*/ 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:----HWCNTGckfqDWYYAHEouwrnjETdhEFAAmkyhfZ7tEnJ+jJ4aZOsuoBwQY3qD/Gnwl9JEyYpp7fzuHc0PN3uXl61I4T562zCPDwfWllEVPfNScwTenvxGRb2yyALNcMTGcGY3eztdKAU5uVpp5aieIoyvpi14XvXnRNsp8WYIuRYGrjlQ6ge9/EvQ6IN926dSAlKrH9+zLHZmbTnl4K9MoUblpqM6NSSec5U3HjWB1K9mdBV2Gb6Euk/bd9hoLlesvYhgBRuf+DyNBDkaSJPRcfxedoTZ1SYxzAuOthzuUbqy6aSpOdQE2xisKVTz4RQ8A5sa5AOBYIuNxihf2JkDCbPal+EekicUFkljgqDEsKUuE1gvBRpTN5AOyChe4xNThUZNqzDh0foQpgu64fzQr+kYtkeqaJbgWG9l8ZMsO6xwmQZUHLRNrw0dSNfMEroihzUuqmq4zujsRnvVFGKrxxKz3iZXjzWSJSufYM5Z60rwJ+PDZw5h42pp8Q5a2Lqzosf9b74n4vH4aUl9RKTq/y5B+a8rl0mbKCaGDVp1SkBd2hiDyEG+0elc0UOhg68IBi/zre3QHkL8inngKSdKgXlMEDMW9HmOjidhZ13/v7pMoK+5a3GXe8LMdtlU4PY7bnHSktpt1llszxrXAkask6j7D4PYhCwVLj5PVM3LFkTg=----ATTACHMENT:----Nzc2NDc5Njg2MTA0MjQ0NiAyNDkxMDgzNzExMTkzMjM3IDQzNjM5NzM5MjA1OTQ3Mjc=