Cs16   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 7
c 0
b 0
f 0
dl 0
loc 39
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A processPackets() 0 13 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 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 General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU 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
 * Class Cs16
23
 *
24
 * @package GameQ\Protocols
25
 * @author  Austin Bischoff <[email protected]>
26
 */
27
class Cs16 extends Source
28
{
29
    /**
30
     * String name of this protocol class
31
     *
32
     * @var string
33
     */
34
    protected $name = 'cs16';
35
36
    /**
37
     * Longer string name of this protocol class
38
     *
39
     * @var string
40
     */
41
    protected $name_long = "Counter-Strike 1.6";
42
43
    /**
44
     * In the case of cs 1.6 we offload split packets here because the split packet response for rules is in
45
     * the old gold source format
46
     *
47
     * @param       $packet_id
48
     * @param array $packets
49
     *
50
     * @return string
51
     * @throws \GameQ\Exception\Protocol
52
     */
53 42
    protected function processPackets($packet_id, array $packets = [])
54
    {
55
        // The response is gold source if the packets are split
56 42
        $this->source_engine = self::GOLDSOURCE_ENGINE;
57
58
        // Offload to the parent
59 42
        $packs = parent::processPackets($packet_id, $packets);
60
61
        // Reset the engine
62 42
        $this->source_engine = self::SOURCE_ENGINE;
63
64
        // Return the result
65 42
        return $packs;
66
    }
67
}
68