From c21221c516de3721ae739c3253aaafab1895e4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joris=20Dugu=C3=A9?= Date: Tue, 30 Jan 2024 07:46:56 +0100 Subject: [PATCH] fix(chore): resolve problem of typo and implement missing field into tab --- Core/H5PIntegration.php | 15 ++++++++------- Service/ResultService.php | 17 ++++++++--------- Twig/H5PExtension.php | 10 ++++------ 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Core/H5PIntegration.php b/Core/H5PIntegration.php index 47ba62e..8e66248 100644 --- a/Core/H5PIntegration.php +++ b/Core/H5PIntegration.php @@ -110,7 +110,8 @@ public function getGenericH5PIntegrationSettings() 'l10n' => ['H5P' => $this->core->getLocalization()], 'hubIsEnabled' => $hubIsEnabled, 'siteUrl' => $this->requestStack->getMainRequest()->getUri(), - 'librairyConfig' => $this->core->h5pF->getLibraryConfig() + 'libraryConfig' => $this->core->h5pF->getLibraryConfig(), + 'reportingIsEnabled' => $this->core->h5pF->getOption('enable_lrs_content_type', false) === 1 ]; if (is_object($user)) { $settings['user'] = [ @@ -126,10 +127,10 @@ public function getGenericH5PIntegrationSettings() /** * Get a list with prepared asset links that is used when JS loads components. * - * @param null|array $keys [$keys] Optional keys, first for JS second for CSS. + * @param array|null $keys [$keys] Optional keys, first for JS second for CSS. * @return array */ - public function getCoreAssets($keys = null): array + public function getCoreAssets(?array $keys = null): array { if (empty($keys)) { $keys = ['scripts', 'styles']; @@ -141,11 +142,11 @@ public function getCoreAssets($keys = null): array ]; // Add all core scripts foreach (\H5PCore::$scripts as $script) { - $assets[$keys[0]][] = "{$this->options->getH5PAssetPath()}/h5p-core/{$script}"; + $assets[$keys[0]][] = "{$this->options->getH5PAssetPath()}/h5p-core/$script"; } // and styles foreach (\H5PCore::$styles as $style) { - $assets[$keys[1]][] = "{$this->options->getH5PAssetPath()}/h5p-core/{$style}"; + $assets[$keys[1]][] = "{$this->options->getH5PAssetPath()}/h5p-core/$style"; } return $assets; } @@ -284,7 +285,7 @@ private function getAssets($collection, $prefix, $exceptions = null): array if ($exceptions && in_array($item, $exceptions)) { continue; } - $assets[] = "{$prefix}{$item}{$cacheBuster}"; + $assets[] = "$prefix$item$cacheBuster"; } return $assets; } @@ -297,7 +298,7 @@ private function getAssets($collection, $prefix, $exceptions = null): array public function getCacheBuster(): string { $cache_buster = \H5PCore::$coreApi['majorVersion'] . '.' . \H5PCore::$coreApi['minorVersion']; - return $cache_buster ? "?={$cache_buster}" : ''; + return $cache_buster ? "?=$cache_buster" : ''; } /** diff --git a/Service/ResultService.php b/Service/ResultService.php index 2e8950d..99207a4 100644 --- a/Service/ResultService.php +++ b/Service/ResultService.php @@ -57,15 +57,14 @@ public function handleRequestFinished(Request $request, $userId) */ public function removeData($contentId, $dataType, $user, $subContentId) { - $ContentUserData = $this->em->getRepository('Studit\H5PBundle\Entity\ContentUserData') - ->findBy( - [ - 'subContentId' => $subContentId, - 'mainContent' => $contentId, - 'dataId' => $dataType, - 'user' => $user->getId() - ] - ); + $ContentUserData = $this->em->getRepository('Studit\H5PBundle\Entity\ContentUserData')->findBy( + [ + 'subContentId' => $subContentId, + 'mainContent' => $contentId, + 'dataId' => $dataType, + 'user' => $user->getId() + ] + ); if (count($ContentUserData) > 0) { foreach ($ContentUserData as $content) { $this->em->remove($content); diff --git a/Twig/H5PExtension.php b/Twig/H5PExtension.php index 1a5ce67..2d9caac 100644 --- a/Twig/H5PExtension.php +++ b/Twig/H5PExtension.php @@ -21,14 +21,12 @@ public function __construct(H5PIntegration $h5pIntegration) $this->h5pIntegration = $h5pIntegration; } - public function getFilters() + public function getFilters(): array { - return array( - new TwigFilter('h5pCacheBuster', array($this, 'getH5PCacheBuster')), - ); + return [new TwigFilter('h5pCacheBuster', [$this, 'getH5PCacheBuster']),]; } - public function getH5PCacheBuster($script) + public function getH5PCacheBuster($script): string { return $script . $this->h5pIntegration->getCacheBuster(); } @@ -38,7 +36,7 @@ public function getH5PCacheBuster($script) * * @return string The extension name */ - public function getName() + public function getName(): string { return 'h5p_extension'; }