chore: complete update
This commit is contained in:
31
.archive/Async1/DiscoveryFactory.php
Normal file
31
.archive/Async1/DiscoveryFactory.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Archive\Async1;
|
||||
|
||||
use App\Framework\Async1\AsyncDiscovery;
|
||||
use App\Framework\Async1\PcntlTaskProcessor;
|
||||
use App\Framework\Async1\TaskProcessorFactory;
|
||||
use App\Framework\Core\AttributeMapper;
|
||||
use App\Framework\Core\Discovery;
|
||||
|
||||
final class DiscoveryFactory
|
||||
{
|
||||
/**
|
||||
* Erstellt eine Discovery-Instanz mit optionaler asynchroner Verarbeitung
|
||||
*
|
||||
* @param bool $useAsync Ob asynchrone Verarbeitung genutzt werden soll
|
||||
* @param string|null $srcDir Quellverzeichnis für automatisches Auffinden von Mappern
|
||||
* @param AttributeMapper ...$mappers AttributeMapper-Instanzen
|
||||
* @return Discovery
|
||||
*/
|
||||
public static function create(bool $useAsync = true, ?string $srcDir = null, AttributeMapper ...$mappers): Discovery
|
||||
{
|
||||
if ($useAsync && PcntlTaskProcessor::isAvailable()) {
|
||||
return new AsyncDiscovery($srcDir, TaskProcessorFactory::create(), ...$mappers);
|
||||
}
|
||||
|
||||
return new Discovery($srcDir, ...$mappers);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user