MetadataParameter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 72.72%

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 42
ccs 8
cts 11
cp 0.7272
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toGraphql() 0 8 1
A toMarkdown() 0 6 1
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 4
    public function __construct(string $name, string $type, string $comment)
26
    {
27 4
        $this->name = $name;
28 4
        $this->type = $type;
29 4
        $this->comment = $comment;
30 4
    }
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 2
    public function toGraphql(): string
43
    {
44
        return <<<EOF
45
46
    """
47 2
    {$this->comment}
48
    """
49 2
    {$this->name}: {$this->type}
50
EOF;
51
    }
52
}
53