@@ -71,13 +71,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7171 }
7272 if (!$ acquired ) {
7373 $ output ->writeln ('<info>Another webp:process-queue is running; exiting.</info> ' );
74+
7475 return Command::SUCCESS ;
7576 }
7677 try {
7778 $ folder = $ input ->getOption ('folder ' );
78- if (\is_string ($ folder ) && $ folder !== '' ) {
79+ if (\is_string ($ folder ) && '' !== $ folder ) {
7980 return $ this ->runFolderMode ($ folder , $ output );
8081 }
82+
8183 return $ this ->runQueueMode (\max (1 , (int ) $ input ->getOption ('batch ' )), $ output );
8284 } finally {
8385 $ locker ->release ();
@@ -96,7 +98,7 @@ private function runQueueMode(int $batch, OutputInterface $output): int
9698 $ originalFile = $ this ->resourceFactory ->getFileObject ($ entry ->originalFileId );
9799 $ configuration = (array ) \unserialize ($ entry ->configuration , ['allowed_classes ' => false ]);
98100 $ source = $ this ->resolveSource ($ entry ->processedFileId , $ originalFile );
99- if ($ source === null ) {
101+ if (null === $ source ) {
100102 continue ;
101103 }
102104 $ processedFileWebp = $ this ->processedFileRepository ->findOneByOriginalFileAndTaskTypeAndConfiguration (
@@ -131,14 +133,16 @@ private function runQueueMode(int $batch, OutputInterface $output): int
131133 $ this ->applyThrottle ($ throttleMs , $ index === $ lastIndex );
132134 }
133135 }
136+
134137 return Command::SUCCESS ;
135138 }
136139
137140 private function runFolderMode (string $ folder , OutputInterface $ output ): int
138141 {
139142 $ rootPath = $ this ->resolveAgainstWebRoot ($ folder );
140- if ($ rootPath === null ) {
143+ if (null === $ rootPath ) {
141144 $ output ->writeln (\sprintf ('<error>Folder "%s" not found or outside the public web root</error> ' , $ folder ));
145+
142146 return Command::FAILURE ;
143147 }
144148
@@ -155,6 +159,7 @@ private function runFolderMode(string $folder, OutputInterface $output): int
155159 }
156160 $ this ->applyThrottle ($ throttleMs , $ index === $ lastIndex );
157161 }
162+
158163 return Command::SUCCESS ;
159164 }
160165
@@ -163,7 +168,7 @@ private function resolveSource(int $processedFileId, $originalFile): ?\TYPO3\CMS
163168 if (!$ originalFile instanceof \TYPO3 \CMS \Core \Resource \FileInterface) {
164169 return null ;
165170 }
166- if ($ processedFileId === 0 ) {
171+ if (0 === $ processedFileId ) {
167172 return $ originalFile ;
168173 }
169174 try {
@@ -176,7 +181,7 @@ private function resolveSource(int $processedFileId, $originalFile): ?\TYPO3\CMS
176181 private function resolveAgainstWebRoot (string $ folder ): ?string
177182 {
178183 $ webRoot = \realpath (Environment::getPublicPath ());
179- if ($ webRoot === false ) {
184+ if (false === $ webRoot ) {
180185 return null ;
181186 }
182187 $ candidate = \realpath ($ webRoot . '/ ' . \ltrim ($ folder , '/ ' ));
0 commit comments