• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

valksor / php-dev-build / 21323318062

24 Jan 2026 11:21PM UTC coverage: 27.706% (-2.8%) from 30.503%
21323318062

push

github

k0d3r1s
wip

1 of 2 new or added lines in 2 files covered. (50.0%)

909 existing lines in 16 files now uncovered.

791 of 2855 relevant lines covered (27.71%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/DependencyInjection/BuildConfiguration.php
1
<?php declare(strict_types = 1);
2

3
/*
4
 * This file is part of the Valksor package.
5
 *
6
 * (c) Davis Zalitis (k0d3r1s)
7
 * (c) SIA Valksor <packages@valksor.com>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12

13
namespace ValksorDev\Build\DependencyInjection;
14

15
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
18
use Valksor\Bundle\DependencyInjection\AbstractDependencyConfiguration;
19
use Valksor\Bundle\ValksorBundle;
20

21
use function sprintf;
22

23
class BuildConfiguration extends AbstractDependencyConfiguration
24
{
25
    public function addSection(
26
        ArrayNodeDefinition $rootNode,
27
        callable $enableIfStandalone,
28
        string $component,
29
    ): void {
30
        $rootNode
×
31
            ->children()
×
32
                ->arrayNode($component)
×
33
                    ->{$enableIfStandalone(sprintf('%s/%s', ValksorBundle::VALKSOR, $component), self::class)}()
×
34
                    ->addDefaultsIfNotSet()
×
35
                    ->children()
×
36
                        // GitHub token for API rate limits
×
37
                        ->scalarNode('github_token')
×
38
                            ->info('GitHub personal access token for increased API rate limits (optional)')
×
39
                            ->example('ghp_xxxxxxxxxxxx')
×
40
                            ->defaultNull()
×
41
                        ->end()
×
42
                        // Service registry with extensible flag system
×
43
                        ->arrayNode('services')
×
44
                            ->info('Valksor Build System Services Configuration')
×
45
                            ->example([
×
46
                                'binaries' => [
×
47
                                    'enabled' => true,
×
48
                                    'flags' => ['init' => true, 'dev' => true, 'prod' => true],
×
49
                                    'provider' => 'binaries',
×
50
                                ],
×
51
                                'tailwind' => [
×
52
                                    'enabled' => true,
×
53
                                    'flags' => ['dev' => true, 'prod' => true],
×
54
                                    'provider' => 'tailwind',
×
55
                                    'options' => [
×
56
                                        'minify' => true,
×
57
                                        'watch' => false,
×
58
                                    ],
×
59
                                ],
×
60
                                'importmap' => [
×
61
                                    'enabled' => true,
×
62
                                    'flags' => ['dev' => true, 'prod' => true],
×
63
                                    'provider' => 'importmap',
×
64
                                    'options' => [
×
65
                                        'minify' => false,
×
66
                                        'esbuild' => true,
×
67
                                    ],
×
68
                                ],
×
69
                                'hot_reload' => [
×
70
                                    'enabled' => true,
×
71
                                    'flags' => ['dev' => true],
×
72
                                    'provider' => 'hot_reload',
×
73
                                    'options' => [
×
74
                                        'watch_dirs' => ['src/apps', 'infrastructure'],
×
75
                                        'debounce_delay' => 0.3,
×
76
                                        'extended_extensions' => [
×
77
                                            'php' => 0.1,
×
78
                                            'js' => 0.1,
×
79
                                            'css' => 0.2,
×
80
                                        ],
×
81
                                        'extended_suffixes' => [
×
82
                                            '.tailwind.css' => 0.5,
×
83
                                        ],
×
84
                                        'file_transformations' => [
×
85
                                            '*.tailwind.css' => [
×
86
                                                'output_pattern' => '{path}/{name}.css',
×
87
                                                'debounce_delay' => 0.5,
×
88
                                                'track_output' => true,
×
89
                                            ],
×
90
                                        ],
×
91
                                        'exclude' => [
×
92
                                            'tests', 'Tests', 'coverage', '.coverage', 'docs', 'build', 'dist',
×
93
                                            '**/*.log', '**/.DS_Store', '**/node_modules/**',
×
94
                                        ],
×
95
                                    ],
×
96
                                ],
×
97
                            ])
×
98
                            ->useAttributeAsKey('name')
×
99
                            ->arrayPrototype()
×
100
                                ->children()
×
101
                                    ->booleanNode('enabled')
×
102
                                        ->info('Enable or disable this service globally')
×
103
                                        ->example('true')
×
104
                                        ->defaultTrue()
×
105
                                    ->end()
×
106
                                    ->scalarNode('provider')
×
107
                                        ->info('Service provider class name (maps to implementation)')
×
108
                                        ->example('tailwind')
×
109
                                        ->isRequired()
×
110
                                    ->end()
×
111
                                    ->variableNode('flags')
×
112
                                        ->info('Service execution flags that determine when services run')
×
113
                                        ->example([
×
114
                                            'init' => true,
×
115
                                            'dev' => true,
×
116
                                            'prod' => true,
×
117
                                            'watch' => false,
×
118
                                            'build' => false,
×
119
                                        ])
×
120
                                        ->defaultValue([])
×
121
                                    ->end()
×
122
                                    ->variableNode('options')
×
123
                                        ->info('Service-specific configuration options')
×
124
                                        ->example([
×
125
                                            // Tailwind CSS service options
126
                                            'minify' => true,
×
127
                                            'watch' => false,
×
128

129
                                            // Importmap service options
130
                                            'esbuild' => true,
×
131
                                            'minify' => false,
×
132

133
                                            // Hot reload service options
134
                                            'watch_dirs' => ['src/apps', 'infrastructure'],
×
135
                                            'debounce_delay' => 0.3,
×
136
                                            'extended_extensions' => [
×
137
                                                'php' => 0.1,    // PHP files get 100ms debounce
×
138
                                                'js' => 0.1,     // JS files get 100ms debounce
×
139
                                                'css' => 0.2,     // CSS files get 200ms debounce
×
140
                                                'twig' => 0.3,   // Twig files get 300ms debounce
×
141
                                            ],
×
142
                                            'extended_suffixes' => [
×
143
                                                '.tailwind.css' => 0.5,  // Compiled CSS gets longer debounce
×
144
                                                '.min.css' => 0.3,
×
145
                                            ],
×
146
                                            'file_transformations' => [
×
147
                                                '*.tailwind.css' => [
×
148
                                                    'output_pattern' => '{path}/{name}.css',
×
149
                                                    'debounce_delay' => 0.5,
×
150
                                                    'track_output' => true,
×
151
                                                ],
×
152
                                            ],
×
153
                                        ])
×
154
                                        ->defaultValue(self::getDefaults()['services'])
×
155
                                    ->end()
×
156
                                ->end()
×
157
                            ->end()
×
158
                        ->end()
×
159
                    ->end()
×
160
                ->end()
×
161
            ->end();
×
162
    }
163

164
    public function registerPreConfiguration(
165
        ContainerConfigurator $container,
166
        ContainerBuilder $builder,
167
        string $component,
168
    ): void {
169
        if ($builder->hasExtension('framework')) {
×
170
            $builder->prependExtensionConfig('framework', [
×
171
                'asset_mapper' => [
×
172
                    'excluded_patterns' => [
×
173
                        '**/*.tailwind.css',
×
174
                    ],
