1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-04 02:14:06 +02:00

Add php-cs-fixer

This commit is contained in:
Robin Appelman 2017-07-30 14:51:54 +02:00
commit 309ae17036
54 changed files with 4900 additions and 4106 deletions

View file

@ -3,107 +3,107 @@
namespace Demostf\API\Data;
class DemoPlayer implements \JsonSerializable {
/** @var int */
private $id;
/** @var int */
private $userId;
/** @var string */
private $name;
/** @var string */
private $team;
/** @var string */
private $class;
/** @var string */
private $steamId;
/** @var string */
private $avatar;
/** @var int */
private $kills;
/** @var int */
private $assists;
/** @var int */
private $deaths;
/** @var int */
private $id;
/** @var int */
private $userId;
/** @var string */
private $name;
/** @var string */
private $team;
/** @var string */
private $class;
/** @var string */
private $steamId;
/** @var string */
private $avatar;
/** @var int */
private $kills;
/** @var int */
private $assists;
/** @var int */
private $deaths;
public function __construct(int $id, int $userId, string $name, string $team, string $class, string $steamId, string $avatar, int $kills, int $assists, int $deaths) {
$this->id = $id;
$this->userId = $userId;
$this->name = $name;
$this->team = $team;
$this->class = $class;
$this->steamId = $steamId;
$this->avatar = $avatar;
$this->kills = $kills;
$this->assists = $assists;
$this->deaths = $deaths;
}
public function __construct(int $id, int $userId, string $name, string $team, string $class, string $steamId, string $avatar, int $kills, int $assists, int $deaths) {
$this->id = $id;
$this->userId = $userId;
$this->name = $name;
$this->team = $team;
$this->class = $class;
$this->steamId = $steamId;
$this->avatar = $avatar;
$this->kills = $kills;
$this->assists = $assists;
$this->deaths = $deaths;
}
public function getId(): int {
return $this->id;
}
public function getId(): int {
return $this->id;
}
public function getUserId(): int {
return $this->userId;
}
public function getUserId(): int {
return $this->userId;
}
public function getName(): string {
return $this->name;
}
public function getName(): string {
return $this->name;
}
public function getTeam(): string {
return $this->team;
}
public function getTeam(): string {
return $this->team;
}
public function getClass(): string {
return $this->class;
}
public function getClass(): string {
return $this->class;
}
public function getSteamId(): string {
return $this->steamId;
}
public function getSteamId(): string {
return $this->steamId;
}
public function getAvatar(): string {
return $this->avatar;
}
public function getAvatar(): string {
return $this->avatar;
}
public function getKills(): int {
return $this->kills;
}
public function getKills(): int {
return $this->kills;
}
public function getAssists(): int {
return $this->assists;
}
public function getAssists(): int {
return $this->assists;
}
public function getDeaths(): int {
return $this->deaths;
}
public function getDeaths(): int {
return $this->deaths;
}
public static function fromRow($row): DemoPlayer {
return new DemoPlayer(
$row['id'],
$row['user_id'],
$row['name'],
$row['team'],
$row['class'],
$row['steamid'],
$row['avatar'],
$row['kills'],
$row['assists'],
$row['deaths']
);
}
public static function fromRow($row): DemoPlayer {
return new DemoPlayer(
$row['id'],
$row['user_id'],
$row['name'],
$row['team'],
$row['class'],
$row['steamid'],
$row['avatar'],
$row['kills'],
$row['assists'],
$row['deaths']
);
}
public function jsonSerialize() {
return [
'id' => $this->getId(),
'user_id' => $this->getUserId(),
'name' => $this->getName(),
'team' => $this->getTeam(),
'class' => $this->getClass(),
'steamid' => $this->getSteamId(),
'avatar' => $this->getAvatar(),
'kills' => $this->getKills(),
'assists' => $this->getAssists(),
'deaths' => $this->getDeaths()
];
}
public function jsonSerialize() {
return [
'id' => $this->getId(),
'user_id' => $this->getUserId(),
'name' => $this->getName(),
'team' => $this->getTeam(),
'class' => $this->getClass(),
'steamid' => $this->getSteamId(),
'avatar' => $this->getAvatar(),
'kills' => $this->getKills(),
'assists' => $this->getAssists(),
'deaths' => $this->getDeaths()
];
}
}

View file

