2
2
3
3
namespace Matthias \SymfonyConsoleForm \Bridge \Interaction ;
4
4
5
- use Matthias \SymfonyConsoleForm \Console \ Formatter \ Format ;
5
+ use Matthias \SymfonyConsoleForm \Bridge \ Interaction \ Exception \ CanNotInteractWithForm ;
6
6
use Matthias \SymfonyConsoleForm \Bridge \Interaction \Exception \FormNotReadyForInteraction ;
7
+ use Matthias \SymfonyConsoleForm \Console \Formatter \Format ;
7
8
use Matthias \SymfonyConsoleForm \Form \FormUtil ;
8
- use Matthias \SymfonyConsoleForm \Bridge \Interaction \Exception \CanNotInteractWithForm ;
9
9
use Symfony \Component \Console \Helper \HelperSet ;
10
10
use Symfony \Component \Console \Helper \QuestionHelper ;
11
11
use Symfony \Component \Console \Input \InputInterface ;
15
15
16
16
class CollectionInteractor implements FormInteractor
17
17
{
18
+ /**
19
+ * @var FormInteractor
20
+ */
18
21
private $ formInteractor ;
19
22
23
+ /**
24
+ * @param FormInteractor $formInteractor
25
+ */
20
26
public function __construct (FormInteractor $ formInteractor )
21
27
{
22
28
$ this ->formInteractor = $ formInteractor ;
23
29
}
24
30
31
+ /**
32
+ * @param FormInterface $form
33
+ * @param HelperSet $helperSet
34
+ * @param InputInterface $input
35
+ * @param OutputInterface $output
36
+ *
37
+ * @throws CanNotInteractWithForm If the input isn't interactive.
38
+ * @throws FormNotReadyForInteraction If the "collection" form hasn't the option "allow_add".
39
+ *
40
+ * @return array
41
+ */
25
42
public function interactWith (
26
43
FormInterface $ form ,
27
44
HelperSet $ helperSet ,
@@ -52,6 +69,13 @@ public function interactWith(
52
69
return $ submittedData ;
53
70
}
54
71
72
+ /**
73
+ * @param HelperSet $helperSet
74
+ * @param InputInterface $input
75
+ * @param OutputInterface $output
76
+ *
77
+ * @return string
78
+ */
55
79
private function askIfContinueToAdd (
56
80
HelperSet $ helperSet ,
57
81
InputInterface $ input ,
@@ -68,20 +92,26 @@ private function askIfContinueToAdd(
68
92
}
69
93
70
94
/**
95
+ * @param HelperSet $helperSet
96
+ *
71
97
* @return QuestionHelper
72
98
*/
73
99
private function questionHelper (HelperSet $ helperSet )
74
100
{
75
101
return $ helperSet ->get ('question ' );
76
102
}
77
103
104
+ /**
105
+ * @param FormInterface $form
106
+ * @param OutputInterface $output
107
+ */
78
108
private function printHeader (FormInterface $ form , OutputInterface $ output )
79
109
{
80
110
$ output ->writeln (
81
111
strtr (
82
112
'<fieldset>{label}</fieldset> ' ,
83
113
[
84
- '{label} ' => FormUtil::label ($ form )
114
+ '{label} ' => FormUtil::label ($ form ),
85
115
]
86
116
)
87
117
);
0 commit comments