Lines
0.00%
0 / 3
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| PacketType | 0.00% | 0 / 3 | 0.00% | 0 / 1 | 12 | 0.00% | 0 / 1 | |||
| isSentByServer | 0.00% | 0 / 3 | 0.00% | 0 / 1 | 12 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Mqtt\Packet; | |
| 6 | ||
| 7 | enum PacketType: int | |
| 8 | { | |
| 9 | case Connect = 1; | |
| 10 | case ConnAck = 2; | |
| 11 | case Publish = 3; | |
| 12 | case PubAck = 4; | |
| 13 | case Subscribe = 8; | |
| 14 | case SubAck = 9; | |
| 15 | case Unsubscribe = 10; | |
| 16 | case UnsubAck = 11; | |
| 17 | case PingReq = 12; | |
| 18 | case PingResp = 13; | |
| 19 | case Disconnect = 14; | |
| 20 | ||
| 21 | public function isSentByServer(): bool | |
| 22 | { | |
| 23 | return match ($this) { | |
| 24 | self::ConnAck, self::Publish, self::PubAck, self::SubAck, self::UnsubAck, self::PingResp => true, | |
| 25 | self::Connect, self::Subscribe, self::Unsubscribe, self::PingReq, self::Disconnect => false, | |
| 26 | }; | |
| 27 | } | |
| 28 | } |