Test Failed
Push — graphviz-refactoring ( 3f1b14 )
by Luis
02:18
created

plNode::toDotLanguage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
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
class plNode implements plHasDotRepresentation
9
{
10
    /** @var plHasNodeIdentifier */
11
    private $node;
12
13
    /** @var string */
14
    private $options;
15
16
    public function __construct(plHasNodeIdentifier $node, string $htmlLabel)
17
    {
18
        $this->node = $node;
19
        $this->options = $this->buildOptionsUsing($htmlLabel);
20
    }
21
22
    public function toDotLanguage(): string
23
    {
24
        return "\"{$this->node->identifier()}\" {$this->options}\n";
25
    }
26
27
    private function buildOptionsUsing(string $htmlLabel): string
28
    {
29
        return "[label={$htmlLabel} shape=plaintext]";
30
    }
31
}
32