| Total Complexity | 7 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | abstract class AQuery |
||
| 15 | { |
||
| 16 | protected Fsp\Query $query; |
||
| 17 | protected int $serverKey = 0; |
||
| 18 | protected int $localSequence = 0; |
||
| 19 | |||
| 20 | 15 | public function __construct(Fsp\Query $query) |
|
| 21 | { |
||
| 22 | 15 | $this->query = $query; |
|
| 23 | } |
||
| 24 | |||
| 25 | 15 | public function setKey(int $key = 0): self |
|
| 26 | { |
||
| 27 | 15 | $this->serverKey = $key; |
|
| 28 | 15 | return $this; |
|
| 29 | } |
||
| 30 | |||
| 31 | 15 | public function setSequence(int $sequenceNumber = 0): self |
|
| 32 | { |
||
| 33 | 15 | $this->localSequence = $sequenceNumber; |
|
| 34 | 15 | return $this; |
|
| 35 | } |
||
| 36 | |||
| 37 | 15 | public function compile(): string |
|
| 38 | { |
||
| 39 | 15 | return $this->query->body = $this->query |
|
| 40 | 15 | ->setCommand($this->getCommand()) |
|
| 41 | 15 | ->setKey($this->serverKey) |
|
| 42 | 15 | ->setSequence($this->localSequence) |
|
| 43 | 15 | ->setFilePosition($this->getFilePosition()) |
|
| 44 | 15 | ->setContent($this->getData()) |
|
| 45 | 15 | ->setExtraData($this->getExtraData()) |
|
| 46 | 15 | ->getPacket() |
|
| 47 | 15 | ; |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Commands as defined in \RemoteRequest\Protocols\Fsp::CC_* |
||
| 52 | * @return int |
||
| 53 | * @see \kalanis\RemoteRequest\Protocols\Fsp |
||
| 54 | */ |
||
| 55 | abstract protected function getCommand(): int; |
||
| 56 | |||
| 57 | 7 | protected function getFilePosition(): int |
|
| 60 | } |
||
| 61 | |||
| 62 | 2 | protected function getData(): string |
|
| 63 | { |
||
| 64 | 2 | return ''; |
|
| 65 | } |
||
| 66 | |||
| 67 | 8 | protected function getExtraData(): string |
|
| 70 | } |
||
| 71 | } |
||
| 72 |