init
This commit is contained in:
52
vendor/binsoul/net-mqtt/src/DefaultSubscription.php
vendored
Executable file
52
vendor/binsoul/net-mqtt/src/DefaultSubscription.php
vendored
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace BinSoul\Net\Mqtt;
|
||||
|
||||
/**
|
||||
* Provides a default implementation of the {@see Subscription} interface.
|
||||
*/
|
||||
class DefaultSubscription implements Subscription
|
||||
{
|
||||
/** @var string */
|
||||
private $filter;
|
||||
/** @var int */
|
||||
private $qosLevel;
|
||||
|
||||
/**
|
||||
* Constructs an instance of this class.
|
||||
*
|
||||
* @param string $filter
|
||||
* @param int $qosLevel
|
||||
*/
|
||||
public function __construct($filter, $qosLevel = 0)
|
||||
{
|
||||
$this->filter = $filter;
|
||||
$this->qosLevel = $qosLevel;
|
||||
}
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getQosLevel()
|
||||
{
|
||||
return $this->qosLevel;
|
||||
}
|
||||
|
||||
public function withFilter($filter)
|
||||
{
|
||||
$result = clone $this;
|
||||
$result->filter = $filter;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function withQosLevel($level)
|
||||
{
|
||||
$result = clone $this;
|
||||
$result->qosLevel = $level;
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user