Skip to content

Commit 64e11f1

Browse files
committed
change: rename Internal to Support
1 parent cc61be4 commit 64e11f1

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

src/DependencyInjection/CompilerPass/RegisterDataLoadersFromTagsPass.php

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Overblog\DataLoader\DataLoader;
1515
use Overblog\DataLoader\Option;
16-
use Overblog\DataLoaderBundle\DependencyInjection\Internal;
16+
use Overblog\DataLoaderBundle\DependencyInjection\Support;
1717
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
1919
use Symfony\Component\DependencyInjection\Reference;
@@ -26,7 +26,7 @@ public function process(ContainerBuilder $container)
2626
foreach ($tags as $attributes) {
2727
$batchLoadFn = isset($attributes['method'])
2828
? [new Reference($serviceId), $attributes['method']]
29-
: Internal::buildCallableFromScalar($attributes['batch_load_fn']);
29+
: Support::buildCallableFromScalar($attributes['batch_load_fn']);
3030

3131
$this->registerDataLoader($container, $attributes, $batchLoadFn);
3232
}
@@ -35,12 +35,12 @@ public function process(ContainerBuilder $container)
3535

3636
private function registerDataLoader(ContainerBuilder $container, array $loaderConfig, mixed $batchLoadFn): void
3737
{
38-
$dataLoaderServiceID = Internal::generateDataLoaderServiceIDFromName($loaderConfig['name'], $container);
39-
$optionServiceID = Internal::generateDataLoaderOptionServiceIDFromName($loaderConfig['name'], $container);
38+
$dataLoaderServiceID = Support::generateDataLoaderServiceIDFromName($loaderConfig['name'], $container);
39+
$optionServiceID = Support::generateDataLoaderOptionServiceIDFromName($loaderConfig['name'], $container);
4040

4141
$container->register($optionServiceID, Option::class)
4242
->setPublic(false)
43-
->setArguments([$this->buildOptionsParams($loaderConfig['options'])]);
43+
->setArguments([Support::buildOptionsParams($loaderConfig['options'])]);
4444

4545
$definition = $container->register($dataLoaderServiceID, DataLoader::class)
4646
->setPublic(true)
@@ -52,7 +52,7 @@ private function registerDataLoader(ContainerBuilder $container, array $loaderCo
5252
]);
5353

5454
if (isset($loaderConfig['factory'])) {
55-
$definition->setFactory(Internal::buildCallableFromScalar($loaderConfig['factory']));
55+
$definition->setFactory(Support::buildCallableFromScalar($loaderConfig['factory']));
5656
}
5757

5858
if (isset($loaderConfig['alias'])) {
@@ -61,17 +61,4 @@ private function registerDataLoader(ContainerBuilder $container, array $loaderCo
6161
->setPublic(true);
6262
}
6363
}
64-
65-
private function buildOptionsParams(array $options): array
66-
{
67-
$optionsParams = [];
68-
69-
$optionsParams['batch'] = $options['batch'];
70-
$optionsParams['cache'] = $options['cache'];
71-
$optionsParams['maxBatchSize'] = $options['max_batch_size'];
72-
$optionsParams['cacheMap'] = new Reference($options['cache_map']);
73-
$optionsParams['cacheKeyFn'] = Internal::buildCallableFromScalar($options['cache_key_fn']);
74-
75-
return $optionsParams;
76-
}
7764
}

src/DependencyInjection/OverblogDataLoaderExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function load(array $configs, ContainerBuilder $container): void
3939
});
4040

4141
foreach ($config['loaders'] as $name => $loaderConfig) {
42-
$container->register(Internal::generateDataLoaderServiceIDFromName($name, $container), DataLoader::class)
42+
$container->register(Support::generateDataLoaderServiceIDFromName($name, $container), DataLoader::class)
4343
->addTag('overblog.dataloader', array_merge($config['defaults'], [
4444
'name' => $name,
4545
'alias' => $loaderConfig['alias'] ?? null,
@@ -51,6 +51,6 @@ public function load(array $configs, ContainerBuilder $container): void
5151

5252
public function getAlias(): string
5353
{
54-
return Internal::getAlias();
54+
return Support::getAlias();
5555
}
5656
}

src/DependencyInjection/Internal.php renamed to src/DependencyInjection/Support.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
use Symfony\Component\DependencyInjection\ContainerBuilder;
1515
use Symfony\Component\DependencyInjection\Reference;
1616

17-
class Internal
17+
/** @internal */
18+
class Support
1819
{
1920
private static string $alias = 'overblog_dataloader';
2021

@@ -59,4 +60,17 @@ public static function buildCallableFromScalar($scalar): mixed
5960

6061
return null;
6162
}
63+
64+
public static function buildOptionsParams(array $options): array
65+
{
66+
$optionsParams = [];
67+
68+
$optionsParams['batch'] = $options['batch'];
69+
$optionsParams['cache'] = $options['cache'];
70+
$optionsParams['maxBatchSize'] = $options['max_batch_size'];
71+
$optionsParams['cacheMap'] = new Reference($options['cache_map']);
72+
$optionsParams['cacheKeyFn'] = self::buildCallableFromScalar($options['cache_key_fn']);
73+
74+
return $optionsParams;
75+
}
6276
}

0 commit comments

Comments
 (0)