@@ -51,6 +51,19 @@ public function getContext()
5151 return $ this ->context ;
5252 }
5353
54+ /**
55+ * @param array|Completion $array
56+ */
57+ public function addHandlers ($ array )
58+ {
59+ $ this ->helpers = array_merge ($ this ->helpers , $ array );
60+ }
61+
62+ public function addHandler (Completion $ helper )
63+ {
64+ $ this ->helpers [] = $ helper ;
65+ }
66+
5467 /**
5568 * Do the actual completion, returning items delimited by spaces
5669 * @throws \RuntimeException
@@ -85,6 +98,20 @@ public function runCompletion()
8598 }
8699 }
87100
101+ /**
102+ * Get an InputInterface representation of the completion context
103+ * @return ArrayInput
104+ */
105+ public function getInput ()
106+ {
107+ // Filter the command line content to suit ArrayInput
108+ $ words = $ this ->context ->getWords ();
109+ array_shift ($ words );
110+ $ words = array_filter ($ words );
111+
112+ return new ArrayInput ($ words );
113+ }
114+
88115 /**
89116 * @return array
90117 */
@@ -207,20 +234,6 @@ protected function completeForCommandArgs()
207234 }
208235 }
209236
210- /**
211- * Turn the context's commandline into an input for an application
212- * @return ArrayInput
213- */
214- public function getInput ()
215- {
216- // Filter the command line content to suit ArrayInput
217- $ words = $ this ->context ->getWords ();
218- array_shift ($ words );
219- $ words = array_filter ($ words );
220-
221- return new ArrayInput ($ words );
222- }
223-
224237 /**
225238 * @param BaseCommand $cmd
226239 * @return bool|mixed
@@ -338,17 +351,4 @@ protected function getAllOptions(){
338351 $ this ->application ->getDefinition ()->getOptions ()
339352 );
340353 }
341-
342- /**
343- * @param array|Completion $array
344- */
345- public function addHandlers ($ array )
346- {
347- $ this ->helpers = array_merge ($ this ->helpers , $ array );
348- }
349-
350- public function addHandler (Completion $ helper )
351- {
352- $ this ->helpers [] = $ helper ;
353- }
354354}
0 commit comments