Passed
Pull Request — master (#15)
by Sebastian
04:12
created

Mailcode_Factory_CommandSets::var()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 8
rs 10
1
<?php
2
/**
3
 * File containing the {@see \Mailcode\Mailcode_Factory_CommandSets} class.
4
 *
5
 * @package Mailcode
6
 * @subpackage Factory
7
 * @see \Mailcode\Mailcode_Factory_CommandSets
8
 */
9
10
declare(strict_types=1);
11
12
namespace Mailcode;
13
14
/**
15
 * Factory utility used to create commands.
16
 *
17
 * @package Mailcode
18
 * @subpackage Factory
19
 * @author Sebastian Mordziol <[email protected]>
20
 */
21
class Mailcode_Factory_CommandSets
22
{
23
    private ?Mailcode_Factory_CommandSets_Set_If $if = null;
24
    private ?Mailcode_Factory_CommandSets_Set_Show $show = null;
25
    private ?Mailcode_Factory_CommandSets_Set_Misc $misc = null;
26
    private ?Mailcode_Factory_CommandSets_Set_Set $set = null;
27
    private ?Mailcode_Factory_CommandSets_Set_ElseIf $elseIf = null;
28
    private ?Mailcode_Factory_CommandSets_Set_Variables $variables = null;
29
30
    public function if() : Mailcode_Factory_CommandSets_Set_If
31
    {
32
        if(!isset($this->if))
33
        {
34
            $this->if = new Mailcode_Factory_CommandSets_Set_If();
35
        }
36
        
37
        return $this->if;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->if could return the type null which is incompatible with the type-hinted return Mailcode\Mailcode_Factory_CommandSets_Set_If. Consider adding an additional type-check to rule them out.
Loading history...
38
    }
39
    
40
    public function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf
41
    {
42
        if(!isset($this->elseIf))
43
        {
44
            $this->elseIf = new Mailcode_Factory_CommandSets_Set_ElseIf();
45
        }
46
        
47
        return $this->elseIf;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->elseIf could return the type null which is incompatible with the type-hinted return Mailcode\Mailcode_Factory_CommandSets_Set_ElseIf. Consider adding an additional type-check to rule them out.
Loading history...
48
    }
49
    
50
    public function show() : Mailcode_Factory_CommandSets_Set_Show
51
    {
52
        if(!isset($this->show))
53
        {
54
            $this->show = new Mailcode_Factory_CommandSets_Set_Show();
55
        }
56
        
57
        return $this->show;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->show could return the type null which is incompatible with the type-hinted return Mailcode\Mailcode_Factory_CommandSets_Set_Show. Consider adding an additional type-check to rule them out.
Loading history...
58
    }
59
    
60
    public function misc() : Mailcode_Factory_CommandSets_Set_Misc
61
    {
62
        if(!isset($this->misc))
63
        {
64
            $this->misc = new Mailcode_Factory_CommandSets_Set_Misc();
65
        }
66
        
67
        return $this->misc;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->misc could return the type null which is incompatible with the type-hinted return Mailcode\Mailcode_Factory_CommandSets_Set_Misc. Consider adding an additional type-check to rule them out.
Loading history...
68
    }
69
    
70
    public function set() : Mailcode_Factory_CommandSets_Set_Set
71
    {
72
        if(!isset($this->set))
73
        {
74
            $this->set = new Mailcode_Factory_CommandSets_Set_Set();
75
        }
76
        
77
        return $this->set;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->set could return the type null which is incompatible with the type-hinted return Mailcode\Mailcode_Factory_CommandSets_Set_Set. Consider adding an additional type-check to rule them out.
Loading history...
78
    }
79
80
    public function var() : Mailcode_Factory_CommandSets_Set_Variables
81
    {
82
        if(!isset($this->variables))
83
        {
84
            $this->variables = new Mailcode_Factory_CommandSets_Set_Variables();
85
        }
86
87
        return $this->variables;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->variables could return the type null which is incompatible with the type-hinted return Mailcode\Mailcode_Factor...mmandSets_Set_Variables. Consider adding an additional type-check to rule them out.
Loading history...
88
    }
89
}
90