Skip to content

Commit 75cfbaa

Browse files
committed
added version method to AProtocol classes
1 parent 62570ca commit 75cfbaa

File tree

9 files changed

+39
-3
lines changed

9 files changed

+39
-3
lines changed

src/protocol/AProtocol.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
abstract class AProtocol
1818
{
19-
2019
protected const SUCCESS = 0x70;
2120
protected const FAILURE = 0x7F;
2221
protected const IGNORED = 0x7E;
@@ -87,4 +86,10 @@ protected function read(?int &$signature)
8786
return $output;
8887
}
8988

89+
/**
90+
* Returns the bolt protocol version as a string.
91+
*
92+
* @return string
93+
*/
94+
abstract public function getVersion(): string;
9095
}

src/protocol/V1.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,8 @@ public function reset(): array
176176
return $message;
177177
}
178178

179+
public function getVersion(): string
180+
{
181+
return '1';
182+
}
179183
}

src/protocol/V2.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@
1212
*/
1313
class V2 extends V1
1414
{
15-
15+
public function getVersion(): string
16+
{
17+
return '2';
18+
}
1619
}

src/protocol/V3.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,8 @@ public function goodbye()
177177
$this->connection->disconnect();
178178
}
179179

180+
public function getVersion(): string
181+
{
182+
return '3';
183+
}
180184
}

src/protocol/V4.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,8 @@ public function discard(...$args): array
101101
return $message;
102102
}
103103

104+
public function getVersion(): string
105+
{
106+
return '4.0';
107+
}
104108
}

src/protocol/V4_1.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ public function hello(...$args): array
2626
return parent::hello(...$args);
2727
}
2828

29+
public function getVersion(): string
30+
{
31+
return '4.1';
32+
}
2933
}

src/protocol/V4_2.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@
1212
*/
1313
class V4_2 extends V4_1
1414
{
15-
15+
public function getVersion(): string
16+
{
17+
return '4.2';
18+
}
1619
}

src/protocol/V4_3.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,9 @@ public function route(...$args): array
4646

4747
return $message;
4848
}
49+
50+
public function getVersion(): string
51+
{
52+
return '4.3';
53+
}
4954
}

src/protocol/V4_4.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@ public function route(...$args): array
2222
return parent::route(...$args);
2323
}
2424

25+
public function getVersion(): string
26+
{
27+
return '4.4';
28+
}
2529
}

0 commit comments

Comments
 (0)