Skip to content

Commit 25ece31

Browse files
moved check for amount of versions into set
1 parent 7f3085f commit 25ece31

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Bolt.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ public function build(): AProtocol
6161
*/
6262
public function setProtocolVersions(...$v): Bolt
6363
{
64-
$this->versions = $v;
64+
$this->versions = array_slice($v, 0, 4);
65+
while (count($this->versions) < 4)
66+
$this->versions[] = 0;
6567
return $this;
6668
}
6769

@@ -135,10 +137,7 @@ private function packProtocolVersions(): string
135137
{
136138
$versions = [];
137139

138-
while (count($this->versions) < 4)
139-
$this->versions[] = '0';
140-
141-
foreach (array_slice($this->versions, 0, 4) as $v) {
140+
foreach ($this->versions as $v) {
142141
if (is_int($v))
143142
$versions[] = pack('N', $v);
144143
else {

0 commit comments

Comments
 (0)