diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-08-04 15:20:05 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-08-05 17:03:38 +0200 |
commit | 018be662f4df89345b528382ab300269d4a88048 (patch) | |
tree | 474a64e9a86f1070f7aeacf947334a1922655d58 /lib/private/Dashboard | |
parent | 6accf4d857b4233cff698e602041a5126a57e940 (diff) | |
download | nextcloud-server-018be662f4df89345b528382ab300269d4a88048.tar.gz nextcloud-server-018be662f4df89345b528382ab300269d4a88048.zip |
Refactor API to match the widget wording
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Dashboard')
-rw-r--r-- | lib/private/Dashboard/Manager.php | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index 0c285a8b53d..fda4c8b3893 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -29,7 +29,7 @@ namespace OC\Dashboard; use InvalidArgumentException; use OCP\AppFramework\QueryException; use OCP\Dashboard\IManager; -use OCP\Dashboard\IPanel; +use OCP\Dashboard\IWidget; use OCP\ILogger; use OCP\IServerContainer; use Throwable; @@ -37,10 +37,10 @@ use Throwable; class Manager implements IManager { /** @var array */ - private $lazyPanels = []; + private $lazyWidgets = []; - /** @var IPanel[] */ - private $panels = []; + /** @var IWidget[] */ + private $widgets = []; /** @var IServerContainer */ private $serverContainer; @@ -49,31 +49,31 @@ class Manager implements IManager { $this->serverContainer = $serverContainer; } - private function registerPanel(IPanel $panel): void { - if (array_key_exists($panel->getId(), $this->panels)) { - throw new InvalidArgumentException('Dashboard panel with this id has already been registered'); + private function registerWidget(IWidget $widget): void { + if (array_key_exists($widget->getId(), $this->widgets)) { + throw new InvalidArgumentException('Dashboard widget with this id has already been registered'); } - $this->panels[$panel->getId()] = $panel; + $this->widgets[$widget->getId()] = $widget; } - public function lazyRegisterPanel(string $panelClass): void { - $this->lazyPanels[] = $panelClass; + public function lazyRegisterWidget(string $widgetClass): void { + $this->lazyWidgets[] = $widgetClass; } public function loadLazyPanels(): void { - $classes = $this->lazyPanels; + $classes = $this->lazyWidgets; foreach ($classes as $class) { try { - /** @var IPanel $panel */ - $panel = $this->serverContainer->query($class); + /** @var IWidget $widget */ + $widget = $this->serverContainer->query($class); } catch (QueryException $e) { /* * There is a circular dependency between the logger and the registry, so * we can not inject it. Thus the static call. */ \OC::$server->getLogger()->logException($e, [ - 'message' => 'Could not load lazy dashbaord panel: ' . $e->getMessage(), + 'message' => 'Could not load lazy dashbaord widget: ' . $e->getMessage(), 'level' => ILogger::FATAL, ]); } @@ -82,32 +82,32 @@ class Manager implements IManager { * type, so we might get a TypeError here that we should catch. */ try { - $this->registerPanel($panel); + $this->registerWidget($widget); } catch (Throwable $e) { /* * There is a circular dependency between the logger and the registry, so * we can not inject it. Thus the static call. */ \OC::$server->getLogger()->logException($e, [ - 'message' => 'Could not register lazy dashboard panel: ' . $e->getMessage(), + 'message' => 'Could not register lazy dashboard widget: ' . $e->getMessage(), 'level' => ILogger::FATAL, ]); } try { - $panel->load(); + $widget->load(); } catch (Throwable $e) { \OC::$server->getLogger()->logException($e, [ - 'message' => 'Error during dashboard panel loading: ' . $e->getMessage(), + 'message' => 'Error during dashboard widget loading: ' . $e->getMessage(), 'level' => ILogger::FATAL, ]); } } - $this->lazyPanels = []; + $this->lazyWidgets = []; } - public function getPanels(): array { + public function getWidgets(): array { $this->loadLazyPanels(); - return $this->panels; + return $this->widgets; } } |