summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2018-10-08 01:50:17 +0200
committerGeorg Ehrke <developer@georgehrke.com>2018-10-08 01:50:17 +0200
commit970242b6ca79a0dbb1ac1a868c7b82c7aa49bd8a (patch)
tree0d7eee48a5f62670d008b174012ee5dc896f104e /lib
parent1c6f666bbfc46b9092312c81f82a5e0cbe59fc18 (diff)
downloadnextcloud-server-970242b6ca79a0dbb1ac1a868c7b82c7aa49bd8a.tar.gz
nextcloud-server-970242b6ca79a0dbb1ac1a868c7b82c7aa49bd8a.zip
RoomManager/ResourceManager: Inject IServerContainer instead of using OC Server
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Calendar/Resource/Manager.php15
-rw-r--r--lib/private/Calendar/Room/Manager.php15
2 files changed, 28 insertions, 2 deletions
diff --git a/lib/private/Calendar/Resource/Manager.php b/lib/private/Calendar/Resource/Manager.php
index 04ef69d69ea..224ca2a4390 100644
--- a/lib/private/Calendar/Resource/Manager.php
+++ b/lib/private/Calendar/Resource/Manager.php
@@ -24,9 +24,13 @@
namespace OC\Calendar\Resource;
use OCP\Calendar\Resource\IBackend;
+use OCP\IServerContainer;
class Manager implements \OCP\Calendar\Resource\IManager {
+ /** @var IServerContainer */
+ private $server;
+
/** @var string[] holds all registered resource backends */
private $backends = [];
@@ -34,6 +38,15 @@ class Manager implements \OCP\Calendar\Resource\IManager {
private $initializedBackends = [];
/**
+ * Manager constructor.
+ *
+ * @param IServerContainer $server
+ */
+ public function __construct(IServerContainer $server) {
+ $this->server = $server;
+ }
+
+ /**
* Registers a resource backend
*
* @param string $backendClass
@@ -66,7 +79,7 @@ class Manager implements \OCP\Calendar\Resource\IManager {
continue;
}
- $this->initializedBackends[$backend] = \OC::$server->query($backend);
+ $this->initializedBackends[$backend] = $this->server->query($backend);
}
return array_values($this->initializedBackends);
diff --git a/lib/private/Calendar/Room/Manager.php b/lib/private/Calendar/Room/Manager.php
index 8664149549d..d73b52cfb16 100644
--- a/lib/private/Calendar/Room/Manager.php
+++ b/lib/private/Calendar/Room/Manager.php
@@ -24,9 +24,13 @@
namespace OC\Calendar\Room;
use OCP\Calendar\Room\IBackend;
+use OCP\IServerContainer;
class Manager implements \OCP\Calendar\Room\IManager {
+ /** @var IServerContainer */
+ private $server;
+
/** @var string[] holds all registered resource backends */
private $backends = [];
@@ -34,6 +38,15 @@ class Manager implements \OCP\Calendar\Room\IManager {
private $initializedBackends = [];
/**
+ * Manager constructor.
+ *
+ * @param IServerContainer $server
+ */
+ public function __construct(IServerContainer $server) {
+ $this->server = $server;
+ }
+
+ /**
* Registers a resource backend
*
* @param string $backendClass
@@ -66,7 +79,7 @@ class Manager implements \OCP\Calendar\Room\IManager {
continue;
}
- $this->initializedBackends[$backend] = \OC::$server->query($backend);
+ $this->initializedBackends[$backend] = $this->server->query($backend);
}
return array_values($this->initializedBackends);