added missing named parameters, added strict_types
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
9bdcc6d586
commit
383dc29ba5
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class ApiKeys
|
||||||
FROM " . DatabaseConnection::TABLE_USER;
|
FROM " . DatabaseConnection::TABLE_USER;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$statement = $this->databaseConnection->getConnection()->query($sql);
|
$statement = $this->databaseConnection->getConnection()->query(statement: $sql);
|
||||||
return $statement->fetchAll(mode: PDO::FETCH_ASSOC);
|
return $statement->fetchAll(mode: PDO::FETCH_ASSOC);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
exit($e->getMessage());
|
exit($e->getMessage());
|
||||||
|
@ -47,7 +47,7 @@ class ApiKeys
|
||||||
";
|
";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$statement = $this->databaseConnection->getConnection()->prepare($sql);
|
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||||
$statement->bindParam(param: ':id', var: $id);
|
$statement->bindParam(param: ':id', var: $id);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
return $statement->fetch(mode: PDO::FETCH_ASSOC);
|
return $statement->fetch(mode: PDO::FETCH_ASSOC);
|
||||||
|
@ -70,7 +70,7 @@ class ApiKeys
|
||||||
WHERE api_token_prefix = :prefix";
|
WHERE api_token_prefix = :prefix";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$statement = $this->databaseConnection->getConnection()->prepare($sql);
|
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||||
$statement->bindParam(param: ':prefix', var: $prefix);
|
$statement->bindParam(param: ':prefix', var: $prefix);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
return $statement->fetch(mode: PDO::FETCH_ASSOC);
|
return $statement->fetch(mode: PDO::FETCH_ASSOC);
|
||||||
|
@ -88,7 +88,7 @@ class ApiKeys
|
||||||
$tokenPrefix = uniqid();
|
$tokenPrefix = uniqid();
|
||||||
$result['tokenPrefix'] = $tokenPrefix;
|
$result['tokenPrefix'] = $tokenPrefix;
|
||||||
try {
|
try {
|
||||||
$key = bin2hex(random_bytes(length: 24));
|
$key = bin2hex(string: random_bytes(length: 24));
|
||||||
$result['key'] = $key;
|
$result['key'] = $key;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo $e->getMessage() . PHP_EOL;
|
echo $e->getMessage() . PHP_EOL;
|
||||||
|
@ -101,7 +101,7 @@ class ApiKeys
|
||||||
VALUES (:name, :token_prefix, :token)";
|
VALUES (:name, :token_prefix, :token)";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$statement = $this->databaseConnection->getConnection()->prepare($sql);
|
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||||
$statement->bindParam(param: ':token_prefix', var: $tokenPrefix);
|
$statement->bindParam(param: ':token_prefix', var: $tokenPrefix);
|
||||||
$statement->bindParam(param: ':token', var: $token);
|
$statement->bindParam(param: ':token', var: $token);
|
||||||
$statement->bindParam(param: ':name', var: $name);
|
$statement->bindParam(param: ':name', var: $name);
|
||||||
|
@ -127,7 +127,7 @@ class ApiKeys
|
||||||
WHERE id = :id";
|
WHERE id = :id";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$statement = $this->databaseConnection->getConnection()->prepare($sql);
|
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||||
$statement->bindParam(param: 'id', var: $id);
|
$statement->bindParam(param: 'id', var: $id);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
return $statement->rowCount();
|
return $statement->rowCount();
|
||||||
|
|
Loading…
Reference in New Issue