Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Conan | |
0.00% |
0 / 6 |
|
0.00% |
0 / 4 |
72 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
30 | |||
| query | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getProtocolName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getVersion | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 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 function is_int; |
| 16 | use function is_string; |
| 17 | use Clansuite\Capture\Protocol\ProtocolInterface; |
| 18 | use Clansuite\Capture\ServerAddress; |
| 19 | use Clansuite\Capture\ServerInfo; |
| 20 | use Override; |
| 21 | |
| 22 | /** |
| 23 | * Conan Exiles protocol implementation. |
| 24 | * |
| 25 | * Uses Steam query protocol. |
| 26 | */ |
| 27 | class Conan extends Steam implements ProtocolInterface |
| 28 | { |
| 29 | /** |
| 30 | * Protocol name. |
| 31 | */ |
| 32 | public string $name = 'Conan'; |
| 33 | |
| 34 | /** |
| 35 | * List of supported games. |
| 36 | * |
| 37 | * @var array<string> |
| 38 | */ |
| 39 | public array $supportedGames = ['Conan Exiles']; |
| 40 | |
| 41 | /** |
| 42 | * Protocol identifier. |
| 43 | */ |
| 44 | public string $protocol = 'conan'; |
| 45 | |
| 46 | /** |
| 47 | * Constructor. |
| 48 | */ |
| 49 | public function __construct(mixed $address = null, mixed $queryport = null) |
| 50 | { |
| 51 | $address = $address === null ? null : (is_string($address) ? $address : null); |
| 52 | $queryport = $queryport === null ? null : (is_int($queryport) ? $queryport : null); |
| 53 | parent::__construct($address, $queryport); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * query method. |
| 58 | */ |
| 59 | #[Override] |
| 60 | public function query(ServerAddress $addr): ServerInfo |
| 61 | { |
| 62 | return parent::query($addr); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * getProtocolName method. |
| 67 | */ |
| 68 | #[Override] |
| 69 | public function getProtocolName(): string |
| 70 | { |
| 71 | return $this->protocol; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * getVersion method. |
| 76 | */ |
| 77 | #[Override] |
| 78 | public function getVersion(ServerInfo $info): string |
| 79 | { |
| 80 | return $info->gameversion ?? 'unknown'; |
| 81 | } |
| 82 | } |