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

move-elevator / composer-translation-validator / 16022093623

02 Jul 2025 10:00AM UTC coverage: 93.478% (+0.8%) from 92.692%
16022093623

push

github

web-flow
Merge pull request #14 from move-elevator/result-renderer

feat: implement output format handling with CLI and JSON renderers

80 of 86 new or added lines in 5 files covered. (93.02%)

516 of 552 relevant lines covered (93.48%)

4.51 hits per line

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

75.0
/src/Result/Output.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace MoveElevator\ComposerTranslationValidator\Result;
6

7
use MoveElevator\ComposerTranslationValidator\Validator\ResultType;
8
use MoveElevator\ComposerTranslationValidator\Validator\ValidatorInterface;
9
use Psr\Log\LoggerInterface;
10
use Symfony\Component\Console\Command\Command;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
use Symfony\Component\Console\Style\SymfonyStyle;
14

15
class Output
16
{
17
    protected SymfonyStyle $io;
18

19
    /**
20
     * @param array<class-string<ValidatorInterface>, array<string, array<string, array<mixed>>>> $issues
21
     */
22
    public function __construct(
3✔
23
        protected LoggerInterface $logger,
24
        protected OutputInterface $output,
25
        protected InputInterface $input,
26
        protected FormatType $format,
27
        protected ResultType $resultType,
28
        protected array $issues,
29
        protected bool $dryRun = false,
30
        protected bool $strict = false,
31
    ) {
32
        $this->io = new SymfonyStyle($this->input, $this->output);
3✔
33
    }
34

35
    /**
36
     * Summarizes validation results in the specified format.
37
     *
38
     * @return int Command exit code
39
     *
40
     * @throws \JsonException
41
     */
42
    public function summarize(): int
3✔
43
    {
44
        $renderer = RendererFactory::create(
3✔
45
            $this->format,
3✔
46
            $this->logger,
3✔
47
            $this->output,
3✔
48
            $this->input,
3✔
49
            $this->resultType,
3✔
50
            $this->issues,
3✔
51
            $this->dryRun,
3✔
52
            $this->strict
3✔
53
        );
3✔
54

55
        if (null === $renderer) {
3✔
NEW
56
            $this->logger->error(
×
NEW
57
                'Renderer für das Format {format} existiert nicht.',
×
NEW
58
                ['format' => $this->format->value]
×
NEW
59
            );
×
60

NEW
61
            return Command::FAILURE;
×
62
        }
63

64
        return $renderer->renderResult();
3✔
65
    }
66
}
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