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

JBZoo / Mermaid-PHP / 6310109909

26 Sep 2023 07:53AM UTC coverage: 89.606% (-1.5%) from 91.071%
6310109909

push

github

web-flow
Add Entity Relationship Diagrams (#14)

112 of 112 new or added lines in 9 files covered. (100.0%)

250 of 279 relevant lines covered (89.61%)

48.2 hits per line

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

76.47
/src/ERDiagram/Entity/EntityProperty.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\ERDiagram\Entity;
18

19
class EntityProperty implements \Stringable
20
{
21
    public const PRIMARY_KEY = 'PK';
22
    public const FOREIGN_KEY = 'FK';
23
    public const UNIQUE_KEY  = 'UK';
24

25
    /**
26
     * @param string[] $keys
27
     */
28
    public function __construct(
29
        protected string $name,
30
        protected string $type,
31
        protected array $keys = [],
32
        protected string $comment = '',
33
    ) {
34
    }
8✔
35

36
    public function __toString(): string
37
    {
38
        $output   = [];
16✔
39
        $output[] = $this->getType();
16✔
40
        $output[] = $this->getName();
16✔
41

42
        if ($this->getKeys() !== []) {
16✔
43
            $output[] = \implode(', ', $this->getKeys());
8✔
44
        }
45

46
        if ($this->getComment() !== '') {
16✔
47
            $output[] = '"' . $this->getComment() . '"';
4✔
48
        }
49

50
        return \implode(' ', $output);
16✔
51
    }
52

53
    public function getName(): string
54
    {
55
        return $this->name;
16✔
56
    }
57

58
    public function setName(string $name): void
59
    {
60
        $this->name = $name;
×
61
    }
62

63
    public function getType(): string
64
    {
65
        return $this->type;
16✔
66
    }
67

68
    public function setType(string $type): void
69
    {
70
        $this->type = $type;
×
71
    }
72

73
    /**
74
     * @return string[]
75
     */
76
    public function getKeys(): array
77
    {
78
        return $this->keys;
16✔
79
    }
80

81
    /**
82
     * @param string[] $keys
83
     */
84
    public function setKeys(array $keys): void
85
    {
86
        $this->keys = $keys;
×
87
    }
88

89
    public function getComment(): string
90
    {
91
        return $this->comment;
16✔
92
    }
93

94
    public function setComment(string $comment): void
95
    {
96
        $this->comment = $comment;
×
97
    }
98
}
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