| Total Complexity | 6 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class NodeLabelBuilder |
||
| 18 | { |
||
| 19 | /** @var TemplateEngine */ |
||
| 20 | private $engine; |
||
| 21 | |||
| 22 | /** @var HtmlLabelStyle */ |
||
| 23 | private $style; |
||
| 24 | |||
| 25 | public function __construct(TemplateEngine $engine, HtmlLabelStyle $style) |
||
| 26 | { |
||
| 27 | $this->engine = $engine; |
||
| 28 | $this->style = $style; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function labelForClass(ClassDefinition $class): string |
||
| 32 | { |
||
| 33 | return $this->buildLabel('class.html.twig', [ |
||
| 34 | 'class' => $class, |
||
| 35 | 'style' => $this->style, |
||
| 36 | ]); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function labelForInterface(InterfaceDefinition $interface): string |
||
| 40 | { |
||
| 41 | return $this->buildLabel('interface.html.twig', [ |
||
| 42 | 'interface' => $interface, |
||
| 43 | 'style' => $this->style, |
||
| 44 | ]); |
||
| 45 | } |
||
| 46 | |||
| 47 | private function buildLabel(string $template, array $options): string |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | private function removeNewLinesFrom(string $label): string |
||
| 61 |