Skip to content

Commit c26827e

Browse files
committed
phpstan
1 parent 5bc1f8c commit c26827e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Controller/ViewerController.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,18 @@ protected function getDestinationUrl(Request $request): ?Url {
187187
protected function getViewerRender(MediaInterface $media, string $wopi_client_url, bool $can_write, ?Url $close_button_url): array {
188188
$config = $this->configFactory->get('collabora_online.settings');
189189

190-
if (!$config->get('cool.wopi_base')) {
190+
/** @var string|null $wopi_base */
191+
$wopi_base = $config->get('cool.wopi_base');
192+
if (!$wopi_base) {
191193
throw new CollaboraNotAvailableException('The Collabora Online connection is not configured.');
192194
}
193195

194196
// A trailing slash is optional in the configured URL.
195-
$wopi_base = rtrim($config->get('cool.wopi_base'), '/');
197+
$wopi_base = rtrim($wopi_base, '/');
196198
$wopi_url = $wopi_base . '/cool/wopi/files/' . $media->id();
197199
$editor_url = Url::fromUri($wopi_client_url);
198200
$editor_url->setOption('query', [
199-
...$editor_url->getOption('query') ?? [],
201+
...(array) ($editor_url->getOption('query') ?? []),
200202
'WOPISrc' => $wopi_url,
201203
...$close_button_url !== NULL ? ['closebutton' => 'true'] : [],
202204
]);

0 commit comments

Comments
 (0)