mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
cleanup and tests
This commit is contained in:
parent
ae39548ddb
commit
05f48fd0a0
7 changed files with 110 additions and 25 deletions
|
|
@ -2,14 +2,24 @@
|
|||
|
||||
namespace Demostf\API\Demo;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
/**
|
||||
* Higher level parser
|
||||
*
|
||||
* Processes the raw demo.js output to something more suitable for our purpose
|
||||
*/
|
||||
class Parser {
|
||||
const CLASSES = [
|
||||
1 => 'scout',
|
||||
2 => 'sniper',
|
||||
3 => 'soldier',
|
||||
4 => 'demoman',
|
||||
5 => 'medic',
|
||||
6 => 'heavyweapons',
|
||||
7 => 'pyro',
|
||||
8 => 'spy',
|
||||
9 => 'engineer'
|
||||
];
|
||||
|
||||
/** @var RawParser */
|
||||
private $rawParser;
|
||||
|
||||
|
|
@ -81,17 +91,6 @@ class Parser {
|
|||
}
|
||||
|
||||
private function getClassName(int $classId): string {
|
||||
$classes = [
|
||||
1 => 'scout',
|
||||
2 => 'sniper',
|
||||
3 => 'soldier',
|
||||
4 => 'demoman',
|
||||
5 => 'medic',
|
||||
6 => 'heavyweapons',
|
||||
7 => 'pyro',
|
||||
8 => 'spy',
|
||||
9 => 'engineer'
|
||||
];
|
||||
return $classes[$classId] ?? 'Unknown';
|
||||
return self::CLASSES[$classId] ?? 'Unknown';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue