-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathBiomeJsExtension.php
More file actions
61 lines (50 loc) · 1.84 KB
/
Copy pathBiomeJsExtension.php
File metadata and controls
61 lines (50 loc) · 1.84 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
declare(strict_types=1);
namespace Kocal\BiomeJsBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader;
final class BiomeJsExtension extends Extension implements ConfigurationInterface
{
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('services.php');
$configuration = $this->getConfiguration($configs, $container);
/** @var array<string> $config */
$config = $this->processConfiguration($configuration, $configs);
$container->getDefinition('biomejs.command.download')
->setArgument(0, $config['binary_version']);
}
public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface
{
return $this;
}
public function getAlias(): string
{
return 'kocal_biome_js';
}
/**
* @return TreeBuilder<'array'>
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder($this->getAlias());
$rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
->scalarNode('binary_version')
->info('Biome.js CLI version to download.')
->isRequired()
->example([
'v1.9.4',
'2.0.0',
])
->end()
->end();
return $treeBuilder;
}
}