Completed
Push — master ( 3f1b14...d7a449 )
by Luis
14:49 queued 04:53
created

Node   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 22
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toDotLanguage() 0 3 1
A __construct() 0 4 1
A buildOptionsUsing() 0 3 1
1
<?php
2
/**
3
 * PHP version 7.1
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
namespace PhUml\Graphviz;
9
10
class Node implements HasDotRepresentation
11
{
12
    /** @var HasNodeIdentifier */
13
    private $node;
14
15
    /** @var string */
16
    private $options;
17
18
    public function __construct(HasNodeIdentifier $node, string $htmlLabel)
19
    {
20
        $this->node = $node;
21
        $this->options = $this->buildOptionsUsing($htmlLabel);
22
    }
23
24
    public function toDotLanguage(): string
25
    {
26
        return "\"{$this->node->identifier()}\" {$this->options}\n";
27
    }
28
29
    private function buildOptionsUsing(string $htmlLabel): string
30
    {
31
        return "[label={$htmlLabel} shape=plaintext]";
32
    }
33
}
34