Passed
Push — master ( bb4653...2ab0f7 )
by Bruno
07:17
created

MetadataParameter::toMarkdown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Formularium;
4
5
/**
6
 * Allowed arguments
7
 */
8
final class MetadataParameter
9
{
10
    /**
11
     * @var string
12
     */
13
    public $name;
14
15
    /**
16
     * @var string
17
     */
18
    public $type;
19
20
    /**
21
     * @var string
22
     */
23
    public $comment;
24
25
    public function __construct(string $name, string $type, string $comment)
26
    {
27
        $this->name = $name;
28
        $this->type = $type;
29
        $this->comment = $comment;
30
    }
31
32
    public function toMarkdown(): string
33
    {
34
        return <<<EOF
35
### {$this->name} ({$this->type})
36
37
{$this->comment}
38
39
EOF;
40
    }
41
42
    public function toGraphql(): string
43
    {
44
        return <<<EOF
45
46
    """
47
    {$this->comment}
48
    """
49
    {$this->name}: {$this->type}
50
EOF;
51
    }
52
}
53