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

JBZoo / Composer-Diff / 8868989088

08 Feb 2024 09:20PM UTC coverage: 94.345%. Remained the same
8868989088

push

github

web-flow
Bump composer/composer from 2.6.6 to 2.7.0 (#34)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

317 of 336 relevant lines covered (94.35%)

74.11 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();
18✔
27
        $table->setMinCellLength(3);
18✔
28

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

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

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

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

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

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