src/Channel/ChannelMap.php 1 location
|
@@ 7-21 (lines=15) @@
|
| 4 |
|
|
| 5 |
|
use Daikon\DataStructures\TypedMapTrait; |
| 6 |
|
|
| 7 |
|
final class ChannelMap implements \IteratorAggregate, \Countable |
| 8 |
|
{ |
| 9 |
|
use TypedMapTrait; |
| 10 |
|
|
| 11 |
|
/** |
| 12 |
|
* @param ChannelInterface[] $channels |
| 13 |
|
*/ |
| 14 |
|
public function __construct(array $channels = []) |
| 15 |
|
{ |
| 16 |
|
$this->init(array_reduce($channels, function (array $carry, ChannelInterface $channel) { |
| 17 |
|
$carry[$channel->getKey()] = $channel; // enforce consistent channel keys |
| 18 |
|
return $carry; |
| 19 |
|
}, []), ChannelInterface::CLASS); |
| 20 |
|
} |
| 21 |
|
} |
| 22 |
|
|
src/Channel/Subscription/SubscriptionMap.php 1 location
|
@@ 7-21 (lines=15) @@
|
| 4 |
|
|
| 5 |
|
use Daikon\DataStructures\TypedMapTrait; |
| 6 |
|
|
| 7 |
|
final class SubscriptionMap implements \IteratorAggregate, \Countable |
| 8 |
|
{ |
| 9 |
|
use TypedMapTrait; |
| 10 |
|
|
| 11 |
|
/** |
| 12 |
|
* @param SubscriptionInterface[] $subscriptions |
| 13 |
|
*/ |
| 14 |
|
public function __construct(array $subscriptions = []) |
| 15 |
|
{ |
| 16 |
|
$this->init(array_reduce($subscriptions, function (array $carry, SubscriptionInterface $subscription) { |
| 17 |
|
$carry[$subscription->getKey()] = $subscription; // enforce consistent channel keys |
| 18 |
|
return $carry; |
| 19 |
|
}, []), SubscriptionInterface::CLASS); |
| 20 |
|
} |
| 21 |
|
} |
| 22 |
|
|
src/Channel/Subscription/Transport/TransportMap.php 1 location
|
@@ 7-21 (lines=15) @@
|
| 4 |
|
|
| 5 |
|
use Daikon\DataStructures\TypedMapTrait; |
| 6 |
|
|
| 7 |
|
final class TransportMap implements \IteratorAggregate, \Countable |
| 8 |
|
{ |
| 9 |
|
use TypedMapTrait; |
| 10 |
|
|
| 11 |
|
/** |
| 12 |
|
* @param TransportInterface[] $transports |
| 13 |
|
*/ |
| 14 |
|
public function __construct(array $transports = []) |
| 15 |
|
{ |
| 16 |
|
$this->init(array_reduce($transports, function (array $carry, TransportInterface $transport) { |
| 17 |
|
$carry[$transport->getKey()] = $transport; // enforce consistent channel keys |
| 18 |
|
return $carry; |
| 19 |
|
}, []), TransportInterface::CLASS); |
| 20 |
|
} |
| 21 |
|
} |
| 22 |
|
|