Define and detect different packet types (2,2e,2+,2.2)
This commit is contained in:
@@ -59,12 +59,22 @@ abstract class FTN
|
||||
*/
|
||||
protected static function unpackheader(array $pack): string
|
||||
{
|
||||
return join('/',
|
||||
collect($pack)
|
||||
->sortBy(function($k,$v) {return $k[0];})
|
||||
->transform(function($k,$v) {return $k[1].$v;})
|
||||
->values()
|
||||
->toArray()
|
||||
);
|
||||
// Check that our header is correct
|
||||
if (app()->environment('local')) {
|
||||
$c = 0;
|
||||
foreach (collect($pack) as $item) {
|
||||
if ($c !== $item[0])
|
||||
throw new \Exception('Invalid header');
|
||||
|
||||
$c += $item[2];
|
||||
}
|
||||
}
|
||||
|
||||
return collect($pack)
|
||||
->sortBy(function($k,$v) {return $k[0];})
|
||||
->transform(function($k,$v) {return $k[1].$v;})
|
||||
->values()
|
||||
->join('/');
|
||||
;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user