Skip to content

Commit 3340700

Browse files
committed
refactor: use match instead of switch in renderEntries
1 parent cd66aeb commit 3340700

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

src/Main.php

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,13 @@ private function renderEntries(array $entries): void
7272
{
7373
$relation = new Relation($entries, $this->options);
7474

75-
switch ($this->options->diagram()) {
76-
case Options::DIAGRAM_CLASS:
77-
$this->renderDiagramClass($relation);
78-
break;
79-
case OPTIONS::DIAGRAM_PACKAGE:
80-
$this->renderDiagramPackage($relation);
81-
break;
82-
case OPTIONS::DIAGRAM_JIG:
83-
$this->renderDiagramJig($relation);
84-
break;
85-
case OPTIONS::DIAGRAM_DIVSION:
86-
$this->renderDiagramVivsion($relation);
87-
break;
88-
default:
89-
throw new RuntimeException('invalid diagram.');
90-
}
75+
match ($this->options->diagram()) {
76+
Options::DIAGRAM_CLASS => $this->renderDiagramClass($relation),
77+
OPTIONS::DIAGRAM_PACKAGE => $this->renderDiagramPackage($relation),
78+
OPTIONS::DIAGRAM_JIG => $this->renderDiagramJig($relation),
79+
OPTIONS::DIAGRAM_DIVSION => $this->renderDiagramVivsion($relation),
80+
default => throw new RuntimeException('invalid diagram.')
81+
};
9182
}
9283

9384
private function renderDiagramClass(Relation $relation): void

0 commit comments

Comments
 (0)