@ -3,48 +3,48 @@
namespace Demostf\API\Data;
class Kill {
private $id;
private $id;
private $demoId;
private $demoId;
private $attackerId;
private $attackerId;
private $assisterId;
private $assisterId;
private $victimId;
private $victimId;
private $weapon;
private $weapon;
public function __construct(int $id, int $demoId, int $attackerId, int $assisterId, int $victimId, string $weapon) {
$this->id = $id;
$this->demoId = $demoId;
$this->attackerId = $attackerId;
$this->assisterId = $assisterId;
$this->victimId = $victimId;
$this->weapon = $weapon;
}
public function __construct(int $id, int $demoId, int $attackerId, int $assisterId, int $victimId, string $weapon) {
$this->id = $id;
$this->demoId = $demoId;
$this->attackerId = $attackerId;
$this->assisterId = $assisterId;
$this->victimId = $victimId;
$this->weapon = $weapon;
}
public function getId(): int {
return $this->id;
}
public function getId(): int {
return $this->id;
}
public function getDemoId(): int {
return $this->demoId;
}
public function getDemoId(): int {
return $this->demoId;
}
public function getAttackerId(): int {
return $this->attackerId;
}
public function getAttackerId(): int {
return $this->attackerId;
}
public function getAssisterId(): int {
return $this->assisterId;
}
public function getAssisterId(): int {
return $this->assisterId;
}
public function getVictimId(): int {
return $this->victimId;
}
public function getVictimId(): int {
return $this->victimId;
}
public function getWeapon(): string {
return $this->weapon;
}
public function getWeapon(): string {
return $this->weapon;
}
}

View file

@ -5,60 +5,60 @@ 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;
/** @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;
}
/**
* 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 getRedScore(): int {
return $this->redScore;
}
public function getBlueScore(): int {
return $this->blueScore;
}
public function getBlueScore(): int {
return $this->blueScore;
}
/**
* @return ChatMessage[]
*/
public function getChat(): array {
return $this->chat;
}
/**
* @return ChatMessage[]
*/
public function getChat(): array {
return $this->chat;
}
/**
* @return ParsedPlayer[]
*/
public function getPlayers(): array {
return $this->players;
}
/**
* @return ParsedPlayer[]
*/
public function getPlayers(): array {
return $this->players;
}
/**
* @return ParsedKill[]
*/
public function getKills(): array {
return $this->kills;
}
/**
* @return ParsedKill[]
*/
public function getKills(): array {
return $this->kills;
}
}

View file

@ -3,34 +3,34 @@
namespace Demostf\API\Data;
class ParsedKill {
private $attackerDemoId;
private $attackerDemoId;
private $assisterDemoId;
private $assisterDemoId;
private $victimDemoId;
private $victimDemoId;
private $weapon;
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 __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 getAttackerDemoId(): int {
return $this->attackerDemoId;
}
public function getAssisterDemoId(): int {
return $this->assisterDemoId;
}
public function getAssisterDemoId(): int {
return $this->assisterDemoId;
}
public function getVictimDemoId(): int {
return $this->victimDemoId;
}
public function getVictimDemoId(): int {
return $this->victimDemoId;
}
public function getWeapon(): string {
return $this->weapon;
}
public function getWeapon(): string {
return $this->weapon;
}
}

View file

