Skip to content

Commit b3f8578

Browse files
committed
Replace calls to array_merge with array_values
1 parent 6073011 commit b3f8578

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Protocol/Parser.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function parseHeader(Message $message)
4646
$header = substr($message->data, 0, 12);
4747
$message->consumed += 12;
4848

49-
list($id, $fields, $qdCount, $anCount, $nsCount, $arCount) = array_merge(unpack('n*', $header));
49+
list($id, $fields, $qdCount, $anCount, $nsCount, $arCount) = array_values(unpack('n*', $header));
5050

5151
$rcode = $fields & bindec('1111');
5252
$z = ($fields >> 4) & bindec('111');
@@ -86,7 +86,7 @@ public function parseQuestion(Message $message)
8686
return;
8787
}
8888

89-
list($type, $class) = array_merge(unpack('n*', substr($message->data, $consumed, 4)));
89+
list($type, $class) = array_values(unpack('n*', substr($message->data, $consumed, 4)));
9090
$consumed += 4;
9191

9292
$message->consumed = $consumed;
@@ -122,13 +122,13 @@ public function parseAnswer(Message $message)
122122
return;
123123
}
124124

125-
list($type, $class) = array_merge(unpack('n*', substr($message->data, $consumed, 4)));
125+
list($type, $class) = array_values(unpack('n*', substr($message->data, $consumed, 4)));
126126
$consumed += 4;
127127

128-
list($ttl) = array_merge(unpack('N', substr($message->data, $consumed, 4)));
128+
list($ttl) = array_values(unpack('N', substr($message->data, $consumed, 4)));
129129
$consumed += 4;
130130

131-
list($rdLength) = array_merge(unpack('n', substr($message->data, $consumed, 2)));
131+
list($rdLength) = array_values(unpack('n', substr($message->data, $consumed, 2)));
132132
$consumed += 2;
133133

134134
$rdata = null;
@@ -208,15 +208,15 @@ public function getCompressedLabel($data, $consumed)
208208
public function isCompressedLabel($data, $consumed)
209209
{
210210
$mask = 0xc000; // 1100000000000000
211-
list($peek) = array_merge(unpack('n', substr($data, $consumed, 2)));
211+
list($peek) = array_values(unpack('n', substr($data, $consumed, 2)));
212212

213213
return (bool) ($peek & $mask);
214214
}
215215

216216
public function getCompressedLabelOffset($data, $consumed)
217217
{
218218
$mask = 0x3fff; // 0011111111111111
219-
list($peek) = array_merge(unpack('n', substr($data, $consumed, 2)));
219+
list($peek) = array_values(unpack('n', substr($data, $consumed, 2)));
220220

221221
return array($peek & $mask, $consumed + 2);
222222
}

0 commit comments

Comments
 (0)