From ad55e6ede5fab449c91aced8c1a42ae4ee7b809c Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 17 Oct 2015 22:31:04 -0400 Subject: Remove exit expression in database provider --- app/Core/Base.php | 2 ++ app/Model/NotificationType.php | 2 +- app/Model/UserMetadata.php | 2 +- app/ServiceProvider/DatabaseProvider.php | 9 ++++----- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/Core/Base.php b/app/Core/Base.php index b7be45d1..d402fb37 100644 --- a/app/Core/Base.php +++ b/app/Core/Base.php @@ -56,6 +56,8 @@ use Pimple\Container; * @property \Kanboard\Model\ProjectDailyStats $projectDailyStats * @property \Kanboard\Model\ProjectMetadata $projectMetadata * @property \Kanboard\Model\ProjectPermission $projectPermission + * @property \Kanboard\Model\ProjectNotification $projectNotification + * @property \Kanboard\Model\ProjectNotificationType $projectNotificationType * @property \Kanboard\Model\Subtask $subtask * @property \Kanboard\Model\SubtaskExport $subtaskExport * @property \Kanboard\Model\SubtaskTimeTracking $subtaskTimeTracking diff --git a/app/Model/NotificationType.php b/app/Model/NotificationType.php index bc9c6fdc..9d8317b7 100644 --- a/app/Model/NotificationType.php +++ b/app/Model/NotificationType.php @@ -120,7 +120,7 @@ abstract class NotificationType extends Base { $classes = $this->classes; - return array_filter($types, function($type) use ($classes) { + return array_filter($types, function ($type) use ($classes) { return isset($classes[$type]); }); } diff --git a/app/Model/UserMetadata.php b/app/Model/UserMetadata.php index 6f1222e2..411837bd 100644 --- a/app/Model/UserMetadata.php +++ b/app/Model/UserMetadata.php @@ -27,4 +27,4 @@ class UserMetadata extends Metadata { return 'user_id'; } -} \ No newline at end of file +} diff --git a/app/ServiceProvider/DatabaseProvider.php b/app/ServiceProvider/DatabaseProvider.php index 43c4b813..b2115644 100644 --- a/app/ServiceProvider/DatabaseProvider.php +++ b/app/ServiceProvider/DatabaseProvider.php @@ -2,6 +2,8 @@ namespace Kanboard\ServiceProvider; +use LogicException; +use RuntimeException; use Pimple\Container; use Pimple\ServiceProviderInterface; use PicoDb\Database; @@ -27,24 +29,21 @@ class DatabaseProvider implements ServiceProviderInterface case 'sqlite': $db = $this->getSqliteInstance(); break; - case 'mysql': $db = $this->getMysqlInstance(); break; - case 'postgres': $db = $this->getPostgresInstance(); break; - default: - die('Database driver not supported'); + throw new LogicException('Database driver not supported'); } if ($db->schema()->check(\Schema\VERSION)) { return $db; } else { $errors = $db->getLogMessages(); - die('Unable to migrate database schema:

'.(isset($errors[0]) ? $errors[0] : 'Unknown error').''); + throw new RuntimeException('Unable to migrate database schema: '.(isset($errors[0]) ? $errors[0] : 'Unknown error')); } } -- cgit v1.2.3