@ -3,42 +3,42 @@
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;
/** @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 __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 getName(): string {
return $this->name;
}
public function getDemoUserId(): int {
return $this->demoUserId;
}
public function getDemoUserId(): int {
return $this->demoUserId;
}
public function getSteamId(): string {
return $this->steamId;
}
public function getSteamId(): string {
return $this->steamId;
}
public function getTeam(): string {
return $this->team;
}
public function getTeam(): string {
return $this->team;
}
public function getClass(): string {
return $this->class;
}
public function getClass(): string {
return $this->class;
}
}

View file

@ -3,62 +3,62 @@
namespace Demostf\API\Data;
class Player {
/** @var int */
private $id;
/** @var int */
private $id;
/** @var int */
private $demoId;
/** @var int */
private $demoId;
/** @var int */
private $demoUserId;
/** @var int */
private $demoUserId;
/** @var int */
private $userId;
/** @var int */
private $userId;
/** @var string */
private $name;
/** @var string */
private $name;
/** @var string */
private $team;
/** @var string */
private $team;
/** @var string */
private $class;
/** @var string */
private $class;
public function __construct(int $id, int $demoId, int $demoUserId, int $userId, string $name, string $team, string $class) {
$this->id = $id;
$this->demoId = $demoId;
$this->demoUserId = $demoUserId;
$this->userId = $userId;
$this->name = $name;
$this->team = $team;
$this->class = $class;
}
public function __construct(int $id, int $demoId, int $demoUserId, int $userId, string $name, string $team, string $class) {
$this->id = $id;
$this->demoId = $demoId;
$this->demoUserId = $demoUserId;
$this->userId = $userId;
$this->name = $name;
$this->team = $team;
$this->class = $class;
}
public function getId(): int {
return $this->id;
}
public function getId(): int {
return $this->id;
}
public function getDemoId(): int {
return $this->demoId;
}
public function getDemoId(): int {
return $this->demoId;
}
public function getDemoUserId(): int {
return $this->demoUserId;
}
public function getDemoUserId(): int {
return $this->demoUserId;
}
public function getUserId(): int {
return $this->userId;
}
public function getUserId(): int {
return $this->userId;
}
public function getName(): string {
return $this->name;
}
public function getName(): string {
return $this->name;
}
public function getTeam(): string {
return $this->team;
}
public function getTeam(): string {
return $this->team;
}
public function getClass(): string {
return $this->class;
}
public function getClass(): string {
return $this->class;
}
}

View file

@ -3,28 +3,28 @@
namespace Demostf\API\Data;
class StoredDemo {
/** @var string */
private $url;
/** @var string */
private $backend;
/** @var string */
private $path;
/** @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 __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 getUrl(): string {
return $this->url;
}
public function getBackend(): string {
return $this->backend;
}
public function getBackend(): string {
return $this->backend;
}
public function getPath(): string {
return $this->path;
}
public function getPath(): string {
return $this->path;
}
}

View file

@ -3,42 +3,42 @@
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;
/** @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 __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 getName(): string {
return $this->name;
}
public function getRed(): string {
return $this->red;
}
public function getRed(): string {
return $this->red;
}
public function getBlue(): string {
return $this->blue;
}
public function getBlue(): string {
return $this->blue;
}
public function getUploaderId(): int {
return $this->uploaderId;
}
public function getUploaderId(): int {
return $this->uploaderId;
}
public function getHash(): string {
return $this->hash;
}
public function getHash(): string {
return $this->hash;
}
}

View file

@ -3,61 +3,61 @@
namespace Demostf\API\Data;
class User implements \JsonSerializable {
/** @var int */
private $id;
/** @var string */
private $steamId;
/** @var string */
private $name;
/** @var string */
private $avatar;
/** @var string */
private $token;
/** @var int */
private $id;
/** @var string */
private $steamId;
/** @var string */
private $name;
/** @var string */
private $avatar;
/** @var string */
private $token;
public function __construct(int $id, string $steamId, string $name, string $avatar, string $token) {
$this->id = $id;
$this->steamId = $steamId;
$this->name = $name;
$this->avatar = $avatar;
$this->token = $token;
}
public function __construct(int $id, string $steamId, string $name, string $avatar, string $token) {
$this->id = $id;
$this->steamId = $steamId;
$this->name = $name;
$this->avatar = $avatar;
$this->token = $token;
}
public function getId(): int {
return $this->id;
}
public function getId(): int {
return $this->id;
}
public function getSteamId(): string {
return $this->steamId;
}
public function getSteamId(): string {
return $this->steamId;
}
public function getName(): string {
return $this->name;
}
public function getName(): string {
return $this->name;
}
public function getAvatar(): string {
return $this->avatar;
}
public function getAvatar(): string {
return $this->avatar;
}
public function getToken(): string {
return $this->token;
}
public function getToken(): string {
return $this->token;
}
public function jsonSerialize() {
return [
'id' => $this->getId(),
'steamid' => $this->getSteamId(),
'name' => $this->getName(),
'avatar' => $this->getAvatar()
];
}
public function jsonSerialize() {
return [
'id' => $this->getId(),
'steamid' => $this->getSteamId(),
'name' => $this->getName(),
'avatar' => $this->getAvatar()
];
}
public static function fromRow(array $row): User {
return new User(
(int)$row['id'],
$row['steamid'],
$row['name'],
$row['avatar'],
$row['token'] ?? ''
);
}
public static function fromRow(array $row): User {
return new User(
(int)$row['id'],
$row['steamid'],
$row['name'],
$row['avatar'],
$row['token'] ?? ''
);
}
}