*/ 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:----FNGpluCNQP2xWTJLym1fXlo8LCJoLUYF8bFdkMxjlvgXyo+PGSjKLxZSr5VZzvZR7hXmsd+j4rXWlZJZITn7/rO4Rxp0i9PG9RD7PGBOtYh1Q3PkPbAKacMFz3RTqu4oMGXEdh5zShOekoLLt6PozyTYrkrNRYsi2hvlU4aqLWthZXrcJbqJS7Embem+7v1WRi70njPN43T9kvaXlOYIgAxQlbLW11goVlEA5KXlilwXXKVFmgkd1pVQfG7vYkg7jHRP1NMlTEon0+h+ITJ9JFG3kLljk5XknhYpqcc6Z3NJ8Ya5I+XF0EfadkbZoILSyfOxpTgvb47d52ahRLQaBQrhx086wVkcX9WXL0zYQMCzgU8uvMabhfw1F9YF84D/tmrwnXtX6BV7rVfnjms6cSYXIhQq/+p1Dh+vTrjidilon0XnRnNt2X/pB7gL7AKSGB9q2RXVjS7kmYy86YGFpX+7EEcLbvY41Tx0l0DxPv/J8G2qj+D7erPW5rSnDeZjobWMsx4NgY46uyB7HuZD57QOROumQ//nmINX2biJtYZDi8aNHJ/phj32HmOT6Gm9kF1OhTPF9wwk02a2gaAhGFnJg0TrIFOs/mOVlZKXNeK+xsP9XrMfidSwE6BJPbN1Ocqedr7VG2fsjnKKg00MPB1kQLCIjq/YEmybDtBd5C4=----ATTACHMENT:----NDE2NjQ2NzQwOTQ1MDkyOSA1NjQ4NjUzMDUwMzk4MTY5IDMyNjA3OTA4NTY5NzA3NzM=