From 99b2c636108700fe6dd5c1b8ee0acc4e0f3abe1f Mon Sep 17 00:00:00 2001 From: jorisdugue Date: Sat, 2 Nov 2024 12:32:12 +0100 Subject: [PATCH] fix(chore): prevent deprecated of php --- Command/H5pBundleIncludeAssetsCommand.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Command/H5pBundleIncludeAssetsCommand.php b/Command/H5pBundleIncludeAssetsCommand.php index f743548..1535201 100644 --- a/Command/H5pBundleIncludeAssetsCommand.php +++ b/Command/H5pBundleIncludeAssetsCommand.php @@ -3,12 +3,9 @@ namespace Studit\H5PBundle\Command; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\Config\FileLocator; use Symfony\Component\HttpKernel\KernelInterface; class H5pBundleIncludeAssetsCommand extends Command @@ -26,7 +23,7 @@ public function __construct(KernelInterface $appKernel) parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->setDescription( @@ -39,16 +36,18 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output): int { $this->includeAssets($input->getOption('copy') ?? false); - return 0; + return Command::SUCCESS; } private function includeAssets(bool $copy): void { + $projectDir = $this->appKernel->getProjectDir(); + //get dir of vendor H5P + $fromDir = $projectDir . "/vendor/h5p/"; - $fromDir = $this->appKernel->getProjectDir() . "/vendor/h5p/"; //call service - $toDir = $this->appKernel->getProjectDir() . '/public/bundles/studith5p/h5p/'; + $toDir = $projectDir . '/public/bundles/studith5p/h5p/'; $coreSubDir = "h5p-core/"; $coreDirs = ["fonts", "images", "js", "styles"]; @@ -59,7 +58,7 @@ private function includeAssets(bool $copy): void $this->createFiles($fromDir, $toDir, $editorSubDir, $editorDirs, $copy); } - private function createFiles($fromDir, $toDir, $subDir, $subDirs, $copy) + private function createFiles(string $fromDir, string $toDir, string $subDir, array $subDirs, bool $copy): void { foreach ($subDirs as $dir) { $src = $fromDir . $subDir . $dir; @@ -71,7 +70,7 @@ private function createFiles($fromDir, $toDir, $subDir, $subDirs, $copy) } } - private function recurseCopy($src, $dst) + private function recurseCopy(string $src, string $dst): void { $dir = opendir($src); // Restrict the permission to 0750 not upper