mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
lint
This commit is contained in:
parent
68f20ac903
commit
c29fe61ad1
24 changed files with 1242 additions and 50 deletions
|
|
@ -51,7 +51,7 @@ class BaseProvider {
|
|||
];
|
||||
if (isset($aliases[$table])) {
|
||||
return $aliases[$table];
|
||||
} elseif (array_search($table, $rawNames, true) === false) {
|
||||
} elseif (false === array_search($table, $rawNames, true)) {
|
||||
return $table . 's';
|
||||
} else {
|
||||
return $table;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class DemoListProvider extends BaseProvider {
|
|||
->groupBy('demo_id')
|
||||
->having($query->expr()->eq(
|
||||
'COUNT(user_id)',
|
||||
$query->createNamedParameter(count($userIds, \PDO::PARAM_INT))
|
||||
$query->createNamedParameter(\count($userIds, \PDO::PARAM_INT))
|
||||
))
|
||||
->orderBy('demo_id', 'desc')
|
||||
->setMaxResults(50)
|
||||
|
|
@ -54,7 +54,7 @@ class DemoListProvider extends BaseProvider {
|
|||
* @return Demo[]
|
||||
*/
|
||||
public function listDemos(int $page, array $where = [], string $order = 'DESC') {
|
||||
if (isset($where['players']) and is_array($where['players']) and count($where['players']) > 0) {
|
||||
if (isset($where['players']) and \is_array($where['players']) and \count($where['players']) > 0) {
|
||||
return $this->listProfile($page, $where);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class UploadProvider extends BaseProvider {
|
|||
|
||||
public function upload(string $key, string $red, string $blu, string $name, string $demoFile): string {
|
||||
$user = $this->userProvider->byKey($key);
|
||||
if (!$user || ($this->uploadKey !== '' && $this->uploadKey !== $key)) {
|
||||
if (!$user || ('' !== $this->uploadKey && $this->uploadKey !== $key)) {
|
||||
return 'Invalid key';
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ class UploadProvider extends BaseProvider {
|
|||
|
||||
public function validateParsed(Header $header, ParsedDemo $parsedDemo) {
|
||||
$rounds = $parsedDemo->getRedScore() + $parsedDemo->getBlueScore();
|
||||
if ($rounds === 0 && $header->getDuration() < (5 * 60)) {
|
||||
if (0 === $rounds && $header->getDuration() < (5 * 60)) {
|
||||
return 'Demos must be at least 5 minutes long';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class UserProvider extends BaseProvider {
|
|||
->setMaxResults(1);
|
||||
|
||||
$result = $query->execute()->fetch();
|
||||
if (is_array($result)) {
|
||||
if (\is_array($result)) {
|
||||
return $result;
|
||||
} else {
|
||||
return null;
|
||||
|
|
@ -74,6 +74,7 @@ class UserProvider extends BaseProvider {
|
|||
|
||||
/**
|
||||
* @param string $search
|
||||
*
|
||||
* @return SteamUser[]
|
||||
*/
|
||||
public function search(string $search): array {
|
||||
|
|
@ -102,7 +103,7 @@ class UserProvider extends BaseProvider {
|
|||
$countWeight = 1;
|
||||
$simWeight = 5;
|
||||
$diff = ($a['sim'] * $simWeight + $a['count'] * $countWeight) - ($b['sim'] * $simWeight + $b['count'] * $countWeight);
|
||||
if ($diff === 0) {
|
||||
if (0 === $diff) {
|
||||
return 0;
|
||||
} else {
|
||||
return ($diff < 0) ? -1 : 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue