1
0
Fork 0
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:
Robin Appelman 2017-04-09 17:24:15 +02:00
commit 05f48fd0a0
7 changed files with 110 additions and 25 deletions

View file

@ -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';
}
}