Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50.00% covered (danger)
50.00%
1 / 2
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Csgo
50.00% covered (danger)
50.00%
1 / 2
50.00% covered (danger)
50.00%
1 / 2
2.50
0.00% covered (danger)
0.00%
0 / 1
 getNativeJoinURI
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 query_server
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
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
13namespace Clansuite\ServerQuery\ServerProtocols;
14
15use Override;
16
17/**
18 * Handles the query protocol for Counter-Strike: Global Offensive game servers.
19 *
20 * Extends the base Steam protocol functionality to provide CS:GO specific
21 * server querying capabilities, retrieving information about matches, players, and settings.
22 */
23class Csgo extends Steam
24{
25    /**
26     * Protocol name.
27     */
28    public string $name = 'Counter-Strike: Global Offensive';
29
30    /**
31     * List of supported games.
32     *
33     * @var array<string>
34     */
35    public array $supportedGames = ['Counter-Strike: Global Offensive'];
36
37    /**
38     * Protocol identifier.
39     */
40    public string $protocol = 'A2S';
41
42    /**
43     * Game series.
44     *
45     * @var array<string>
46     */
47    public array $game_series_list = ['Counter-Strike'];
48
49    /**
50     * CS:GO specific port adjustment if needed.
51     */
52    protected int $port_diff = 0;
53
54    /**
55     * Returns a native join URI for CS:GO.
56     */
57    #[Override]
58    public function getNativeJoinURI(): string
59    {
60        return 'steam://connect/' . $this->address . ':' . $this->hostport;
61    }
62
63    /**
64     * query_server method.
65     */
66    #[Override]
67    public function query_server(bool $getPlayers = true, bool $getRules = true): bool
68    {
69        // CS:GO uses standard Source engine protocol, so we can use parent implementation
70        return parent::query_server($getPlayers, $getRules);
71    }
72}