Mohaa::findQueryPort()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * This file is part of GameQ.
4
 *
5
 * GameQ is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU Lesser General Public License as published by
7
 * the Free Software Foundation; either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * GameQ is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace GameQ\Protocols;
20
21
/**
22
 * Medal of honor: Allied Assault Protocol Class
23
 *
24
 * @package GameQ\Protocols
25
 * @author  Bram <https://github.com/Stormyy>
26
 * @author  Austin Bischoff <[email protected]>
27
 */
28
class Mohaa extends Gamespy
29
{
30
    /**
31
     * String name of this protocol class
32
     *
33
     * @var string
34
     */
35
    protected $name = 'mohaa';
36
37
    /**
38
     * Longer string name of this protocol class
39
     *
40
     * @var string
41
     */
42
    protected $name_long = "Medal of honor: Allied Assault";
43
44
    /**
45
     * Normalize settings for this protocol
46
     *
47
     * @var array
48
     */
49
    protected $normalize = [
50
        'general' => [
51
            // target       => source
52
            'dedicated'  => 'dedicated',
53
            'gametype'   => 'gametype',
54
            'hostname'   => 'hostname',
55
            'mapname'    => 'mapname',
56
            'maxplayers' => 'maxplayers',
57
            'numplayers' => 'numplayers',
58
            'password'   => 'password',
59
        ],
60
        // Individual
61
        'player'  => [
62
            'name'  => 'player',
63
            'score' => 'frags',
64
            'ping'  => 'ping',
65
        ],
66
    ];
67
68
    /**
69
     * Query port is always the client port + 97 in MOHAA
70
     *
71
     * @param int $clientPort
72
     *
73
     * @return int
74
     */
75 24
    public function findQueryPort($clientPort)
76
    {
77 24
        return $clientPort + 97;
78
    }
79
}
80