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

plNode   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 buildOptionsUsing() 0 3 1
A __construct() 0 4 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
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