0
0
Fork 0
mirror of https://github.com/verdigado/organization_folders.git synced 2024-11-22 12:40:28 +01:00
organization_folders/lib/OrganisationProvider/OrganisationProviderManager.php

40 lines
976 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace OCA\OrganizationFolders\OrganisationProvider;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Server;
use OCA\OrganizationFolders\Events\RegisterOrganisationProviderEvent;
class OrganisationProviderManager {
private array $organisationProviders = [];
public function __construct(
IEventDispatcher $dispatcher,
) {
$event = new RegisterOrganisationProviderEvent($this);
$dispatcher->dispatchTyped($event);
}
/**
* @return OrganisationProvider[]
*/
public function getOrganisationProviders(): array {
return $this->organisationProviders;
}
/**
* @return OrganisationProvider
*/
public function getOrganisationProvider($id): ?OrganisationProvider {
return $this->organisationProviders[$id];
}
public function registerOrganisationProvider(OrganisationProvider $organisationProvider): self {
$this->organisationProviders[$organisationProvider->getId()] = $organisationProvider;
return $this;
}
}