From 5f1f05fbe6b9bf8e0735f62915ff74566a55c266 Mon Sep 17 00:00:00 2001 From: Pasechnik Bogdan Date: Fri, 9 Oct 2020 12:38:39 +0300 Subject: [PATCH] add exception if app or project not found --- src/Registry/AppRegistry.php | 5 +++++ src/Registry/ProjectRegistry.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/Registry/AppRegistry.php b/src/Registry/AppRegistry.php index a0db806..f88d0ae 100644 --- a/src/Registry/AppRegistry.php +++ b/src/Registry/AppRegistry.php @@ -47,6 +47,11 @@ public function has(string $appName): bool public function get(string $appName): AppInterface { + if(!$this->has($appName)) { + throw new \InvalidArgumentException( + sprintf('App "%s" does not exist', $appName) + ); + } return $this->apps[$appName]; } } diff --git a/src/Registry/ProjectRegistry.php b/src/Registry/ProjectRegistry.php index 3e1b1fa..1b4e9a3 100644 --- a/src/Registry/ProjectRegistry.php +++ b/src/Registry/ProjectRegistry.php @@ -51,6 +51,11 @@ public function has(string $projectName): bool public function get(string $projectName): ProjectInterface { + if(!$this->has($projectName)) { + throw new \InvalidArgumentException( + sprintf('Project "%s" does not exist', $projectName) + ); + } return $this->projects[$projectName]; } }