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

JBZoo / Mermaid-PHP / 29807322753

20 Jul 2026 07:54PM UTC coverage: 88.553%. Remained the same
29807322753

push

github

web-flow
Merge pull request #29 from JBZoo/release/8.0

8.0.0 — PHP 8.3+ floor & lock-step major

7 of 8 new or added lines in 1 file covered. (87.5%)

5 existing lines in 1 file now uncovered.

410 of 463 relevant lines covered (88.55%)

60.36 hits per line

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

95.0
/src/ClassDiagram/Relationship/RelationType.php
1
<?php
2

3
/**
4
 * JBZoo Toolbox - Mermaid-PHP.
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/Mermaid-PHP
13
 */
14

15
declare(strict_types=1);
16

17
namespace JBZoo\MermaidPHP\ClassDiagram\Relationship;
18

19
enum RelationType
20
{
21
    case INHERITANCE;
22
    case COMPOSITION;
23
    case AGGREGATION;
24
    case ASSOCIATION;
25
    case DEPENDENCY;
26
    case REALIZATION;
27
    // not documented
28
    case LOLLILOP;
29

30
    public function getDefaultLink(): Link
31
    {
32
        return match ($this) {
24✔
33
            self::DEPENDENCY, self::REALIZATION => Link::DASHED,
24✔
34
            default                             => Link::SOLID,
24✔
35
        };
24✔
36
    }
37

38
    /**
39
     * @psalm-suppress PossiblyNullOperand
40
     */
41
    public function renderRelation(Link $link, ?RelationType $inverse): string
42
    {
43
        return match ($this) {
24✔
44
            self::AGGREGATION, self::COMPOSITION => $this->renderDirect() . $link->value . $inverse?->renderInverse(),
24✔
45
            default                              => $inverse?->renderInverse() . $link->value . $this->renderDirect(),
24✔
46
        };
24✔
47
    }
48

49
    private function renderDirect(): string
50
    {
51
        return match ($this) {
24✔
52
            self::INHERITANCE, self::REALIZATION => '|>',
24✔
53
            self::COMPOSITION                    => '*',
18✔
54
            self::AGGREGATION                    => 'o',
12✔
NEW
55
            self::ASSOCIATION, self::DEPENDENCY  => '>',
×
56
            self::LOLLILOP                       => '(),'
24✔
57
        };
24✔
58
    }
59

60
    private function renderInverse(): string
61
    {
62
        return match ($this) {
6✔
63
            self::INHERITANCE, self::REALIZATION => '<|',
6✔
64
            self::ASSOCIATION, self::DEPENDENCY  => '<',
6✔
65
            default                              => $this->renderDirect(),
6✔
66
        };
6✔
67
    }
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc