| 1: | <?php declare(strict_types=1); |
| 2: | |
| 3: | /** |
| 4: | * Clansuite Server Query |
| 5: | * |
| 6: | * SPDX-FileCopyrightText: 2003-2025 Jens A. Koch |
| 7: | * SPDX-License-Identifier: MIT |
| 8: | * |
| 9: | * For the full copyright and license information, please view |
| 10: | * the LICENSE file that was distributed with this source code. |
| 11: | */ |
| 12: | |
| 13: | namespace Clansuite\ServerQuery\ServerProtocols; |
| 14: | |
| 15: | use Clansuite\Capture\Protocol\ProtocolInterface; |
| 16: | use Clansuite\Capture\ServerAddress; |
| 17: | use Clansuite\Capture\ServerInfo; |
| 18: | use Override; |
| 19: | |
| 20: | /** |
| 21: | * SCUM protocol implementation. |
| 22: | * |
| 23: | * Uses Steam query protocol. |
| 24: | */ |
| 25: | class Scum extends Steam implements ProtocolInterface |
| 26: | { |
| 27: | /** |
| 28: | * Protocol name. |
| 29: | */ |
| 30: | public string $name = 'SCUM'; |
| 31: | |
| 32: | /** |
| 33: | * List of supported games. |
| 34: | * |
| 35: | * @var array<string> |
| 36: | */ |
| 37: | public array $supportedGames = ['SCUM']; |
| 38: | |
| 39: | /** |
| 40: | * Protocol identifier. |
| 41: | */ |
| 42: | public string $protocol = 'scum'; |
| 43: | |
| 44: | /** |
| 45: | * Constructor. |
| 46: | */ |
| 47: | public function __construct(?string $address = null, ?int $queryport = null) |
| 48: | { |
| 49: | parent::__construct($address, $queryport); |
| 50: | } |
| 51: | |
| 52: | /** |
| 53: | * query method. |
| 54: | */ |
| 55: | #[Override] |
| 56: | public function query(ServerAddress $addr): ServerInfo |
| 57: | { |
| 58: | return parent::query($addr); |
| 59: | } |
| 60: | |
| 61: | /** |
| 62: | * getProtocolName method. |
| 63: | */ |
| 64: | #[Override] |
| 65: | public function getProtocolName(): string |
| 66: | { |
| 67: | return $this->protocol; |
| 68: | } |
| 69: | |
| 70: | /** |
| 71: | * getVersion method. |
| 72: | */ |
| 73: | #[Override] |
| 74: | public function getVersion(ServerInfo $info): string |
| 75: | { |
| 76: | return $info->gameversion ?? 'unknown'; |
| 77: | } |
| 78: | } |
| 79: |