Passed
Pull Request — master (#37)
by Bruno
07:17
created

Computed   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

3 Methods

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