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

ValidatorArgs   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toGraphql() 0 8 1
A __construct() 0 5 1
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