1 | <?php |
||
34 | class Teeworlds extends Protocol |
||
35 | { |
||
36 | |||
37 | /** |
||
38 | * Array of packets we want to look up. |
||
39 | * Each key should correspond to a defined method in this or a parent class |
||
40 | * |
||
41 | * @type array |
||
42 | */ |
||
43 | protected $packets = [ |
||
44 | self::PACKET_ALL => "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x67\x69\x65\x33\x05", |
||
45 | // 0.5 Packet (not compatible, maybe some wants to implement "Teeworldsold") |
||
46 | //self::PACKET_STATUS => "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFFgief", |
||
47 | ]; |
||
48 | |||
49 | /** |
||
50 | * Use the response flag to figure out what method to run |
||
51 | * |
||
52 | * @type array |
||
53 | */ |
||
54 | protected $responses = [ |
||
55 | "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffinf35" => "processAll", |
||
56 | ]; |
||
57 | |||
58 | /** |
||
59 | * The query protocol used to make the call |
||
60 | * |
||
61 | * @type string |
||
62 | */ |
||
63 | protected $protocol = 'teeworlds'; |
||
64 | |||
65 | /** |
||
66 | * String name of this protocol class |
||
67 | * |
||
68 | * @type string |
||
69 | */ |
||
70 | protected $name = 'teeworlds'; |
||
71 | |||
72 | /** |
||
73 | * Longer string name of this protocol class |
||
74 | * |
||
75 | * @type string |
||
76 | */ |
||
77 | protected $name_long = "Teeworlds Server"; |
||
78 | |||
79 | /** |
||
80 | * The client join link |
||
81 | * |
||
82 | * @type string |
||
83 | */ |
||
84 | protected $join_link = "steam://connect/%s:%d/"; |
||
85 | |||
86 | /** |
||
87 | * Normalize settings for this protocol |
||
88 | * |
||
89 | * @type array |
||
90 | */ |
||
91 | protected $normalize = [ |
||
92 | // General |
||
93 | 'general' => [ |
||
94 | // target => source |
||
95 | 'dedicated' => 'dedicated', |
||
96 | 'hostname' => 'hostname', |
||
97 | 'mapname' => 'map', |
||
98 | 'maxplayers' => 'num_players_total', |
||
99 | ], |
||
100 | // Individual |
||
101 | 'player' => [ |
||
102 | 'name' => 'name', |
||
103 | 'score' => 'score', |
||
104 | ], |
||
105 | ]; |
||
106 | |||
107 | /** |
||
108 | * Process the response |
||
109 | * |
||
110 | * @return array |
||
111 | * @throws Exception |
||
112 | */ |
||
113 | 5 | public function processResponse() |
|
142 | |||
143 | /** |
||
144 | * Handle processing all of the data returned |
||
145 | * |
||
146 | * @param Buffer $buffer |
||
147 | * |
||
148 | * @return array |
||
149 | */ |
||
150 | 3 | protected function processAll(Buffer $buffer) |
|
181 | } |
||
182 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: