Completed
Push — middleware-wip ( ffd957...48fd00 )
by Romain
02:53
created

Step   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getSettings() 0 4 1
A getSteps() 0 4 1
A getStep() 0 8 2
A hasStep() 0 4 1
A getDefaultStep() 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\Configuration\Form\Step;
15
16
use Romm\Formz\Configuration\AbstractFormzConfiguration;
17
18
class Step extends AbstractFormzConfiguration
19
{
20
    /**
21
     * @var \Romm\Formz\Configuration\Form\Step\Settings
22
     * @validate NotEmpty
23
     */
24
    protected $settings;
25
26
    /**
27
     * @var \Romm\Formz\Configuration\Form\Step\StepItem[]
28
     * @validate NotEmpty
29
     */
30
    protected $steps;
31
32
    /**
33
     * @return Settings
34
     */
35
    public function getSettings()
36
    {
37
        return $this->settings;
38
    }
39
40
    /**
41
     * @return StepItem[]
42
     */
43
    public function getSteps()
44
    {
45
        return $this->steps;
46
    }
47
48
    /**
49
     * @param string $name
50
     * @return StepItem
51
     */
52
    public function getStep($name)
53
    {
54
        if (false === $this->hasStep($name)) {
55
            throw new \Exception('todo'); // @todo
56
        }
57
58
        return $this->steps[$name];
59
    }
60
61
    /**
62
     * @param string $name
63
     * @return bool
64
     */
65
    public function hasStep($name)
66
    {
67
        return isset($this->steps[$name]);
68
    }
69
70
    /**
71
     * @return StepItem
72
     */
73
    public function getDefaultStep()
74
    {
75
        return $this->getStep($this->settings->getDefaultStep());
76
    }
77
}
78