From 94c1cb9798063d35bab1460e30b6535f7ac8e372 Mon Sep 17 00:00:00 2001 From: Leon Stam Date: Mon, 30 Sep 2019 14:54:25 +0200 Subject: [PATCH 1/2] Reuse the Bugsnag Configuration if it already has been created --- Helper/Config.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Helper/Config.php b/Helper/Config.php index b59d8fd..87ae95b 100644 --- a/Helper/Config.php +++ b/Helper/Config.php @@ -63,7 +63,9 @@ public function __construct( */ public function getConfiguration() { - if(isset($this->bugsnagConfig) && is_array($this->bugsnagConfig)) { + if ($this->config instanceof Configuration) { + return $this->config; + } else if(isset($this->bugsnagConfig) && is_array($this->bugsnagConfig)) { $apiKey = $this->getApiKey(); $releaseStage = $this->getReleaseStage(); if ($apiKey) { From 1857b0445503e0156d2a32312542f906bc24d1e0 Mon Sep 17 00:00:00 2001 From: Leon Stam Date: Mon, 30 Sep 2019 14:55:08 +0200 Subject: [PATCH 2/2] There is no reason to fetch the release stage when there is no API key --- Helper/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Helper/Config.php b/Helper/Config.php index 87ae95b..2e18adb 100644 --- a/Helper/Config.php +++ b/Helper/Config.php @@ -67,9 +67,9 @@ public function getConfiguration() return $this->config; } else if(isset($this->bugsnagConfig) && is_array($this->bugsnagConfig)) { $apiKey = $this->getApiKey(); - $releaseStage = $this->getReleaseStage(); if ($apiKey) { $this->config = new Configuration($apiKey); + $releaseStage = $this->getReleaseStage(); if ($releaseStage) { $this->config->setReleaseStage($releaseStage); }