fix code cleanup mistakes

This commit is contained in:
Roman 2021-04-02 22:41:24 +02:00
parent eea0aeacc6
commit 3d703fd7d5
5 changed files with 9 additions and 8 deletions

@ -18,13 +18,13 @@ class Request {
protected bool $apiKeyAllowed; protected bool $apiKeyAllowed;
protected bool $csrfTokenRequired; protected bool $csrfTokenRequired;
private array $aDefaultParams; private array $defaultParams;
private array $allowedMethods; private array $allowedMethods;
private bool $externalCall; private bool $externalCall;
public function __construct(User $user, bool $externalCall = false, array $params = array()) { public function __construct(User $user, bool $externalCall = false, array $params = array()) {
$this->user = $user; $this->user = $user;
$this->aDefaultParams = $params; $this->defaultParams = $params;
$this->success = false; $this->success = false;
$this->result = array(); $this->result = array();
@ -77,7 +77,6 @@ class Request {
} }
public function execute($values = array()): bool { public function execute($values = array()): bool {
$this->params = $this->aDefaultParams;
$this->success = false; $this->success = false;
$this->result = array(); $this->result = array();
$this->lastError = ''; $this->lastError = '';
@ -181,7 +180,8 @@ class Request {
} }
protected function getParam($name) { protected function getParam($name) {
return $this->params[$name] ?? NULL; // i don't know why phpstorm
return (isset($this->params[$name]) ? $this->params[$name]->value : NULL);
} }
public function isPublic(): bool { public function isPublic(): bool {

@ -21,7 +21,7 @@ class Delete extends Query {
return $this; return $this;
} }
public function execute() { public function execute(): bool {
return $this->sql->executeDelete($this); return $this->sql->executeDelete($this);
} }

@ -19,6 +19,7 @@ abstract class Query {
return $this; return $this;
} }
public abstract function execute(): bool; // can actually return bool|array (depending on success and query type)
public abstract function execute();
} }

@ -80,7 +80,7 @@ class Select extends Query {
return $this; return $this;
} }
public function execute(): bool { public function execute() {
return $this->sql->executeSelect($this); return $this->sql->executeSelect($this);
} }

@ -28,7 +28,7 @@ class Update extends Query {
return $this; return $this;
} }
public function execute(): bool { public function execute() {
return $this->sql->executeUpdate($this); return $this->sql->executeUpdate($this);
} }