İlk temizlik tamamlandı bir önceki projeden
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\RegisterCreator\DocumentProcessors;
|
||||
|
||||
use Exception;
|
||||
|
||||
class DocumentProcessorFactory
|
||||
{
|
||||
/**
|
||||
* Create document processor instance based on type
|
||||
*/
|
||||
public static function make(string $type, ?array $document = null): AbstractDocumentProcessor
|
||||
{
|
||||
// Check if this is a dynamic document
|
||||
if ($type === 'dynamic' || ($document && isset($document['is_dynamic']) && $document['is_dynamic'])) {
|
||||
return new DynamicMappingProcessor();
|
||||
}
|
||||
|
||||
return match($type) {
|
||||
'qa' => new QaDocumentProcessor(),
|
||||
'wdb' => new WdbDocumentProcessor(),
|
||||
'wps_naks_technology' => new WpsNaksTechnologyProcessor(),
|
||||
'naks_consumables_certificate' => new NaksConsumablesCertificateProcessor(),
|
||||
'naks_consumables_inspection_test_report' => new NaksConsumablesInspectionProcessor(),
|
||||
'drawings' => new DrawingsProcessor(),
|
||||
'materials' => new MaterialsProcessor(),
|
||||
'incoming_control_materials' => new IncomingControlProcessor(),
|
||||
'template' => new TemplateProcessor(),
|
||||
'prikaz' => new PrikazProcessor(),
|
||||
'document-procedure' => new DocumentProcedureProcessor(),
|
||||
'dynamic' => new DynamicMappingProcessor(),
|
||||
default => new GenericDocumentProcessor(),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if processor exists for given type
|
||||
*/
|
||||
public static function exists(string $type): bool
|
||||
{
|
||||
try {
|
||||
self::make($type);
|
||||
return true;
|
||||
} catch (\Throwable $th) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user