Passed
Pull Request — master (#37)
by Bruno
10:31
created

Computed::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 3
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\Vue\VueCode;
4
5
class Computed
6
{
7
    /**
8
     * @var string
9
     */
10
    public $name;
11
12
    /**
13
     * @var string
14
     */
15
    public $code;
16
17
    /**
18
     * @var string
19
     */
20
    public $type = null;
21
22
    public function __construct(string $name, string $type = '', string $code = '')
23
    {
24
        $this->name = $name;
25
        $this->code = $code;
26
        $this->type = $type;
27
    }
28
29
    public function toGetter(): string
30
    {
31
        return "get {$this->name}() { $this->code }";
32
    }
33
34
    public function toStruct(): string
35
    {
36
        return "{$this->name}() { $this->code }";
37
    }
38
}
39