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