From fc6020b2c8f133052b82dd49337fbb3f2f480ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 23 Feb 2016 16:41:38 +0100 Subject: Enhance requirements in InstallCommand --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 39 +++++++++++----------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 84bd51fa..f1111cce 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -26,6 +26,14 @@ class InstallCommand extends ContainerAwareCommand */ protected $defaultOutput; + /** + * @var array + */ + protected $requirements = [ + 'pcre', + 'DOM', + ]; + protected function configure() { $this @@ -65,27 +73,18 @@ class InstallCommand extends ContainerAwareCommand $fulfilled = true; - $label = 'PCRE'; - if (extension_loaded('pcre')) { - $status = 'OK!'; - $help = ''; - } else { - $fulfilled = false; - $status = 'ERROR!'; - $help = 'You should enabled PCRE extension'; - } - $rows[] = array($label, $status, $help); - - $label = 'DOM'; - if (extension_loaded('DOM')) { - $status = 'OK!'; - $help = ''; - } else { - $fulfilled = false; - $status = 'ERROR!'; - $help = 'You should enabled DOM extension'; + foreach ($this->requirements as $requirement) { + $label = ''.strtoupper($requirement).''; + if (extension_loaded($requirement)) { + $status = 'OK!'; + $help = ''; + } else { + $fulfilled = false; + $status = 'ERROR!'; + $help = 'You should enabled '.$requirement.' extension'; + } + $rows[] = array($label, $status, $help); } - $rows[] = array($label, $status, $help); $table = new Table($this->defaultOutput); $table -- cgit v1.2.3