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

JBZoo / Composer-Diff / 6590443550

16 Aug 2023 06:22PM UTC coverage: 94.294%. Remained the same
6590443550

push

github

web-flow
Upgrade `jbzoo/cli:^7.1.1` (#26)

1 of 1 new or added line in 1 file covered. (100.0%)

314 of 333 relevant lines covered (94.29%)

49.24 hits per line

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

100.0
/src/Renders/Markdown.php
1
<?php
2

3
/**
4
 * JBZoo Toolbox - Composer-Diff.
5
 *
6
 * This file is part of the JBZoo Toolbox project.
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license    MIT
11
 * @copyright  Copyright (C) JBZoo.com, All rights reserved.
12
 * @see        https://github.com/JBZoo/Composer-Diff
13
 */
14

15
declare(strict_types=1);
16

17
namespace JBZoo\ComposerDiff\Renders;
18

19
use JBZoo\Markdown\Table;
20
use Symfony\Component\Console\Output\OutputInterface;
21

22
final class Markdown extends AbstractRender
23
{
24
    protected function renderOneEnv(OutputInterface $output, array $changeLog, string $env): void
25
    {
26
        $table = new Table();
12✔
27
        $table->setMinCellLength(3);
12✔
28

29
        if ($this->showLinks()) {
12✔
30
            $table
8✔
31
                ->setHeaders(['Package', 'Action', 'Old Version', 'New Version', ''])
8✔
32
                ->setAlignments([
8✔
33
                    Table::ALIGN_LEFT,
8✔
34
                    Table::ALIGN_LEFT,
8✔
35
                    Table::ALIGN_RIGHT,
8✔
36
                    Table::ALIGN_RIGHT,
8✔
37
                    Table::ALIGN_LEFT,
8✔
38
                ]);
8✔
39
        } else {
40
            $table
4✔
41
                ->setHeaders(['Package', 'Action', 'Old Version', 'New Version'])
4✔
42
                ->setAlignments([
4✔
43
                    Table::ALIGN_LEFT,
4✔
44
                    Table::ALIGN_LEFT,
4✔
45
                    Table::ALIGN_RIGHT,
4✔
46
                    Table::ALIGN_RIGHT,
4✔
47
                ]);
4✔
48
        }
49

50
        foreach ($changeLog as $diff) {
12✔
51
            $row = $diff->toArray();
12✔
52

53
            $fromVersion = $row['version_from'] ?? '-';
12✔
54
            $toVersion   = $row['version_to'] ?? '-';
12✔
55

56
            if ($this->showLinks()) {
12✔
57
                $table->appendRow([
8✔
58
                    self::getLink($row['name'], $row['url']),
8✔
59
                    $row['mode'],
8✔
60
                    $fromVersion,
8✔
61
                    $toVersion,
8✔
62
                    self::getLink('See details', $row['compare']),
8✔
63
                ]);
8✔
64
            } else {
65
                $table->appendRow([$row['name'], $row['mode'], $fromVersion, $toVersion]);
4✔
66
            }
67
        }
68

69
        $output->writeln("## {$this->getTitle($env)} ({$env})");
12✔
70
        $output->writeln('');
12✔
71
        $output->write($table->render());
12✔
72
        $output->writeln('');
12✔
73
    }
74

75
    protected static function getLink(string $title, ?string $url = null): string
76
    {
77
        return ($url !== '' && $url !== null) ? "[{$title}]({$url})" : '';
8✔
78
    }
79
}
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

© 2025 Coveralls, Inc