change transports registration to save as dict items by id instead of array
This commit is contained in:
parent
05bbfe100d
commit
9f15e091e1
1 changed files with 8 additions and 4 deletions
|
@ -32,9 +32,6 @@ use OCA\DavPush\Events\RegisterTransportsEvent;
|
||||||
use OCA\DavPush\PushTransports\WebPushTransport;
|
use OCA\DavPush\PushTransports\WebPushTransport;
|
||||||
|
|
||||||
class TransportManager {
|
class TransportManager {
|
||||||
/**
|
|
||||||
* @var Transport[]
|
|
||||||
*/
|
|
||||||
private array $transports = [];
|
private array $transports = [];
|
||||||
|
|
||||||
public function __construct(IEventDispatcher $dispatcher) {
|
public function __construct(IEventDispatcher $dispatcher) {
|
||||||
|
@ -53,8 +50,15 @@ class TransportManager {
|
||||||
return $this->transports;
|
return $this->transports;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Transport
|
||||||
|
*/
|
||||||
|
public function getTransport($id): ?Transport {
|
||||||
|
return $this->transports[$id];
|
||||||
|
}
|
||||||
|
|
||||||
public function registerTransport(Transport $transport): self {
|
public function registerTransport(Transport $transport): self {
|
||||||
$this->transports[] = $transport;
|
$this->transports[$transport->getId()] = $transport;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue