Passed
Push — master ( ea62c3...cd2ef0 )
by Bruno
09:11
created

ValidatorArgs::toGraphql()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Formularium;
4
5
/**
6
 * Abstract base classe to validate data in composition to the validation in
7
 * datatypes.
8
 */
9
class ValidatorArgs
10
{
11
    /**
12
     * @var string
13
     */
14
    public $name;
15
16
    /**
17
     * @var string
18
     */
19
    public $type;
20
21
    /**
22
     * @var string
23
     */
24
    public $comment;
25
26
    public function __construct(string $name, string $type, string $comment)
27
    {
28
        $this->name = $name;
29
        $this->type = $type;
30
        $this->comment = $comment;
31
    }
32
33
    public function toGraphql(): string
34
    {
35
        return <<<EOF
36
37
    """
38
    {$this->comment}
39
    """
40
    {$this->name}: {$this->type}
41
EOF;
42
    }
43
}
44