File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/Symfony/Component/Console/Question Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 18
18
*/
19
19
class ConfirmationQuestion extends Question
20
20
{
21
- public function __construct ($ question , $ default = true )
21
+ private $ trueAnswer ;
22
+
23
+ public function __construct ($ question , $ default = true , $ trueAnswer = 'y ' )
22
24
{
23
25
parent ::__construct ($ question , (bool ) $ default );
24
26
25
27
$ this ->setNormalizer ($ this ->getDefaultNormalizer ());
28
+ $ this ->trueAnswer = $ trueAnswer ;
26
29
}
27
30
28
31
private function getDefaultNormalizer ()
@@ -35,10 +38,10 @@ private function getDefaultNormalizer()
35
38
}
36
39
37
40
if (false === $ default ) {
38
- return $ answer && ' y ' === strtolower ($ answer [0 ]);
41
+ return $ answer && $ this -> trueAnswer === strtolower ($ answer [0 ]);
39
42
}
40
43
41
- return !$ answer || ' y ' === strtolower ($ answer [0 ]);
44
+ return !$ answer || $ this -> trueAnswer === strtolower ($ answer [0 ]);
42
45
};
43
46
}
44
47
}
You can’t perform that action at this time.
0 commit comments