for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace AOE\Crawler\Hooks;
/*
* (c) 2020 AOE GmbH <[email protected]>
*
* This file is part of the TYPO3 Crawler Extension.
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
* The TYPO3 project - inspiring people to share!
*/
use AOE\Crawler\Api\CrawlerApi;
use AOE\Crawler\Domain\Repository\QueueRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extensionmanager\Utility\InstallUtility;
class DataHandlerHook
{
public function addFlushedPagesToCrawlerQueue(array $parameters, \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler): void
$dataHandler
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function addFlushedPagesToCrawlerQueue(array $parameters, /** @scrutinizer ignore-unused */ \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler): void
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$pageIdsToBeFlushedFromCache = $parameters['pageIdArray'];
if (empty($pageIdsToBeFlushedFromCache)) {
return;
}
foreach ($pageIdsToBeFlushedFromCache as $pageId) {
$pageId = (int) $pageId;
if ($pageId < 1) {
continue;
if ($this->getQueueRepository()->isPageInQueue($pageId)) {
$this->getCrawlerApi()->addPageToQueue($pageId);
private function getQueueRepository(): QueueRepository
return GeneralUtility::makeInstance(ObjectManager::class)->get(QueueRepository::class);
private function getCrawlerApi(): CrawlerApi
return GeneralUtility::makeInstance(ObjectManager::class)->get(CrawlerApi::class);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.