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

valksor / php-dev-build / 19384258487

15 Nov 2025 04:07AM UTC coverage: 19.747% (+2.5%) from 17.283%
19384258487

push

github

k0d3r1s
prettier

16 of 30 new or added lines in 4 files covered. (53.33%)

516 existing lines in 7 files now uncovered.

484 of 2451 relevant lines covered (19.75%)

1.03 hits per line

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

38.46
/Command/BinaryEnsureCommand.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\Command;
14

15
use JsonException;
16
use RuntimeException;
17
use Symfony\Component\Console\Attribute\Argument;
18
use Symfony\Component\Console\Attribute\AsCommand;
19
use Symfony\Component\Console\Input\InputInterface;
20
use Symfony\Component\Console\Output\OutputInterface;
21
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
22
use ValksorDev\Build\Binary\BinaryRegistry;
23
use ValksorDev\Build\Provider\ProviderRegistry;
24

25
use function implode;
26
use function sprintf;
27
use function ucfirst;
28

29
#[AsCommand(name: 'valksor:binary', description: 'Ensure tool binaries/assets are downloaded (tailwindcss, esbuild, daisyui).')]
30
final class BinaryEnsureCommand extends AbstractCommand
31
{
32
    public function __construct(
33
        private readonly BinaryRegistry $binaryRegistry,
34
        ParameterBagInterface $bag,
35
        ProviderRegistry $providerRegistry,
36
    ) {
37
        parent::__construct($bag, $providerRegistry);
6✔
38
    }
39

40
    /**
41
     * Execute the binary ensure command.
42
     *
43
     * @throws JsonException
44
     */
45
    public function __invoke(
46
        #[Argument(
47
            description: 'Tool binary to download',
48
        )]
49
        string $tool,
50
        InputInterface $input,
51
        OutputInterface $output,
52
    ): int {
53
        $io = $this->createSymfonyStyle($input, $output);
2✔
54

55
        // Validate tool exists in registry
56
        if (!$this->binaryRegistry->has($tool)) {
2✔
57
            $availableBinaries = $this->binaryRegistry->getAvailableNames();
2✔
58

59
            return $this->handleCommandError(sprintf('Unsupported tool: %s. Supported tools: %s', $tool, implode(', ', $availableBinaries)), $io);
2✔
60
        }
61

62
        $projectRoot = $this->resolveProjectRoot();
×
63
        $manager = $this->createManagerForTool($projectRoot, $tool);
×
64

65
        try {
66
            $tag = $manager->ensureLatest([$io, 'text']);
×
67

68
            return $this->handleCommandSuccess(sprintf('%s assets ready (%s).', ucfirst($tool), $tag), $io);
×
69
        } catch (RuntimeException $exception) {
×
70
            return $this->handleCommandError($exception->getMessage(), $io);
×
71
        }
72
    }
73

74
    private function createManagerForTool(
75
        string $projectRoot,
76
        string $tool,
77
    ): object {
78
        $varDir = $projectRoot . '/var';
×
79

NEW
80
        return $this->binaryRegistry->get($tool)->createManager($varDir, $tool);
×
81
    }
82
}
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