office = new ServerAddress($settings['office_server'] ?? ''); $this->origin = new ServerAddress($settings['origin_server'] ?? (count(array_unique($domains)) === 1 ? 'https://' . reset($domains) : '')); } catch (\InvalidArgumentException|\TypeError $error) { throw new HostException('Office viewing requires valid HTTPS server and application URLs.', 503); } // WOPI routes are mounted under /m/service_wopi, so the origin must be a bare HTTPS origin the route path can be appended to. if ($this->origin->url !== $this->origin->origin) { throw new HostException('The WOPI origin server URL must be an HTTPS origin without a path.', 503); } $this->lifetime = max(300, min(14400, (int) ($settings['token_lifetime'] ?? 3600))); $this->maxBytes = max(1, min(32 * 1024 * 1024, (int) ($settings['max_bytes'] ?? 16 * 1024 * 1024))); } }