Skip to content

Commit

Permalink
Merge pull request #4 from hirokinoue/fix-diagram-drawing-bug
Browse files Browse the repository at this point in the history
描画に関するバグを修正する
  • Loading branch information
hirokinoue authored Feb 25, 2024
2 parents e929e70 + 5a88266 commit 2d452e3
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/Exporter/PlantUmlExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,27 @@ private function drawDependency(DiagramUnit $diagramUnit): void
}
$this->drawnDependencies[] = $lineForCheck;

$this->diagram .= "{$this->replaceErrorStr($diagramUnit)} --> {$this->replaceErrorStr($dependent)}" . PHP_EOL;
$this->diagram .= "{$this->diagramIdentifier($diagramUnit)} --> {$this->diagramIdentifier($dependent)}" . PHP_EOL;
$this->drawDependency($dependent);
}
}

private function diagramIdentifier(DiagramUnit $diagramUnit): string
{
$className = $this->replaceErrorStr($diagramUnit);
$namespace = ($diagramUnit->namespace() === '') ? '' : "{$diagramUnit->namespace()}.";
return $namespace . $className;
}

private function diagramShape(DiagramUnit $diagramUnit): string
{
return $diagramUnit->isNonClassLikeRoot()
? 'circle '
: $diagramUnit->declaringElement() . ' ';
if ($diagramUnit->isNonClassLikeRoot()) {
return 'circle ';
}
if ($diagramUnit->isTrait()) {
return 'abstract ';
}
return $diagramUnit->declaringElement() . ' ';
}

private function replaceErrorStr(DiagramUnit $diagramUnit): string
Expand Down

0 comments on commit 2d452e3

Please sign in to comment.