×
175
                ],
×
176
            ]);
×
177
        }
178
    }
179

180
    public static function getDefaults(): array
181
    {
182
        return [
×
183
            'services' => [
×
184
                'binaries' => [
×
185
                    'enabled' => true,
×
186
                    'provider' => 'binaries',
×
187
                    'flags' => ['init' => true, 'dev' => false, 'prod' => true],
×
188
                    'options' => [
×
189
                        'required' => [],
×
190
                        'cache_duration' => 3600,
×
191
                        'generic_npm_packages' => '',
×
192
                        'pinned_versions' => [],
×
193
                    ],
×
194
                ],
×
195
                'icons' => [
×
196
                    'enabled' => true,
×
197
                    'provider' => 'icons',
×
198
                    'flags' => ['init' => true, 'dev' => false, 'prod' => true],
×
199
                    'options' => [
×
200
                        'fontawesome_path' => null,
×
201
                        'fontawesome_enabled' => true,
×
202
                    ],
×
203
                ],
×
204
                'assets' => [
×
205
                    'enabled' => true,
×
206
                    'provider' => 'assets',
×
207
                    'flags' => ['init' => false, 'dev' => false, 'prod' => true],
×
208
                    'options' => [],
×
209
                ],
×
210
                'tailwind' => [
×
211
                    'enabled' => true,
×
212
                    'provider' => 'tailwind',
×
213
                    'flags' => ['init' => false, 'dev' => true, 'prod' => true],
×
214
                    'options' => ['minify' => false, ],
×
215
                ],
×
216
                'importmap' => [
×
217
                    'enabled' => true,
×
218
                    'provider' => 'importmap',
×
219
                    'flags' => ['init' => false, 'dev' => true, 'prod' => true],
×
220
                    'options' => ['watch' => true, 'minify' => false],
×
221
                ],
×
222
                'hot_reload' => [
×
223
                    'enabled' => true,
×
224
                    'provider' => 'hot_reload',
×
225
                    'flags' => ['init' => false, 'dev' => true, 'prod' => false],
×
226
                    'options' => [
×
227
                        'debounce_delay' => 0.3,
×
228
                        'watch_dirs' => ['/src', '/templates'],
×
UNCOV
229
                        'file_transformations' => ['*.tailwind.css' => ['output_pattern' => '{path}/{name}.css', 'debounce_delay' => 0.5, 'track_output' => true]],
×
UNCOV
230
                        'extended_suffixes' => ['.tailwind.css' => 1.0, '.min.css' => 0.3],
×
UNCOV
231
                    ],
×
UNCOV
232
                ],
×
UNCOV
233
            ],
×
UNCOV
234
        ];
×
235
    }
236
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc