mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
upload and tests
This commit is contained in:
parent
05f48fd0a0
commit
03d3acebf5
21 changed files with 1026 additions and 152 deletions
64
src/Data/ParsedDemo.php
Normal file
64
src/Data/ParsedDemo.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Demostf\API\Data;
|
||||
|
||||
use Demostf\API\Demo\ChatMessage;
|
||||
|
||||
class ParsedDemo {
|
||||
/** @var int */
|
||||
private $redScore;
|
||||
/** @var int */
|
||||
private $blueScore;
|
||||
/** @var ChatMessage[] */
|
||||
private $chat;
|
||||
/** @var ParsedPlayer[] */
|
||||
private $players;
|
||||
/** @var ParsedKill[] */
|
||||
private $kills;
|
||||
|
||||
/**
|
||||
* ParsedDemo constructor.
|
||||
*
|
||||
* @param int $redScore
|
||||
* @param int $blueScore
|
||||
* @param ChatMessage[] $chat
|
||||
* @param ParsedPlayer[] $players
|
||||
* @param ParsedKill[] $kills
|
||||
*/
|
||||
public function __construct(int $redScore, int $blueScore, array $chat, array $players, array $kills) {
|
||||
$this->redScore = $redScore;
|
||||
$this->blueScore = $blueScore;
|
||||
$this->chat = $chat;
|
||||
$this->players = $players;
|
||||
$this->kills = $kills;
|
||||
}
|
||||
|
||||
public function getRedScore(): int {
|
||||
return $this->redScore;
|
||||
}
|
||||
|
||||
public function getBlueScore(): int {
|
||||
return $this->blueScore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ChatMessage[]
|
||||
*/
|
||||
public function getChat(): array {
|
||||
return $this->chat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ParsedPlayer[]
|
||||
*/
|
||||
public function getPlayers(): array {
|
||||
return $this->players;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ParsedKill[]
|
||||
*/
|
||||
public function getKills(): array {
|
||||
return $this->kills;
|
||||
}
|
||||
}
|
||||
36
src/Data/ParsedKill.php
Normal file
36
src/Data/ParsedKill.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Demostf\API\Data;
|
||||
|
||||
class ParsedKill {
|
||||
private $attackerDemoId;
|
||||
|
||||
private $assisterDemoId;
|
||||
|
||||
private $victimDemoId;
|
||||
|
||||
private $weapon;
|
||||
|
||||
public function __construct(int $attackerDemoId, int $assisterDemoId, int $victimDemoId, string $weapon) {
|
||||
$this->attackerDemoId = $attackerDemoId;
|
||||
$this->assisterDemoId = $assisterDemoId;
|
||||
$this->victimDemoId = $victimDemoId;
|
||||
$this->weapon = $weapon;
|
||||
}
|
||||
|
||||
public function getAttackerDemoId(): int {
|
||||
return $this->attackerDemoId;
|
||||
}
|
||||
|
||||
public function getAssisterDemoId(): int {
|
||||
return $this->assisterDemoId;
|
||||
}
|
||||
|
||||
public function getVictimDemoId(): int {
|
||||
return $this->victimDemoId;
|
||||
}
|
||||
|
||||
public function getWeapon(): string {
|
||||
return $this->weapon;
|
||||
}
|
||||
}
|
||||
44
src/Data/ParsedPlayer.php
Normal file
44
src/Data/ParsedPlayer.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Demostf\API\Data;
|
||||
|
||||
class ParsedPlayer {
|
||||
/** @var string */
|
||||
private $name;
|
||||
/** @var int */
|
||||
private $demoUserId;
|
||||
/** @var string */
|
||||
private $steamId;
|
||||
/** @var string */
|
||||
private $team;
|
||||
/** @var string` */
|
||||
private $class;
|
||||
|
||||
public function __construct(string $name, int $demoUserId, string $steamId, string $team, string $class) {
|
||||
$this->name = $name;
|
||||
$this->demoUserId = $demoUserId;
|
||||
$this->steamId = $steamId;
|
||||
$this->team = $team;
|
||||
$this->class = $class;
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDemoUserId(): int {
|
||||
return $this->demoUserId;
|
||||
}
|
||||
|
||||
public function getSteamId(): string {
|
||||
return $this->steamId;
|
||||
}
|
||||
|
||||
public function getTeam(): string {
|
||||
return $this->team;
|
||||
}
|
||||
|
||||
public function getClass(): string {
|
||||
return $this->class;
|
||||
}
|
||||
}
|
||||
30
src/Data/StoredDemo.php
Normal file
30
src/Data/StoredDemo.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Demostf\API\Data;
|
||||
|
||||
class StoredDemo {
|
||||
/** @var string */
|
||||
private $url;
|
||||
/** @var string */
|
||||
private $backend;
|
||||
/** @var string */
|
||||
private $path;
|
||||
|
||||
public function __construct(string $url, string $backend, string $path) {
|
||||
$this->url = $url;
|
||||
$this->backend = $backend;
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
public function getUrl(): string {
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function getBackend(): string {
|
||||
return $this->backend;
|
||||
}
|
||||
|
||||
public function getPath(): string {
|
||||
return $this->path;
|
||||
}
|
||||
}
|
||||
44
src/Data/Upload.php
Normal file
44
src/Data/Upload.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Demostf\API\Data;
|
||||
|
||||
class Upload {
|
||||
/** @var string */
|
||||
private $name;
|
||||
/** @var string */
|
||||
private $red;
|
||||
/** @var string */
|
||||
private $blue;
|
||||
/** @var int */
|
||||
private $uploaderId;
|
||||
/** @var string */
|
||||
private $hash;
|
||||
|
||||
public function __construct(string $name, string $red, string $blue, int $uploaderId, string $hash) {
|
||||
$this->name = $name;
|
||||
$this->red = $red;
|
||||
$this->blue = $blue;
|
||||
$this->uploaderId = $uploaderId;
|
||||
$this->hash = $hash;
|
||||
}
|
||||
|
||||
public function getName(): string {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getRed(): string {
|
||||
return $this->red;
|
||||
}
|
||||
|
||||
public function getBlue(): string {
|
||||
return $this->blue;
|
||||
}
|
||||
|
||||
public function getUploaderId(): int {
|
||||
return $this->uploaderId;
|
||||
}
|
||||
|
||||
public function getHash(): string {
|
||||
return $this->hash;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue