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

valksor / php-dev-build / 19202038340

09 Nov 2025 02:25AM UTC coverage: 17.283% (-0.9%) from 18.191%
19202038340

push

github

k0d3r1s
update documentation

383 of 2216 relevant lines covered (17.28%)

0.92 hits per line

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

0.0
/Provider/AssetsProvider.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\Provider;
14

15
use Symfony\Component\Console\Command\Command;
16
use Symfony\Component\Console\Style\SymfonyStyle;
17
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
18
use ValksorDev\Build\Util\ConsoleCommandBuilder;
19

20
use function trim;
21

22
/**
23
 * Provider for Symfony assets build steps.
24
 */
25
#[AutoconfigureTag('valksor.service_provider')]
26
final class AssetsProvider implements ProviderInterface, IoAwareInterface
27
{
28
    private ?SymfonyStyle $io = null;
29

30
    public function __construct(
31
        private readonly ConsoleCommandBuilder $commandBuilder,
32
    ) {
33
    }
×
34

35
    public function build(
36
        array $options,
37
    ): int {
38
        // Step 1: Install bundle web assets (relative links)
39
        $process1 = $this->commandBuilder->build('assets:install', ['--relative', '--no-interaction']);
×
40
        $process1->run();
×
41

42
        if (!$process1->isSuccessful()) {
×
43
            $this->io?->error('[ASSETS] assets:install failed: ' . trim($process1->getErrorOutput()));
×
44

45
            return Command::FAILURE;
×
46
        }
47

48
        // Step 2: Download/import JavaScript dependencies
49
        $process2 = $this->commandBuilder->build('importmap:install', ['--no-interaction']);
×
50
        $process2->run();
×
51

52
        if (!$process2->isSuccessful()) {
×
53
            $this->io?->error('[IMPORTMAP] importmap:install failed: ' . trim($process2->getErrorOutput()));
×
54

55
            return Command::FAILURE;
×
56
        }
57

58
        // Step 3: Compile all mapped assets to final output directory
59
        $process3 = $this->commandBuilder->build('asset-map:compile', ['--no-interaction']);
×
60
        $process3->run();
×
61

62
        if (!$process3->isSuccessful()) {
×
63
            $this->io?->error('[ASSET-MAP] asset-map:compile failed: ' . trim($process3->getErrorOutput()));
×
64

65
            return Command::FAILURE;
×
66
        }
67

68
        return Command::SUCCESS;
×
69
    }
70

71
    public function getDependencies(): array
72
    {
73
        return []; // No dependencies, should run first
×
74
    }
75

76
    public function getName(): string
77
    {
78
        return 'assets';
×
79
    }
80

81
    public function getServiceOrder(): int
82
    {
83
        return 5; // Run very early, before other build steps
×
84
    }
85

86
    public function init(
87
        array $options,
88
    ): void {
89
        // Assets don't need initialization, only build
90
    }
×
91

92
    public function setIo(
93
        SymfonyStyle $io,
94
    ): void {
95
        $this->io = $io;
×
96
    }
97

98
    public function watch(
99
        array $options,
100
    ): int {
101
        // Assets don't have a watch mode, they're build-only
102
        return Command::SUCCESS;
×
103
    }
104
}
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