Passed
Push — master ( 138b71...c5c69e )
by Sebastian
04:58
created

Mailcode_Factory_CommandSets_IfBase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A else() 0 17 2
1
<?php
2
/**
3
 * File containing the {@see Mailcode_Factory} class.
4
 *
5
 * @package Mailcode
6
 * @subpackage Utilities
7
 * @see Mailcode_Factory
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 Utilities
19
 * @author Sebastian Mordziol <[email protected]>
20
 */
21
abstract class Mailcode_Factory_CommandSets_IfBase extends Mailcode_Factory_CommandSets_Set
22
{
23
    public function else() : Mailcode_Commands_Command_Else
24
    {
25
        $cmd = Mailcode::create()->getCommands()->createCommand(
26
            'Else',
27
            '',
28
            '',
29
            '{else}'
30
        );
31
        
32
        $this->instantiator->checkCommand($cmd);
33
        
34
        if($cmd instanceof Mailcode_Commands_Command_Else)
35
        {
36
            return $cmd;
37
        }
38
        
39
        throw $this->instantiator->exceptionUnexpectedType('Else', $cmd);
40
    }
41
}
42