Completed
Push — middleware-wip ( f2f782...846df6 )
by Romain
10:35 queued 04:40
created

SubSteps   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 1
dl 0
loc 60
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A hasSubSteps() 0 4 1
A getFirstSubStepDefinition() 0 4 1
A getEntries() 0 4 1
A getEntry() 0 8 2
A hasEntry() 0 4 1
1
<?php
2
/*
3
 * 2017 Romain CANON <[email protected]>
4
 *
5
 * This file is part of the TYPO3 FormZ project.
6
 * It is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU General Public License, either
8
 * version 3 of the License, or any later version.
9
 *
10
 * For the full copyright and license information, see:
11
 * http://www.gnu.org/licenses/gpl-3.0.html
12
 */
13
14
namespace Romm\Formz\Form\Definition\Step\Step\SubStep;
15
16
use Romm\Formz\Exceptions\EntryNotFoundException;
17
use Romm\Formz\Form\Definition\AbstractFormDefinition;
18
19
class SubSteps extends AbstractFormDefinition
20
{
21
    /**
22
     * @var \Romm\Formz\Form\Definition\Step\Step\SubStep\SubStep[]
23
     */
24
    protected $entries;
25
26
    /**
27
     * @var \Romm\Formz\Form\Definition\Step\Step\SubStep\SubStepDefinition
28
     * @validate NotEmpty
29
     */
30
    protected $firstSubStep;
31
32
    /**
33
     * @return bool
34
     */
35
    public function hasSubSteps()
36
    {
37
        return null !== $this->firstSubStep;
38
    }
39
40
    /**
41
     * @return SubStepDefinition
42
     */
43
    public function getFirstSubStepDefinition()
44
    {
45
        return $this->firstSubStep;
46
    }
47
48
    /**
49
     * @return SubStep[]
50
     */
51
    public function getEntries()
52
    {
53
        return $this->entries;
54
    }
55
56
    /**
57
     * @param string $name
58
     * @return SubStep
59
     * @throws EntryNotFoundException
60
     */
61
    public function getEntry($name)
62
    {
63
        if (false === $this->hasEntry($name)) {
64
            throw new \Exception('todo'); // @todo
65
        }
66
67
        return $this->entries[$name];
68
    }
69
70
    /**
71
     * @param string $name
72
     * @return bool
73
     */
74
    public function hasEntry($name)
75
    {
76
        return isset($this->entries[$name]);
77
    }
78
}
79