File tree Expand file tree Collapse file tree 4 files changed +64
-0
lines changed
src/Symfony/Component/Console Expand file tree Collapse file tree 4 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ CHANGELOG
7
7
* Add support for choosing exit code while handling signal, or to not exit at all
8
8
* Add ` ProgressBar::setPlaceholderFormatter ` to set a placeholder attached to a instance, instead of being global.
9
9
* Add ` ReStructuredTextDescriptor `
10
+ * Add ` ExecuteCommand ` and ` ExecuteCommandHandler `
10
11
11
12
6.2
12
13
---
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony \Component \Console \Messenger ;
13
+
14
+ /**
15
+ * @author Kevin Bond <kevinbond@gmail.com>
16
+ */
17
+ final class ExecuteCommand
18
+ {
19
+ public function __construct (
20
+ public readonly array |string $ input ,
21
+ public readonly bool $ catchExceptions = false ,
22
+ ) {
23
+ }
24
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony \Component \Console \Messenger ;
13
+
14
+ use Symfony \Component \Console \Application ;
15
+ use Symfony \Component \Console \Input \ArrayInput ;
16
+ use Symfony \Component \Console \Input \StringInput ;
17
+ use Symfony \Component \Console \Output \BufferedOutput ;
18
+
19
+ /**
20
+ * @author Kevin Bond <kevinbond@gmail.com>
21
+ */
22
+ final class ExecuteCommandHandler
23
+ {
24
+ public function __construct (private readonly Application $ application )
25
+ {
26
+ }
27
+
28
+ public function __invoke (ExecuteCommand $ message ): BufferedOutput
29
+ {
30
+ $ input = is_array ($ message ->input ) ? new ArrayInput ($ message ->input ) : new StringInput ($ message ->input );
31
+ $ output = new BufferedOutput ();
32
+
33
+ $ this ->application ->setCatchExceptions ($ message ->catchExceptions );
34
+ $ this ->application ->run ($ input , $ output );
35
+
36
+ return $ output ;
37
+ }
38
+ }
Original file line number Diff line number Diff line change 27
27
"symfony/event-dispatcher" : " ^5.4|^6.0" ,
28
28
"symfony/dependency-injection" : " ^5.4|^6.0" ,
29
29
"symfony/lock" : " ^5.4|^6.0" ,
30
+ "symfony/messenger" : " ^6.3" ,
30
31
"symfony/process" : " ^5.4|^6.0" ,
31
32
"symfony/var-dumper" : " ^5.4|^6.0" ,
32
33
"psr/log" : " ^1|^2|^3"
You can’t perform that action at this time.
0 commit comments