This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
/
BaseCommand.txt
66 lines (42 loc) · 2.07 KB
/
BaseCommand.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
------------------------
Baleen\\Cli\\BaseCommand
------------------------
.. php:namespace: Baleen\\Cli
.. php:class:: BaseCommand
The base Command class used to build all the command definitions for the Application.
.. php:attr:: container
protected Container
.. php:attr:: commandBus
protected CommandBus
A reference to the CommandBus in charge of handling Messages.
.. php:attr:: serviceAlias
protected string
.. php:attr:: serviceClass
protected string
.. php:method:: __construct(ContainerInterface $container, $serviceAlias, $serviceClass)
:type $container: ContainerInterface
:param $container: A reference to the Application's Container.
:type $serviceAlias: string
:param $serviceAlias: The key in the Container for the command that the instance of this class represents.
:type $serviceClass: string
:param $serviceClass: Needed in order to run certain checks against the class before instantiating it with the container. This helps us make those checks without triggering all the other services through the Container's DI functionality.
.. php:method:: getContainer()
:returns: Container
.. php:method:: getCommandBus()
getCommandBus.
:returns: CommandBus
.. php:method:: execute(InputInterface $input, OutputInterface $output)
Executes the current command by retrieving its associated Message from the
Container, setting the Input and
Output according to what was received as parameters, and finally passing
that Message to the CommandBus for
handling.
:type $input: InputInterface
:param $input: An InputInterface instance
:type $output: OutputInterface
:param $output: An OutputInterface instance
:returns: int|null null or 0 if everything went fine, or an error code
.. php:method:: configure()
Calls the message's static "configure" public function passing $this as
argument to allow the message to
configure the command.