Passed
Push — 1.x ( a9995e...5c2b79 )
by Aleksei
12:31
created

EntityRelation::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Schema\Renderer\MermaidRenderer\Entity;
6
7
use Cycle\Schema\Renderer\MermaidRenderer\Relation;
8
9
final class EntityRelation implements EntityInterface
10
{
11
    /**
12
     * @var Relation[]
13
     */
14
    private array $relations = [];
15
16
    public function addRelation(Relation $relation): void
17
    {
18
        $this->relations[] = $relation;
19
    }
20
21
    public function __toString(): string
22
    {
23
        $relations = \array_map(function (Relation $relation) {
24
            return (string) $relation;
25
        }, $this->relations);
26
27
        return \implode("\n", $relations);
28
    }
29
}
30