for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* TruncateTable.php
*/
namespace HDNET\Importr\Feature;
use HDNET\Importr\Processor\Configuration;
use HDNET\Importr\Service\DatabaseService;
* Class TruncateTable
class TruncateTable
{
* @var DatabaseService
protected $databaseService;
* TruncateTable constructor.
*
* @param DatabaseService $databaseService
public function __construct(DatabaseService $databaseService)
$this->databaseService = $databaseService;
}
public static function enable()
FeatureRegistry::enable('preParseConfiguration', Configuration::class);
* To truncate a table from the importr you
* have to use the "truncate: " configuration.
* If you pass a string, then the string is
* interpreted as a table name. If you pass
* an array, every element is used as a table
* name.
* @param Configuration $processor
* @param array $configuration
public function execute(Configuration $processor, array $configuration)
$processor
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
if (isset($configuration['truncate'])) {
if (\is_array($configuration['truncate'])) {
foreach ($configuration['truncate'] as $table) {
$this->databaseService->getDatabaseConnection()
->exec_TRUNCATEquery($table);
} else {
->exec_TRUNCATEquery($configuration['truncate']);
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.