From 8d1b1b95ce928062250906c434f7d5aae29d8cb5 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 8 Oct 2014 23:31:42 +0200 Subject: move database check into seperate function --- config/appconfig.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/config/appconfig.php b/config/appconfig.php index ae8f268f5..52e82dc25 100644 --- a/config/appconfig.php +++ b/config/appconfig.php @@ -153,6 +153,15 @@ class AppConfig { } } + private function testDatabaseDependencies($databases, $databaseType) { + if(!in_array($databaseType, $databases)) { + return 'Database ' . $databaseType . ' not supported.' . + 'App is only compatible with ' . + implode(', ', $databases); + } else { + return ''; + } + } /** * Validates all dependencies that the app has @@ -163,11 +172,9 @@ class AppConfig { // test databases if(array_key_exists('databases', $this->config)) { - if(!in_array($this->databaseType, $this->config['databases'])) { - $msg .= 'Database ' . $this->databaseType . ' not supported.' . - 'App is only compatible with ' . - implode(', ', $this->config['databases']); - } + $msg .= $this->testDatabaseDependencies( + $this->config['databases'], $this->databaseType + ); } // test dependencies -- cgit v1.2.3