Skip to content

Commit 01dc954

Browse files
committed
Migrated parsers etc. to new export-data library version. Extracted mapping to mapper classes, using the mapper-manager.
1 parent 8ce2116 commit 01dc954

30 files changed

+664
-268
lines changed

bin/cli.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
chdir(dirname(__DIR__));
1818
require(__DIR__ . '/../vendor/autoload.php');
1919

20-
(function () {
20+
(function (): void {
2121
/* @var ContainerInterface $container */
2222
$container = require(__DIR__ . '/../config/container.php');
2323
$config = $container->get('config');
@@ -26,5 +26,5 @@
2626
$application->setCommandLoader(new ContainerCommandLoader($container, $config['commands']));
2727

2828
$exit = $application->run();
29-
exit ($exit);
29+
exit($exit);
3030
})();

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
"ext-zip": "*",
2121
"bluepsyduck/factorio-mod-portal-client": "^1.2",
2222
"bluepsyduck/factorio-translator": "^1.0",
23+
"bluepsyduck/mapper-manager": "dev-feature/generics",
2324
"bluepsyduck/symfony-process-manager": "^1.0",
2425
"bluepsyduck/laminas-autowire-factory": "^1.0",
2526
"doctrine/cache": "^1.8",
2627
"factorio-item-browser/common": "^1.2",
27-
"factorio-item-browser/export-data": "^3.0",
28+
"factorio-item-browser/export-data": "dev-feature/chunked-data",
2829
"factorio-item-browser/export-queue-client": "^1.2.0",
2930
"laminas/laminas-config-aggregator": "^1.0",
3031
"laminas/laminas-servicemanager": "^3.3",

composer.lock

Lines changed: 88 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/autoload/dependencies.global.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@
4040

4141
Helper\HashCalculator::class => AutoWireFactory::class,
4242

43+
Mapper\FluidMapper::class => AutoWireFactory::class,
44+
Mapper\IconLayerMapper::class => AutoWireFactory::class,
45+
Mapper\IconMapper::class => AutoWireFactory::class,
46+
Mapper\ItemMapper::class => AutoWireFactory::class,
47+
Mapper\MachineMapper::class => AutoWireFactory::class,
48+
Mapper\RecipeIngredientMapper::class => AutoWireFactory::class,
49+
Mapper\RecipeMapper::class => AutoWireFactory::class,
50+
Mapper\RecipeProductMapper::class => AutoWireFactory::class,
51+
4352
Mod\ModDownloader::class => AutoWireFactory::class,
4453
Mod\ModFileManager::class => AutoWireFactory::class,
4554

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace FactorioItemBrowser\Export;
6+
7+
use BluePsyduck\MapperManager\Constant\ConfigKey;
8+
9+
/**
10+
* The configuration of the mapper manager.
11+
*
12+
* @author BluePsyduck <[email protected]>
13+
* @license http://opensource.org/licenses/GPL-3.0 GPL v3
14+
*/
15+
16+
return [
17+
ConfigKey::MAIN => [
18+
ConfigKey::MAPPERS => [
19+
Mapper\FluidMapper::class,
20+
Mapper\IconLayerMapper::class,
21+
Mapper\IconMapper::class,
22+
Mapper\ItemMapper::class,
23+
Mapper\MachineMapper::class,
24+
Mapper\RecipeIngredientMapper::class,
25+
Mapper\RecipeMapper::class,
26+
Mapper\RecipeProductMapper::class,
27+
],
28+
],
29+
];

config/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
new ArrayProvider($cacheConfig),
2525

2626
\BluePsyduck\FactorioModPortalClient\ConfigProvider::class,
27+
\BluePsyduck\MapperManager\ConfigProvider::class,
2728
\FactorioItemBrowser\ExportData\ConfigProvider::class,
2829
\FactorioItemBrowser\ExportQueue\Client\ConfigProvider::class,
2930

src/Command/ProcessStep/ParserStep.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ public function run(ProcessStepData $processStepData): void
7373

7474
$this->console->writeAction('Parsing');
7575
foreach ($this->parsers as $parser) {
76-
$parser->parse($processStepData->getDump(), $processStepData->getExportData()->getCombination());
76+
$parser->parse($processStepData->getDump(), $processStepData->getExportData());
7777
}
7878

7979
$this->console->writeAction('Validating');
8080
foreach ($this->parsers as $parser) {
81-
$parser->validate($processStepData->getExportData()->getCombination());
81+
$parser->validate($processStepData->getExportData());
8282
}
8383
}
8484
}

0 commit comments

Comments
 (0)