diff --git a/bin/drupal.php b/bin/drupal.php index 9bbba07bc..99b3314d7 100644 --- a/bin/drupal.php +++ b/bin/drupal.php @@ -63,6 +63,9 @@ exit(1); } -$application = new Application($container); +if (!isset($launcherVersion)) + $launcherVersion = FALSE; + +$application = new Application($container, $launcherVersion); $application->setDefaultCommand('about'); $application->run(); diff --git a/src/Application.php b/src/Application.php index 8bf741c7c..4bf664a6a 100644 --- a/src/Application.php +++ b/src/Application.php @@ -27,11 +27,54 @@ class Application extends BaseApplication */ const VERSION = '1.0.0-rc18'; - public function __construct(ContainerInterface $container) + /** + * @var string + */ + private $launcherVersion; + + public function __construct(ContainerInterface $container, $launcherVersion = FALSE) { + $this->setLauncherVersion($launcherVersion); parent::__construct($container, $this::NAME, $this::VERSION); } + /** + * Returns the long version of the application. + * + * @return string The long application version + */ + public function getLongVersion() + { + $output = ''; + + if ($this->launcherVersion) { + $output .= sprintf('%s version %s', $this->getName() . ' Launcher', $this->getLauncherVersion()); + $output .= PHP_EOL; + } + + if ('UNKNOWN' !== $this->getName()) { + if ('UNKNOWN' !== $this->getVersion()) { + $output .= sprintf('%s version %s', $this->getName(), $this->getVersion()); + } + else { + $output .= sprintf('%s', $this->getName()); + } + } + else { + $output .= 'Console Tool'; + } + + return $output; + } + + public function setLauncherVersion ($launcherVersion) { + $this->launcherVersion = $launcherVersion; + } + + public function getLauncherVersion ($launcherVersion) { + return $this->launcherVersion; + } + /** * {@inheritdoc} */