|
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
|
|
|
use Romm\Formz\Configuration\Form\Step\Step\Step; |
|
18
|
|
|
use Romm\Formz\Configuration\Form\Step\Step\StepDefinition; |
|
19
|
|
|
|
|
20
|
|
|
class Steps extends AbstractFormzConfiguration |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @var \Romm\Formz\Configuration\Form\Step\Settings |
|
24
|
|
|
* @validate NotEmpty |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $settings; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var \Romm\Formz\Configuration\Form\Step\Step\Step[] |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $entries; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var \Romm\Formz\Configuration\Form\Step\Step\StepDefinition |
|
35
|
|
|
* @validate NotEmpty |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $firstStep; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @return Settings |
|
41
|
|
|
*/ |
|
42
|
|
|
public function getSettings() |
|
43
|
|
|
{ |
|
44
|
|
|
return $this->settings; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @return bool |
|
49
|
|
|
*/ |
|
50
|
|
|
public function hasSteps() |
|
51
|
|
|
{ |
|
52
|
|
|
return null !== $this->firstStep; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @return StepDefinition |
|
57
|
|
|
*/ |
|
58
|
|
|
public function getFirstStepDefinition() |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->firstStep; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @return Step[] |
|
65
|
|
|
*/ |
|
66
|
|
|
public function getEntries() |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->entries; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @param string $name |
|
73
|
|
|
* @return Step |
|
74
|
|
|
*/ |
|
75
|
|
|
public function getEntry($name) |
|
76
|
|
|
{ |
|
77
|
|
|
if (false === $this->hasEntry($name)) { |
|
78
|
|
|
throw new \Exception('todo'); // @todo |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
return $this->entries[$name]; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @param string $name |
|
86
|
|
|
* @return bool |
|
87
|
|
|
*/ |
|
88
|
|
|
public function hasEntry($name) |
|
89
|
|
|
{ |
|
90
|
|
|
return isset($this->entries[$name]); |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|