mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-04 02:14:06 +02:00
run lint
This commit is contained in:
parent
3e22e36a79
commit
7320711a36
23 changed files with 36 additions and 81 deletions
|
|
@ -18,10 +18,6 @@ class ChatMessage implements JsonSerializable {
|
|||
|
||||
/**
|
||||
* ChatMessage constructor.
|
||||
*
|
||||
* @param string $user
|
||||
* @param int $time
|
||||
* @param string $message
|
||||
*/
|
||||
public function __construct(string $user, int $time, string $message) {
|
||||
$this->user = $user;
|
||||
|
|
@ -29,23 +25,14 @@ class ChatMessage implements JsonSerializable {
|
|||
$this->message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUser(): string {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTime(): int {
|
||||
return $this->time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage(): string {
|
||||
return $this->message;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Demostf\API\Demo;
|
||||
|
||||
use function count;
|
||||
use DateTime;
|
||||
use Demostf\API\Data\Kill;
|
||||
use Demostf\API\Data\ParsedDemo;
|
||||
|
|
@ -66,7 +65,7 @@ class DemoSaver {
|
|||
$upload->getBlue(),
|
||||
$demo->getRedScore(),
|
||||
$demo->getBlueScore(),
|
||||
count($demo->getPlayers()),
|
||||
\count($demo->getPlayers()),
|
||||
$upload->getUploaderId(),
|
||||
$upload->getHash(),
|
||||
$storedDemo->getBackend(),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||
namespace Demostf\API\Demo;
|
||||
|
||||
use Demostf\API\Data\StoredDemo;
|
||||
use function dirname;
|
||||
|
||||
class DemoStore {
|
||||
/** @var string */
|
||||
|
|
@ -20,8 +19,8 @@ class DemoStore {
|
|||
|
||||
public function store(string $sourcePath, string $name): StoredDemo {
|
||||
$target = $this->generatePath($name);
|
||||
if (!is_dir(dirname($target))) {
|
||||
mkdir(dirname($target), 0777, true);
|
||||
if (!is_dir(\dirname($target))) {
|
||||
mkdir(\dirname($target), 0777, true);
|
||||
}
|
||||
rename($sourcePath, $target);
|
||||
chmod($target, 0755);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ class HeaderParser {
|
|||
* @param string $head string containing the demo header binary data
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return Header
|
||||
*/
|
||||
public function parseString(string $head): Header {
|
||||
$info = @unpack(
|
||||
|
|
@ -32,8 +30,6 @@ class HeaderParser {
|
|||
* @param resource $stream
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return Header
|
||||
*/
|
||||
public function parseStream($stream): Header {
|
||||
$head = fread($stream, 2048);
|
||||
|
|
@ -44,11 +40,7 @@ class HeaderParser {
|
|||
/**
|
||||
* Parse demo info from a local file.
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return Header
|
||||
*/
|
||||
public function parseHeader(string $path): Header {
|
||||
if (!is_readable($path)) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use Demostf\API\Data\ParsedKill;
|
|||
use Demostf\API\Data\ParsedPlayer;
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* Higher level parser.
|
||||
|
|
@ -38,7 +37,7 @@ class Parser {
|
|||
|
||||
public function analyse(string $path): ParsedDemo {
|
||||
$data = $this->rawParser->parse($path);
|
||||
if (is_array($data) && isset($data['intervalPerTick'])) {
|
||||
if (\is_array($data) && isset($data['intervalPerTick'])) {
|
||||
return $this->handleData($data);
|
||||
} else {
|
||||
throw new InvalidArgumentException('Error parsing demo');
|
||||
|
|
@ -150,7 +149,7 @@ class Parser {
|
|||
* <var>STEAM_0:0:12345</var>
|
||||
*
|
||||
* @throws InvalidArgumentException if the SteamID doesn't have the correct
|
||||
* format
|
||||
* format
|
||||
*
|
||||
* @return string The converted 64bit numeric SteamID
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ class RawParser {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @return array|null
|
||||
* @throws Exception
|
||||
*/
|
||||
public function parse(string $path): ?array {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue