mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-11-25 06:00:28 +01:00
40 lines
No EOL
976 B
PHP
40 lines
No EOL
976 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace OCA\OrganizationFolders\OrganizationProvider;
|
|
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
|
use OCP\Server;
|
|
|
|
use OCA\OrganizationFolders\Events\RegisterOrganizationProviderEvent;
|
|
|
|
class OrganizationProviderManager {
|
|
private array $organizationProviders = [];
|
|
|
|
public function __construct(
|
|
IEventDispatcher $dispatcher,
|
|
) {
|
|
$event = new RegisterOrganizationProviderEvent($this);
|
|
$dispatcher->dispatchTyped($event);
|
|
}
|
|
|
|
/**
|
|
* @return OrganizationProvider[]
|
|
*/
|
|
public function getOrganizationProviders(): array {
|
|
return $this->organizationProviders;
|
|
}
|
|
|
|
/**
|
|
* @return OrganizationProvider
|
|
*/
|
|
public function getOrganizationProvider($id): ?OrganizationProvider {
|
|
return $this->organizationProviders[$id];
|
|
}
|
|
|
|
public function registerOrganizationProvider(OrganizationProvider $organizationProvider): self {
|
|
$this->organizationProviders[$organizationProvider->getId()] = $organizationProvider;
|
|
return $this;
|
|
}
|
|
} |