diff --git a/src/Controller/WopiController.php b/src/Controller/WopiController.php index 103316c8..4fc5f0cc 100644 --- a/src/Controller/WopiController.php +++ b/src/Controller/WopiController.php @@ -51,7 +51,7 @@ public static function permissionDenied(): Response { * @return \Symfony\Component\HttpFoundation\Response * The response with file contents. */ - public function wopiCheckFileInfo(string $id, Request $request) { + function wopiCheckFileInfo(string $id, Request $request) { $token = $request->query->get('access_token'); $jwt_payload = CoolUtils::verifyTokenForId($token, $id); @@ -119,7 +119,7 @@ public function wopiCheckFileInfo(string $id, Request $request) { * @return \Symfony\Component\HttpFoundation\Response * The response with file contents. */ - public function wopiGetFile(string $id, Request $request) { + function wopiGetFile(string $id, Request $request) { $token = $request->query->get('access_token'); $jwt_payload = CoolUtils::verifyTokenForId($token, $id); @@ -144,7 +144,7 @@ public function wopiGetFile(string $id, Request $request) { } /** - * Handles the wopi "save" request for a media entity. + * Handles the wopi "save" request for a media entity.. * * @param string $id * Media id from url. @@ -154,7 +154,7 @@ public function wopiGetFile(string $id, Request $request) { * @return \Symfony\Component\HttpFoundation\Response * The response. */ - public function wopiPutFile(string $id, Request $request) { + function wopiPutFile(string $id, Request $request) { $token = $request->query->get('access_token'); $timestamp = $request->headers->get('x-cool-wopi-timestamp'); $modified_by_user = $request->headers->get('x-cool-wopi-ismodifiedbyuser') == 'true'; diff --git a/src/Cool/CoolRequest.php b/src/Cool/CoolRequest.php index 631457aa..71c24084 100644 --- a/src/Cool/CoolRequest.php +++ b/src/Cool/CoolRequest.php @@ -32,8 +32,8 @@ function getDiscovery($server) { $stream_context = stream_context_create([ 'ssl' => [ - 'verify_peer' => !$disable_checks, - 'verify_peer_name' => !$disable_checks, + 'verify_peer' => !$disable_checks, + 'verify_peer_name' => !$disable_checks, ], ]); $res = file_get_contents($discovery_url, FALSE, $stream_context); diff --git a/src/Cool/CoolUtils.php b/src/Cool/CoolUtils.php index f8c4b8e3..5c212336 100644 --- a/src/Cool/CoolUtils.php +++ b/src/Cool/CoolUtils.php @@ -73,7 +73,7 @@ public static function setMediaSource(Media $media, File $source) { * @return string * The key value. */ - public static function getKey() { + static function getKey() { $default_config = \Drupal::config('collabora_online.settings'); $key_id = $default_config->get('cool')['key_id']; @@ -110,8 +110,7 @@ public static function verifyTokenForId( if ($payload && ($payload->fid == $id) && ($payload->exp >= gettimeofday(TRUE))) { return $payload; } - } - catch (\Exception $e) { + } catch (\Exception $e) { \Drupal::logger('cool')->error($e->getMessage()); } return NULL; @@ -218,11 +217,10 @@ public static function getDocumentType(File $file) { * @return \Drupal\Core\Url * Editor url to visit as full-page, or to embed in an iframe. */ - public static function getEditorUrl(Media $media, $can_write = FALSE) { + public static function getEditorUrl(Media $media, $can_write = false) { if ($can_write) { return Url::fromRoute('collabora-online.edit', ['media' => $media->id()]); - } - else { + } else { return Url::fromRoute('collabora-online.view', ['media' => $media->id()]); } }