/** * Constructs an instance of this class. * * @param Message $message * @param IdentifierGenerator $generator */ public function __construct(Message $message, IdentifierGenerator $generator) { $this->message = $message; if ($this->message->getQosLevel() > 0) { $this->identifier = $generator->generatePacketID(); } }
/** * Constructs an instance of this class. * * @param Subscription[] $subscriptions * @param IdentifierGenerator $generator */ public function __construct(array $subscriptions, IdentifierGenerator $generator) { $this->subscriptions = array_values($subscriptions); $this->identifier = $generator->generatePacketID(); }