1 | <?php namespace nyx\console; |
||
21 | abstract class Descriptor implements interfaces\Descriptor |
||
22 | { |
||
23 | /** |
||
24 | * @var array A map of supported types to their respective instance methods, minus the 'describe' prefix. |
||
25 | */ |
||
26 | protected $types = [ |
||
27 | Application::class => 'Application', |
||
28 | Suite::class => 'Suite', |
||
29 | Command::class => 'Command', |
||
30 | input\Definition::class => 'InputDefinition', |
||
31 | input\Argument::class => 'InputArgument', |
||
32 | input\Option::class => 'InputOption', |
||
33 | input\Value::class => 'InputValue', |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public function describe($object, array $options = null) |
||
49 | |||
50 | /** |
||
51 | * Describes an Application. |
||
52 | * |
||
53 | * @param Application $application The Application to describe. |
||
54 | * @param array $options Additional options to be considered by the Descriptor. |
||
55 | * @return mixed |
||
56 | */ |
||
57 | abstract public function describeApplication(Application $application, array $options = null); |
||
58 | |||
59 | /** |
||
60 | * Describes a Suite. |
||
61 | * |
||
62 | * @param Suite $suite The Suite to describe. |
||
63 | * @param array $options Additional options to be considered by the Descriptor. |
||
64 | * @return mixed |
||
65 | */ |
||
66 | abstract public function describeSuite(Suite $suite, array $options = null); |
||
67 | |||
68 | /** |
||
69 | * Describes a Command. |
||
70 | * |
||
71 | * @param Command $command The Command to describe. |
||
72 | * @param array $options Additional options to be considered by the Descriptor. |
||
73 | * @return mixed |
||
74 | */ |
||
75 | abstract public function describeCommand(Command $command, array $options = null); |
||
76 | |||
77 | /** |
||
78 | * Describes an Input Definition. |
||
79 | * |
||
80 | * @param input\Definition $definition The Input Definition to describe. |
||
81 | * @param array $options Additional options to be considered by the Descriptor. |
||
82 | * @return mixed |
||
83 | */ |
||
84 | abstract public function describeInputDefinition(input\Definition $definition, array $options = null); |
||
85 | |||
86 | /** |
||
87 | * Describes an Input Argument. |
||
88 | * |
||
89 | * @param input\Argument $argument The Input Argument to describe. |
||
90 | * @param array $options Additional options to be considered by the Descriptor. |
||
91 | * @return mixed |
||
92 | */ |
||
93 | abstract public function describeInputArgument(input\Argument $argument, array $options = null); |
||
94 | |||
95 | /** |
||
96 | * Describes an Input Option. |
||
97 | * |
||
98 | * @param input\Option $option The Input Option to describe. |
||
99 | * @param array $options Additional options to be considered by the Descriptor. |
||
100 | * @return mixed |
||
101 | */ |
||
102 | abstract public function describeInputOption(input\Option $option, array $options = null); |
||
103 | |||
104 | /** |
||
105 | * Describes an Input Value. |
||
106 | * |
||
107 | * @param input\Value $value The Input Value to describe. |
||
108 | * @param array $options Additional options to be considered by the Descriptor. |
||
109 | * @return mixed |
||
110 | */ |
||
111 | abstract public function describeInputValue(input\Value $value, array $options = null); |
||
112 | |||
113 | /** |
||
114 | * Provides a synopsis (ie. a string describing the usage) for the given Command. |
||
115 | * |
||
116 | * Kept in the abstract Descriptor as the generated string is rather generic, but may require overrides for |
||
117 | * specific formats and therefore should not be kept within the Command class. |
||
118 | * |
||
119 | * @param Command $command The Command to provide the synopsis for. |
||
120 | * @return mixed |
||
121 | */ |
||
122 | public function getCommandSynopsis(Command $command, array $options = null) |
||
138 | |||
139 | /** |
||
140 | * Provides a synopsis for the given Input Option Definitions. |
||
141 | * |
||
142 | * @param definitions\Options $definitions The Input Option Definitions to provide a synopsis for. |
||
143 | * @param array $options Additional options to be considered by the Descriptor. |
||
144 | * @return mixed |
||
145 | */ |
||
146 | public function getInputOptionsSynopsis(definitions\Options $definitions, array $options = null) |
||
166 | |||
167 | /** |
||
168 | * Provides a synopsis for the given Input Option. |
||
169 | * |
||
170 | * @param input\Option $definition The Input Option to provide a synopsis for. |
||
171 | * @param array $options Additional options to be considered by the Descriptor. |
||
172 | * @return mixed |
||
173 | */ |
||
174 | public function getInputOptionSynopsis(input\Option $definition, array $options = null) |
||
186 | |||
187 | /** |
||
188 | * Provides a synopsis for the given Input Argument Definitions. |
||
189 | * |
||
190 | * @param definitions\Arguments $definitions The Input Argument Definitions to provide a synopsis for. |
||
191 | * @param array $options Additional options to be considered by the Descriptor. |
||
192 | * @return mixed |
||
193 | */ |
||
194 | public function getInputArgumentsSynopsis(definitions\Arguments $definitions, array $options = null) |
||
209 | |||
210 | /** |
||
211 | * Provides a synopsis for the given Input Argument. |
||
212 | * |
||
213 | * @param input\Argument $definition The Input Argument to provide a synopsis for. |
||
214 | * @param array $options Additional options to be considered by the Descriptor. |
||
215 | * @return mixed |
||
216 | */ |
||
217 | public function getInputArgumentSynopsis(input\Argument $definition, array $options = null) |
||
234 | } |
||
235 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.