forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExporterMap.php
More file actions
47 lines (40 loc) · 2.34 KB
/
ExporterMap.php
File metadata and controls
47 lines (40 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace ProcessMaker\Enums;
use ProcessMaker\Models\ProcessMakerModel;
enum ExporterMap
{
const TYPES = [
'screen' => [\ProcessMaker\Models\Screen::class, \ProcessMaker\ImportExport\Exporters\ScreenExporter::class],
'process' => [\ProcessMaker\Models\Process::class, \ProcessMaker\ImportExport\Exporters\ProcessExporter::class],
'script' => [\ProcessMaker\Models\Script::class, \ProcessMaker\ImportExport\Exporters\ScriptExporter::class],
'process_templates' => [\ProcessMaker\Models\ProcessTemplates::class, \ProcessMaker\ImportExport\Exporters\TemplateExporter::class],
'data_source' => [\ProcessMaker\Packages\Connectors\DataSources\Models\DataSource::class, \ProcessMaker\Packages\Connectors\DataSources\ImportExport\DataSourceExporter::class],
'decision_table' => [\ProcessMaker\Package\PackageDecisionEngine\Models\DecisionTable::class, \ProcessMaker\Package\PackageDecisionEngine\ImportExport\DecisionTableExporter::class],
'collection' => [\ProcessMaker\Plugins\Collections\Models\Collection::class, \ProcessMaker\Plugins\Collections\ImportExport\CollectionExporter::class],
'flow_genie' => [
\ProcessMaker\Package\PackageAi\Models\FlowGenie::class,
\ProcessMaker\Package\PackageAi\ImportExport\FlowGenieExporter::class,
],
'screen-template' => [
\ProcessMaker\Models\ScreenTemplates::class,
\ProcessMaker\ImportExport\Exporters\ScreenTemplatesExporter::class,
],
'screen_translation' => [\ProcessMaker\Package\Translations\Models\Translatable::class, \ProcessMaker\Package\Translations\ImportExport\TranslatableExporter::class],
'pm_block' => [\ProcessMaker\Package\PackagePmBlocks\Models\PmBlock::class, \ProcessMaker\Package\PackagePmBlocks\ImportExport\PmBlockExporter::class],
];
public static function getModelClass(string $type): ?string
{
return self::TYPES[$type][0] ?? null;
}
public static function getExporterClass(string $type): ?string
{
return self::TYPES[$type][1] ?? null;
}
public static function getExporterClassForModel(ProcessMakerModel $model): string | null
{
$class = get_class($model);
return collect(self::TYPES)->first(function ($type) use ($class) {
return $type[0] == $class;
})[1] ?? null;
}
}