Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F847766
D138.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 19, 5:38 PM
Size
8 KB
Mime Type
text/x-diff
Expires
Sun, Apr 20, 5:38 PM (13 m, 41 s)
Engine
blob
Format
Raw Data
Handle
602560
Attached To
D138: INP-1485 - Create "AbstractCommand::initDependencies" method
D138.diff
View Options
Index: branches/5.3.x/core/install/cache/class_structure.php
===================================================================
--- branches/5.3.x/core/install/cache/class_structure.php
+++ branches/5.3.x/core/install/cache/class_structure.php
@@ -846,6 +846,7 @@
'extends' => array(
0 => 'Symfony\\Component\\Console\\Command\\Command',
1 => 'InPortal\\Core\\kernel\\Console\\Command\\IConsoleCommand',
+ 2 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
),
),
'InPortal\\Core\\kernel\\Console\\Command\\BuildClassMapCommand' => array(
@@ -853,7 +854,6 @@
'modifiers' => 0,
'extends' => array(
0 => 'InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand',
- 1 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
),
),
'InPortal\\Core\\kernel\\Console\\Command\\CompletionCommand' => array(
@@ -879,7 +879,6 @@
'modifiers' => 0,
'extends' => array(
0 => 'InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand',
- 1 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
),
),
'InPortal\\Core\\kernel\\Console\\Command\\RunScheduledTaskCommand' => array(
@@ -887,7 +886,6 @@
'modifiers' => 0,
'extends' => array(
0 => 'InPortal\\Core\\kernel\\Console\\Command\\AbstractCommand',
- 1 => 'Stecman\\Component\\Symfony\\Console\\BashCompletion\\Completion\\CompletionAwareInterface',
),
),
'InPortal\\Core\\kernel\\Console\\ConsoleApplication' => array(
Index: branches/5.3.x/core/kernel/Console/Command/AbstractCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/AbstractCommand.php
+++ branches/5.3.x/core/kernel/Console/Command/AbstractCommand.php
@@ -16,6 +16,8 @@
use InPortal\Core\kernel\Console\ConsoleApplication;
+use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use InPortal\Core\kernel\Console\ConsoleIO;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Symfony\Component\Console\Input\InputInterface;
@@ -23,7 +25,7 @@
defined('FULL_PATH') or die('restricted access!');
-abstract class AbstractCommand extends SymfonyCommand implements IConsoleCommand
+abstract class AbstractCommand extends SymfonyCommand implements IConsoleCommand, CompletionAwareInterface
{
/**
@@ -66,6 +68,36 @@
}
/**
+ * Return possible values for the named option
+ *
+ * @param string $optionName Option name.
+ * @param CompletionContext $context Completion context.
+ *
+ * @return array
+ */
+ public function completeOptionValues($optionName, CompletionContext $context)
+ {
+ $this->initDependencies();
+
+ return array();
+ }
+
+ /**
+ * Return possible values for the named argument
+ *
+ * @param string $argumentName Argument name.
+ * @param CompletionContext $context Completion context.
+ *
+ * @return array
+ */
+ public function completeArgumentValues($argumentName, CompletionContext $context)
+ {
+ $this->initDependencies();
+
+ return array();
+ }
+
+ /**
* Perform additional validation of the input.
*
* @param InputInterface $input An InputInterface instance.
@@ -85,6 +117,18 @@
// Don't use factory because of "classmap:rebuild" command.
$this->io = new ConsoleIO($input, $output, $this->getHelperSet());
+
+ $this->initDependencies();
+ }
+
+ /**
+ * Initializes dependencies.
+ *
+ * @return void
+ */
+ protected function initDependencies()
+ {
+
}
}
Index: branches/5.3.x/core/kernel/Console/Command/BuildClassMapCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/BuildClassMapCommand.php
+++ branches/5.3.x/core/kernel/Console/Command/BuildClassMapCommand.php
@@ -16,7 +16,6 @@
use InPortal\Core\kernel\utility\ClassDiscovery\ClassMapBuilder;
-use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -24,7 +23,7 @@
defined('FULL_PATH') or die('restricted access!');
-class BuildClassMapCommand extends AbstractCommand implements CompletionAwareInterface
+class BuildClassMapCommand extends AbstractCommand
{
/**
@@ -101,11 +100,13 @@
*/
public function completeOptionValues($optionName, CompletionContext $context)
{
+ $suggestions = parent::completeOptionValues($optionName, $context);
+
if ( $optionName === 'module' ) {
return $this->getModules();
}
- return array();
+ return $suggestions;
}
/**
@@ -120,17 +121,4 @@
return array_diff($modules, array('In-Portal'));
}
- /**
- * Return possible values for the named argument.
- *
- * @param string $argumentName Argument name.
- * @param CompletionContext $context Completion context.
- *
- * @return array
- */
- public function completeArgumentValues($argumentName, CompletionContext $context)
- {
- return array();
- }
-
}
Index: branches/5.3.x/core/kernel/Console/Command/RunEventCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/RunEventCommand.php
+++ branches/5.3.x/core/kernel/Console/Command/RunEventCommand.php
@@ -15,7 +15,6 @@
namespace InPortal\Core\kernel\Console\Command;
-use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -23,7 +22,7 @@
defined('FULL_PATH') or die('restricted access!');
-class RunEventCommand extends AbstractCommand implements CompletionAwareInterface
+class RunEventCommand extends AbstractCommand
{
/**
@@ -62,19 +61,6 @@
}
/**
- * Return possible values for the named option
- *
- * @param string $optionName Option name.
- * @param CompletionContext $context Completion context.
- *
- * @return array
- */
- public function completeOptionValues($optionName, CompletionContext $context)
- {
- return array();
- }
-
- /**
* Return possible values for the named argument.
*
* @param string $argumentName Argument name.
@@ -84,6 +70,8 @@
*/
public function completeArgumentValues($argumentName, CompletionContext $context)
{
+ $suggestions = parent::completeArgumentValues($argumentName, $context);
+
if ( $argumentName === 'event_name' ) {
$event_name = $context->getCurrentWord();
@@ -120,7 +108,7 @@
return $suggestions;
}
- return array();
+ return $suggestions;
}
}
Index: branches/5.3.x/core/kernel/Console/Command/RunScheduledTaskCommand.php
===================================================================
--- branches/5.3.x/core/kernel/Console/Command/RunScheduledTaskCommand.php
+++ branches/5.3.x/core/kernel/Console/Command/RunScheduledTaskCommand.php
@@ -15,7 +15,6 @@
namespace InPortal\Core\kernel\Console\Command;
-use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -23,7 +22,7 @@
defined('FULL_PATH') or die('restricted access!');
-class RunScheduledTaskCommand extends AbstractCommand implements CompletionAwareInterface
+class RunScheduledTaskCommand extends AbstractCommand
{
/**
@@ -72,19 +71,6 @@
}
/**
- * Return possible values for the named option
- *
- * @param string $optionName Option name.
- * @param CompletionContext $context Completion context.
- *
- * @return array
- */
- public function completeOptionValues($optionName, CompletionContext $context)
- {
- return array();
- }
-
- /**
* Return possible values for the named argument.
*
* @param string $argumentName Argument name.
@@ -94,11 +80,13 @@
*/
public function completeArgumentValues($argumentName, CompletionContext $context)
{
+ $suggestions = parent::completeArgumentValues($argumentName, $context);
+
if ( $argumentName === 'scheduled_task_name' ) {
return $this->getScheduledTaskNames();
}
- return array();
+ return $suggestions;
}
/**
Event Timeline
Log In to Comment