Fix review remarks

This commit is contained in:
2022-02-10 17:48:59 +01:00
parent e7a6742964
commit 5a692db30f
5 changed files with 27 additions and 22 deletions

View File

@@ -36,18 +36,18 @@ class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
]);
}
public function isEditable(Environment $environment, StoredObject $document): bool
public function isEditable(StoredObject $document): bool
{
$mime_type = $this->discovery->discoverMimeType($document->getType());
if (empty($mime_type)) {
if ([] === $mime_type) {
return false;
}
if (array_key_exists('default', $mime_type[0])
&& $mime_type[0]['default'] === 'true'
) {
return true;
foreach ($mime_type as $item) {
if (array_key_exists('default', $item) && $item['default'] === 'true') {
return true;
}
}
return false;