From f04b153359e84c9808c140cfbbdc6d3eb481793a Mon Sep 17 00:00:00 2001 From: s3inlc Date: Thu, 2 Jul 2026 16:06:39 +0200 Subject: [PATCH 01/19] some first updates to make phpstan happy --- src/dba/AbstractModel.php | 7 +++- src/dba/AbstractModelFactory.php | 34 +++++++++---------- src/dba/Join.php | 2 ++ src/dba/JoinFilter.php | 2 +- src/dba/PaginationFilter.php | 4 +-- .../models/AbstractModelFactory.template.txt | 6 +++- src/dba/models/AccessGroupAgentFactory.php | 6 +++- src/dba/models/AccessGroupFactory.php | 6 +++- src/dba/models/AccessGroupUserFactory.php | 6 +++- src/dba/models/AgentBinaryFactory.php | 6 +++- src/dba/models/AgentErrorFactory.php | 6 +++- src/dba/models/AgentFactory.php | 10 ++++-- src/dba/models/AgentStatFactory.php | 6 +++- src/dba/models/AgentZapFactory.php | 6 +++- src/dba/models/ApiGroupFactory.php | 6 +++- src/dba/models/ApiKeyFactory.php | 6 +++- src/dba/models/AssignmentFactory.php | 6 +++- src/dba/models/ChunkFactory.php | 6 +++- src/dba/models/ConfigFactory.php | 6 +++- src/dba/models/ConfigSectionFactory.php | 6 +++- src/dba/models/CrackerBinaryFactory.php | 6 +++- src/dba/models/CrackerBinaryTypeFactory.php | 6 +++- src/dba/models/FileDeleteFactory.php | 6 +++- src/dba/models/FileDownloadFactory.php | 6 +++- src/dba/models/FileFactory.php | 6 +++- src/dba/models/FilePretaskFactory.php | 6 +++- src/dba/models/FileTaskFactory.php | 6 +++- src/dba/models/HashBinaryFactory.php | 6 +++- src/dba/models/HashFactory.php | 6 +++- src/dba/models/HashTypeFactory.php | 6 +++- src/dba/models/HashlistFactory.php | 6 +++- src/dba/models/HashlistHashlistFactory.php | 6 +++- src/dba/models/HealthCheckAgentFactory.php | 6 +++- src/dba/models/HealthCheckFactory.php | 6 +++- src/dba/models/JwtApiKeyFactory.php | 6 +++- src/dba/models/LogEntryFactory.php | 6 +++- src/dba/models/NotificationSettingFactory.php | 6 +++- src/dba/models/PreprocessorFactory.php | 6 +++- src/dba/models/PretaskFactory.php | 6 +++- src/dba/models/RegVoucherFactory.php | 6 +++- src/dba/models/RightGroupFactory.php | 6 +++- src/dba/models/SessionFactory.php | 6 +++- src/dba/models/SpeedFactory.php | 6 +++- src/dba/models/StoredValueFactory.php | 6 +++- src/dba/models/SupertaskFactory.php | 6 +++- src/dba/models/SupertaskPretaskFactory.php | 6 +++- src/dba/models/TaskDebugOutputFactory.php | 6 +++- src/dba/models/TaskFactory.php | 6 +++- src/dba/models/TaskWrapperDisplayFactory.php | 6 +++- src/dba/models/TaskWrapperFactory.php | 6 +++- src/dba/models/UserFactory.php | 6 +++- src/dba/models/ZapFactory.php | 6 +++- src/dba/models/_sqlx_migrationsFactory.php | 6 +++- src/inc/api/APIBasic.php | 13 ++++--- src/inc/api/APICheckClientVersion.php | 2 +- src/inc/api/APIClientError.php | 2 +- src/inc/api/APIDeRegisterAgent.php | 2 +- src/inc/api/APIDownloadBinary.php | 2 +- src/inc/api/APIGetChunk.php | 2 +- src/inc/api/APIGetFile.php | 2 +- src/inc/api/APIGetFileStatus.php | 2 +- src/inc/api/APIGetFound.php | 2 +- src/inc/api/APIGetHashlist.php | 2 +- src/inc/api/APIGetHealthCheck.php | 2 +- src/inc/api/APIGetTask.php | 2 +- src/inc/api/APILogin.php | 2 +- src/inc/api/APIRegisterAgent.php | 2 +- src/inc/api/APISendBenchmark.php | 2 +- src/inc/api/APISendHealthCheck.php | 2 +- src/inc/api/APISendKeyspace.php | 2 +- src/inc/api/APISendProgress.php | 2 +- src/inc/api/APITestConnection.php | 2 +- src/inc/api/APIUpdateClientInformation.php | 2 +- src/inc/apiv2/common/AbstractModelAPI.php | 2 +- 74 files changed, 297 insertions(+), 97 deletions(-) diff --git a/src/dba/AbstractModel.php b/src/dba/AbstractModel.php index 6b4b7072a..271dbc313 100755 --- a/src/dba/AbstractModel.php +++ b/src/dba/AbstractModel.php @@ -22,7 +22,7 @@ abstract function getPrimaryKeyValue(); /** * This function is used to set the id to the real database value * @param $id string - * @return + * @return void */ abstract function setId(string $id): void; @@ -30,4 +30,9 @@ abstract function setId(string $id): void; * this function returns the models id */ abstract function getId(); + + /** + * The function is used to retrieve information about the attributes of the model + */ + abstract static function getFeatures(); } diff --git a/src/dba/AbstractModelFactory.php b/src/dba/AbstractModelFactory.php index 8c05d0bcf..e36d6bdc3 100755 --- a/src/dba/AbstractModelFactory.php +++ b/src/dba/AbstractModelFactory.php @@ -102,7 +102,7 @@ private static function isBinaryColumn(AbstractModel $model, string $key): bool $features = $model->getFeatures(); return isset($features[$key]['type']) && $features[$key]['type'] === 'binary'; } - + /** * @param AbstractModel $model * @param string $key unmapped column name @@ -115,7 +115,7 @@ private static function binaryPlaceholder(AbstractModel $model, string $key): st $dbType = StartupConfig::getInstance()->getDatabaseType(); return $dbType === 'mysql' ? "UNHEX(?)" : "decode(?, 'hex')"; } - + /** * Get all the attribute keys of a model prepared with the mapping prefix where needed. The returned keys are then named * exactly how they are present in the database. @@ -290,13 +290,13 @@ public function update(AbstractModel $model): PDOStatement { /** * Atomically sets the given keys of this model to the given values without setting all other values (like ->update() does) * - * Returns the return of PDO::execute() - * @param $model AbstractModel primary key of model + * Returns the return of PDO::execute() or null if nothing was executed + * @param AbstractModel $model AbstractModel primary key of model * @param $arr array key-value associations for update - * @return PDOStatement + * @return AbstractModel * @throws Exception */ - public function mset(AbstractModel &$model, array $arr): PDOStatement { + public function mset(AbstractModel $model, array $arr): AbstractModel { $query = "UPDATE " . $this->getMappedModelTable() . " SET "; $elements = []; $values = []; @@ -312,8 +312,7 @@ public function mset(AbstractModel &$model, array $arr): PDOStatement { $stmt = $this->getDB()->prepare($query); $stmt->execute($values); - $model = $this->get($model->getPrimaryKeyValue()); - return $stmt; + return $this->get($model->getPrimaryKeyValue()); } /** @@ -654,7 +653,7 @@ public function countFilter(array $options): int { * @return AbstractModel|null the with pk associated model or Null * @throws Exception */ - public function get($pk) { + public function get($pk): ?AbstractModel { return $this->getFromDB($pk); } @@ -700,10 +699,10 @@ public function getFromDB($pk): ?AbstractModel { * $options[Factory::JOIN] is an array of JoinFilter options * * @param $options array containing option settings - * @return AbstractModel[]|AbstractModel Returns a list of matching objects or Null + * @return AbstractModel[] Returns a list of matching objects * @throws Exception */ - private function filterWithJoin(array $options): array|AbstractModel { + private function filterWithJoin(array $options): array { $vals = array(); $joins = $this->getJoins($options); $factories = array($this); @@ -734,7 +733,7 @@ private function filterWithJoin(array $options): array|AbstractModel { if (array_key_exists(Factory::FILTER, $options)) { $query .= $this->applyFilters($vals, $options[Factory::FILTER]); } - + // Apply order filter if (!array_key_exists(Factory::ORDER, $options)) { // Add a asc order on the primary keys as a standard @@ -750,7 +749,7 @@ private function filterWithJoin(array $options): array|AbstractModel { $dbh = self::getDB(); $stmt = $dbh->prepare($query); $stmt->execute($vals); - + $res = array(); $values = array(); foreach ($factories as $factory) { @@ -867,19 +866,18 @@ private function applyFilters(&$vals, Filter|array $filters, bool $isJoinFilter } return " WHERE " . implode(" AND ", $parts); } - + /** * @param $vals * @param $element - * @return array */ - private function getAllArrayValues(&$vals, $element) { + private function getAllArrayValues(&$vals, $element): void { if (!is_array($element)) { $vals[] = $element; return; } - - foreach($element as $v) { + + foreach ($element as $v) { $this->getAllArrayValues($vals, $v); } } diff --git a/src/dba/Join.php b/src/dba/Join.php index a464581b7..19b3cb780 100644 --- a/src/dba/Join.php +++ b/src/dba/Join.php @@ -5,6 +5,8 @@ abstract class Join { abstract function getOtherFactory(): AbstractModelFactory; + abstract function getOverrideOwnFactory(): ?AbstractModelFactory; + abstract function getMatch1(): string; abstract function getMatch2(): string; diff --git a/src/dba/JoinFilter.php b/src/dba/JoinFilter.php index f980a429c..6bf1870d9 100755 --- a/src/dba/JoinFilter.php +++ b/src/dba/JoinFilter.php @@ -3,7 +3,7 @@ namespace Hashtopolis\dba; class JoinFilter extends Join { - private ?AbstractModelFactory $otherFactory; + private AbstractModelFactory $otherFactory; private string $match1; private string $match2; diff --git a/src/dba/PaginationFilter.php b/src/dba/PaginationFilter.php index e4e3a619e..791ef19a2 100644 --- a/src/dba/PaginationFilter.php +++ b/src/dba/PaginationFilter.php @@ -9,9 +9,7 @@ class PaginationFilter extends Filter { private $tieBreakerKey; private $tieBreakerValue; private $filters; - /** - * @var - */ + private ?AbstractModelFactory $overrideFactory; function __construct($key, $value, $operator, $tieBreakerKey, $tieBreakerValue, $filters = [], $overrideFactory = null) { diff --git a/src/dba/models/AbstractModelFactory.template.txt b/src/dba/models/AbstractModelFactory.template.txt index 5ee16a9c1..e2274e494 100644 --- a/src/dba/models/AbstractModelFactory.template.txt +++ b/src/dba/models/AbstractModelFactory.template.txt @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { /** * @param array $options * @param bool $single - * @return __MODEL_NAME__|__MODEL_NAME__[] + * @return __MODEL_NAME__|array|null + * @throws Exception */ function filter(array $options, bool $single = false): __MODEL_NAME__|array|null { $join = false; @@ -77,6 +79,7 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { /** * @param string $pk * @return ?__MODEL_NAME__ + * @throws Exception */ function get($pk): ?__MODEL_NAME__ { return Util::cast(parent::get($pk), __MODEL_NAME__::class); @@ -85,6 +88,7 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { /** * @param __MODEL_NAME__ $model * @return __MODEL_NAME__ + * @throws Exception */ function save($model): __MODEL_NAME__ { return Util::cast(parent::save($model), __MODEL_NAME__::class); diff --git a/src/dba/models/AccessGroupAgentFactory.php b/src/dba/models/AccessGroupAgentFactory.php index bc7720a23..b788bfcd4 100644 --- a/src/dba/models/AccessGroupAgentFactory.php +++ b/src/dba/models/AccessGroupAgentFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): AccessGroupAgent { /** * @param array $options * @param bool $single - * @return AccessGroupAgent|AccessGroupAgent[] + * @return AccessGroupAgent|array|null + * @throws Exception */ function filter(array $options, bool $single = false): AccessGroupAgent|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): AccessGroupAgent|array|nu /** * @param string $pk * @return ?AccessGroupAgent + * @throws Exception */ function get($pk): ?AccessGroupAgent { return Util::cast(parent::get($pk), AccessGroupAgent::class); @@ -85,6 +88,7 @@ function get($pk): ?AccessGroupAgent { /** * @param AccessGroupAgent $model * @return AccessGroupAgent + * @throws Exception */ function save($model): AccessGroupAgent { return Util::cast(parent::save($model), AccessGroupAgent::class); diff --git a/src/dba/models/AccessGroupFactory.php b/src/dba/models/AccessGroupFactory.php index 9e839ec01..92c640351 100644 --- a/src/dba/models/AccessGroupFactory.php +++ b/src/dba/models/AccessGroupFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): AccessGroup { /** * @param array $options * @param bool $single - * @return AccessGroup|AccessGroup[] + * @return AccessGroup|array|null + * @throws Exception */ function filter(array $options, bool $single = false): AccessGroup|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): AccessGroup|array|null { /** * @param string $pk * @return ?AccessGroup + * @throws Exception */ function get($pk): ?AccessGroup { return Util::cast(parent::get($pk), AccessGroup::class); @@ -85,6 +88,7 @@ function get($pk): ?AccessGroup { /** * @param AccessGroup $model * @return AccessGroup + * @throws Exception */ function save($model): AccessGroup { return Util::cast(parent::save($model), AccessGroup::class); diff --git a/src/dba/models/AccessGroupUserFactory.php b/src/dba/models/AccessGroupUserFactory.php index 3ba0d1aa7..128981da4 100644 --- a/src/dba/models/AccessGroupUserFactory.php +++ b/src/dba/models/AccessGroupUserFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): AccessGroupUser { /** * @param array $options * @param bool $single - * @return AccessGroupUser|AccessGroupUser[] + * @return AccessGroupUser|array|null + * @throws Exception */ function filter(array $options, bool $single = false): AccessGroupUser|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): AccessGroupUser|array|nul /** * @param string $pk * @return ?AccessGroupUser + * @throws Exception */ function get($pk): ?AccessGroupUser { return Util::cast(parent::get($pk), AccessGroupUser::class); @@ -85,6 +88,7 @@ function get($pk): ?AccessGroupUser { /** * @param AccessGroupUser $model * @return AccessGroupUser + * @throws Exception */ function save($model): AccessGroupUser { return Util::cast(parent::save($model), AccessGroupUser::class); diff --git a/src/dba/models/AgentBinaryFactory.php b/src/dba/models/AgentBinaryFactory.php index 24e719480..88eebe1f6 100644 --- a/src/dba/models/AgentBinaryFactory.php +++ b/src/dba/models/AgentBinaryFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): AgentBinary { /** * @param array $options * @param bool $single - * @return AgentBinary|AgentBinary[] + * @return AgentBinary|array|null + * @throws Exception */ function filter(array $options, bool $single = false): AgentBinary|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): AgentBinary|array|null { /** * @param string $pk * @return ?AgentBinary + * @throws Exception */ function get($pk): ?AgentBinary { return Util::cast(parent::get($pk), AgentBinary::class); @@ -85,6 +88,7 @@ function get($pk): ?AgentBinary { /** * @param AgentBinary $model * @return AgentBinary + * @throws Exception */ function save($model): AgentBinary { return Util::cast(parent::save($model), AgentBinary::class); diff --git a/src/dba/models/AgentErrorFactory.php b/src/dba/models/AgentErrorFactory.php index 8c2588120..755c3707c 100644 --- a/src/dba/models/AgentErrorFactory.php +++ b/src/dba/models/AgentErrorFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): AgentError { /** * @param array $options * @param bool $single - * @return AgentError|AgentError[] + * @return AgentError|array|null + * @throws Exception */ function filter(array $options, bool $single = false): AgentError|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): AgentError|array|null { /** * @param string $pk * @return ?AgentError + * @throws Exception */ function get($pk): ?AgentError { return Util::cast(parent::get($pk), AgentError::class); @@ -85,6 +88,7 @@ function get($pk): ?AgentError { /** * @param AgentError $model * @return AgentError + * @throws Exception */ function save($model): AgentError { return Util::cast(parent::save($model), AgentError::class); diff --git a/src/dba/models/AgentFactory.php b/src/dba/models/AgentFactory.php index 5bd4a2378..4d7cb7e8f 100644 --- a/src/dba/models/AgentFactory.php +++ b/src/dba/models/AgentFactory.php @@ -2,8 +2,11 @@ namespace Hashtopolis\dba\models; +use Exception; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; +use PDOStatement; class AgentFactory extends AbstractModelFactory { function getModelName(): string { @@ -13,7 +16,7 @@ function getModelName(): string { function getModelTable(): string { return "Agent"; } - + function isMapping(): bool { return False; } @@ -50,7 +53,8 @@ function createObjectFromDict($pk, $dict): Agent { /** * @param array $options * @param bool $single - * @return Agent|Agent[] + * @return Agent|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Agent|array|null { $join = false; @@ -77,6 +81,7 @@ function filter(array $options, bool $single = false): Agent|array|null { /** * @param string $pk * @return ?Agent + * @throws Exception */ function get($pk): ?Agent { return Util::cast(parent::get($pk), Agent::class); @@ -85,6 +90,7 @@ function get($pk): ?Agent { /** * @param Agent $model * @return Agent + * @throws Exception */ function save($model): Agent { return Util::cast(parent::save($model), Agent::class); diff --git a/src/dba/models/AgentStatFactory.php b/src/dba/models/AgentStatFactory.php index 885709e38..88a6e8bb3 100644 --- a/src/dba/models/AgentStatFactory.php +++ b/src/dba/models/AgentStatFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): AgentStat { /** * @param array $options * @param bool $single - * @return AgentStat|AgentStat[] + * @return AgentStat|array|null + * @throws Exception */ function filter(array $options, bool $single = false): AgentStat|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): AgentStat|array|null { /** * @param string $pk * @return ?AgentStat + * @throws Exception */ function get($pk): ?AgentStat { return Util::cast(parent::get($pk), AgentStat::class); @@ -85,6 +88,7 @@ function get($pk): ?AgentStat { /** * @param AgentStat $model * @return AgentStat + * @throws Exception */ function save($model): AgentStat { return Util::cast(parent::save($model), AgentStat::class); diff --git a/src/dba/models/AgentZapFactory.php b/src/dba/models/AgentZapFactory.php index 733672c98..ce5ba52d2 100644 --- a/src/dba/models/AgentZapFactory.php +++ b/src/dba/models/AgentZapFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): AgentZap { /** * @param array $options * @param bool $single - * @return AgentZap|AgentZap[] + * @return AgentZap|array|null + * @throws Exception */ function filter(array $options, bool $single = false): AgentZap|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): AgentZap|array|null { /** * @param string $pk * @return ?AgentZap + * @throws Exception */ function get($pk): ?AgentZap { return Util::cast(parent::get($pk), AgentZap::class); @@ -85,6 +88,7 @@ function get($pk): ?AgentZap { /** * @param AgentZap $model * @return AgentZap + * @throws Exception */ function save($model): AgentZap { return Util::cast(parent::save($model), AgentZap::class); diff --git a/src/dba/models/ApiGroupFactory.php b/src/dba/models/ApiGroupFactory.php index abb121e19..333f0b0f1 100644 --- a/src/dba/models/ApiGroupFactory.php +++ b/src/dba/models/ApiGroupFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): ApiGroup { /** * @param array $options * @param bool $single - * @return ApiGroup|ApiGroup[] + * @return ApiGroup|array|null + * @throws Exception */ function filter(array $options, bool $single = false): ApiGroup|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): ApiGroup|array|null { /** * @param string $pk * @return ?ApiGroup + * @throws Exception */ function get($pk): ?ApiGroup { return Util::cast(parent::get($pk), ApiGroup::class); @@ -85,6 +88,7 @@ function get($pk): ?ApiGroup { /** * @param ApiGroup $model * @return ApiGroup + * @throws Exception */ function save($model): ApiGroup { return Util::cast(parent::save($model), ApiGroup::class); diff --git a/src/dba/models/ApiKeyFactory.php b/src/dba/models/ApiKeyFactory.php index e25395ace..51c09e8a6 100644 --- a/src/dba/models/ApiKeyFactory.php +++ b/src/dba/models/ApiKeyFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): ApiKey { /** * @param array $options * @param bool $single - * @return ApiKey|ApiKey[] + * @return ApiKey|array|null + * @throws Exception */ function filter(array $options, bool $single = false): ApiKey|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): ApiKey|array|null { /** * @param string $pk * @return ?ApiKey + * @throws Exception */ function get($pk): ?ApiKey { return Util::cast(parent::get($pk), ApiKey::class); @@ -85,6 +88,7 @@ function get($pk): ?ApiKey { /** * @param ApiKey $model * @return ApiKey + * @throws Exception */ function save($model): ApiKey { return Util::cast(parent::save($model), ApiKey::class); diff --git a/src/dba/models/AssignmentFactory.php b/src/dba/models/AssignmentFactory.php index 577c4a848..402bf6a32 100644 --- a/src/dba/models/AssignmentFactory.php +++ b/src/dba/models/AssignmentFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Assignment { /** * @param array $options * @param bool $single - * @return Assignment|Assignment[] + * @return Assignment|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Assignment|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Assignment|array|null { /** * @param string $pk * @return ?Assignment + * @throws Exception */ function get($pk): ?Assignment { return Util::cast(parent::get($pk), Assignment::class); @@ -85,6 +88,7 @@ function get($pk): ?Assignment { /** * @param Assignment $model * @return Assignment + * @throws Exception */ function save($model): Assignment { return Util::cast(parent::save($model), Assignment::class); diff --git a/src/dba/models/ChunkFactory.php b/src/dba/models/ChunkFactory.php index e5cd3fc91..198b285f1 100644 --- a/src/dba/models/ChunkFactory.php +++ b/src/dba/models/ChunkFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Chunk { /** * @param array $options * @param bool $single - * @return Chunk|Chunk[] + * @return Chunk|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Chunk|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Chunk|array|null { /** * @param string $pk * @return ?Chunk + * @throws Exception */ function get($pk): ?Chunk { return Util::cast(parent::get($pk), Chunk::class); @@ -85,6 +88,7 @@ function get($pk): ?Chunk { /** * @param Chunk $model * @return Chunk + * @throws Exception */ function save($model): Chunk { return Util::cast(parent::save($model), Chunk::class); diff --git a/src/dba/models/ConfigFactory.php b/src/dba/models/ConfigFactory.php index 7cbe8a640..18b383991 100644 --- a/src/dba/models/ConfigFactory.php +++ b/src/dba/models/ConfigFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Config { /** * @param array $options * @param bool $single - * @return Config|Config[] + * @return Config|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Config|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Config|array|null { /** * @param string $pk * @return ?Config + * @throws Exception */ function get($pk): ?Config { return Util::cast(parent::get($pk), Config::class); @@ -85,6 +88,7 @@ function get($pk): ?Config { /** * @param Config $model * @return Config + * @throws Exception */ function save($model): Config { return Util::cast(parent::save($model), Config::class); diff --git a/src/dba/models/ConfigSectionFactory.php b/src/dba/models/ConfigSectionFactory.php index ba9f2b137..dd98dd409 100644 --- a/src/dba/models/ConfigSectionFactory.php +++ b/src/dba/models/ConfigSectionFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): ConfigSection { /** * @param array $options * @param bool $single - * @return ConfigSection|ConfigSection[] + * @return ConfigSection|array|null + * @throws Exception */ function filter(array $options, bool $single = false): ConfigSection|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): ConfigSection|array|null /** * @param string $pk * @return ?ConfigSection + * @throws Exception */ function get($pk): ?ConfigSection { return Util::cast(parent::get($pk), ConfigSection::class); @@ -85,6 +88,7 @@ function get($pk): ?ConfigSection { /** * @param ConfigSection $model * @return ConfigSection + * @throws Exception */ function save($model): ConfigSection { return Util::cast(parent::save($model), ConfigSection::class); diff --git a/src/dba/models/CrackerBinaryFactory.php b/src/dba/models/CrackerBinaryFactory.php index 3a7f905f8..30bd6af50 100644 --- a/src/dba/models/CrackerBinaryFactory.php +++ b/src/dba/models/CrackerBinaryFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): CrackerBinary { /** * @param array $options * @param bool $single - * @return CrackerBinary|CrackerBinary[] + * @return CrackerBinary|array|null + * @throws Exception */ function filter(array $options, bool $single = false): CrackerBinary|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): CrackerBinary|array|null /** * @param string $pk * @return ?CrackerBinary + * @throws Exception */ function get($pk): ?CrackerBinary { return Util::cast(parent::get($pk), CrackerBinary::class); @@ -85,6 +88,7 @@ function get($pk): ?CrackerBinary { /** * @param CrackerBinary $model * @return CrackerBinary + * @throws Exception */ function save($model): CrackerBinary { return Util::cast(parent::save($model), CrackerBinary::class); diff --git a/src/dba/models/CrackerBinaryTypeFactory.php b/src/dba/models/CrackerBinaryTypeFactory.php index 40a04fe95..e11855f12 100644 --- a/src/dba/models/CrackerBinaryTypeFactory.php +++ b/src/dba/models/CrackerBinaryTypeFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): CrackerBinaryType { /** * @param array $options * @param bool $single - * @return CrackerBinaryType|CrackerBinaryType[] + * @return CrackerBinaryType|array|null + * @throws Exception */ function filter(array $options, bool $single = false): CrackerBinaryType|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): CrackerBinaryType|array|n /** * @param string $pk * @return ?CrackerBinaryType + * @throws Exception */ function get($pk): ?CrackerBinaryType { return Util::cast(parent::get($pk), CrackerBinaryType::class); @@ -85,6 +88,7 @@ function get($pk): ?CrackerBinaryType { /** * @param CrackerBinaryType $model * @return CrackerBinaryType + * @throws Exception */ function save($model): CrackerBinaryType { return Util::cast(parent::save($model), CrackerBinaryType::class); diff --git a/src/dba/models/FileDeleteFactory.php b/src/dba/models/FileDeleteFactory.php index e8e7e69e0..620dae4c2 100644 --- a/src/dba/models/FileDeleteFactory.php +++ b/src/dba/models/FileDeleteFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): FileDelete { /** * @param array $options * @param bool $single - * @return FileDelete|FileDelete[] + * @return FileDelete|array|null + * @throws Exception */ function filter(array $options, bool $single = false): FileDelete|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): FileDelete|array|null { /** * @param string $pk * @return ?FileDelete + * @throws Exception */ function get($pk): ?FileDelete { return Util::cast(parent::get($pk), FileDelete::class); @@ -85,6 +88,7 @@ function get($pk): ?FileDelete { /** * @param FileDelete $model * @return FileDelete + * @throws Exception */ function save($model): FileDelete { return Util::cast(parent::save($model), FileDelete::class); diff --git a/src/dba/models/FileDownloadFactory.php b/src/dba/models/FileDownloadFactory.php index b249fbfc0..887372ee4 100644 --- a/src/dba/models/FileDownloadFactory.php +++ b/src/dba/models/FileDownloadFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): FileDownload { /** * @param array $options * @param bool $single - * @return FileDownload|FileDownload[] + * @return FileDownload|array|null + * @throws Exception */ function filter(array $options, bool $single = false): FileDownload|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): FileDownload|array|null { /** * @param string $pk * @return ?FileDownload + * @throws Exception */ function get($pk): ?FileDownload { return Util::cast(parent::get($pk), FileDownload::class); @@ -85,6 +88,7 @@ function get($pk): ?FileDownload { /** * @param FileDownload $model * @return FileDownload + * @throws Exception */ function save($model): FileDownload { return Util::cast(parent::save($model), FileDownload::class); diff --git a/src/dba/models/FileFactory.php b/src/dba/models/FileFactory.php index 847e9da5f..265256266 100644 --- a/src/dba/models/FileFactory.php +++ b/src/dba/models/FileFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): File { /** * @param array $options * @param bool $single - * @return File|File[] + * @return File|array|null + * @throws Exception */ function filter(array $options, bool $single = false): File|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): File|array|null { /** * @param string $pk * @return ?File + * @throws Exception */ function get($pk): ?File { return Util::cast(parent::get($pk), File::class); @@ -85,6 +88,7 @@ function get($pk): ?File { /** * @param File $model * @return File + * @throws Exception */ function save($model): File { return Util::cast(parent::save($model), File::class); diff --git a/src/dba/models/FilePretaskFactory.php b/src/dba/models/FilePretaskFactory.php index a75a13eeb..61287e65a 100644 --- a/src/dba/models/FilePretaskFactory.php +++ b/src/dba/models/FilePretaskFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): FilePretask { /** * @param array $options * @param bool $single - * @return FilePretask|FilePretask[] + * @return FilePretask|array|null + * @throws Exception */ function filter(array $options, bool $single = false): FilePretask|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): FilePretask|array|null { /** * @param string $pk * @return ?FilePretask + * @throws Exception */ function get($pk): ?FilePretask { return Util::cast(parent::get($pk), FilePretask::class); @@ -85,6 +88,7 @@ function get($pk): ?FilePretask { /** * @param FilePretask $model * @return FilePretask + * @throws Exception */ function save($model): FilePretask { return Util::cast(parent::save($model), FilePretask::class); diff --git a/src/dba/models/FileTaskFactory.php b/src/dba/models/FileTaskFactory.php index 7a3e1a97e..4089c5ebd 100644 --- a/src/dba/models/FileTaskFactory.php +++ b/src/dba/models/FileTaskFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): FileTask { /** * @param array $options * @param bool $single - * @return FileTask|FileTask[] + * @return FileTask|array|null + * @throws Exception */ function filter(array $options, bool $single = false): FileTask|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): FileTask|array|null { /** * @param string $pk * @return ?FileTask + * @throws Exception */ function get($pk): ?FileTask { return Util::cast(parent::get($pk), FileTask::class); @@ -85,6 +88,7 @@ function get($pk): ?FileTask { /** * @param FileTask $model * @return FileTask + * @throws Exception */ function save($model): FileTask { return Util::cast(parent::save($model), FileTask::class); diff --git a/src/dba/models/HashBinaryFactory.php b/src/dba/models/HashBinaryFactory.php index d4358abd0..1c0f7ac97 100644 --- a/src/dba/models/HashBinaryFactory.php +++ b/src/dba/models/HashBinaryFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): HashBinary { /** * @param array $options * @param bool $single - * @return HashBinary|HashBinary[] + * @return HashBinary|array|null + * @throws Exception */ function filter(array $options, bool $single = false): HashBinary|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): HashBinary|array|null { /** * @param string $pk * @return ?HashBinary + * @throws Exception */ function get($pk): ?HashBinary { return Util::cast(parent::get($pk), HashBinary::class); @@ -85,6 +88,7 @@ function get($pk): ?HashBinary { /** * @param HashBinary $model * @return HashBinary + * @throws Exception */ function save($model): HashBinary { return Util::cast(parent::save($model), HashBinary::class); diff --git a/src/dba/models/HashFactory.php b/src/dba/models/HashFactory.php index f30fc0eef..d1ee95e70 100644 --- a/src/dba/models/HashFactory.php +++ b/src/dba/models/HashFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Hash { /** * @param array $options * @param bool $single - * @return Hash|Hash[] + * @return Hash|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Hash|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Hash|array|null { /** * @param string $pk * @return ?Hash + * @throws Exception */ function get($pk): ?Hash { return Util::cast(parent::get($pk), Hash::class); @@ -85,6 +88,7 @@ function get($pk): ?Hash { /** * @param Hash $model * @return Hash + * @throws Exception */ function save($model): Hash { return Util::cast(parent::save($model), Hash::class); diff --git a/src/dba/models/HashTypeFactory.php b/src/dba/models/HashTypeFactory.php index afe6886b9..6540436f1 100644 --- a/src/dba/models/HashTypeFactory.php +++ b/src/dba/models/HashTypeFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): HashType { /** * @param array $options * @param bool $single - * @return HashType|HashType[] + * @return HashType|array|null + * @throws Exception */ function filter(array $options, bool $single = false): HashType|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): HashType|array|null { /** * @param string $pk * @return ?HashType + * @throws Exception */ function get($pk): ?HashType { return Util::cast(parent::get($pk), HashType::class); @@ -85,6 +88,7 @@ function get($pk): ?HashType { /** * @param HashType $model * @return HashType + * @throws Exception */ function save($model): HashType { return Util::cast(parent::save($model), HashType::class); diff --git a/src/dba/models/HashlistFactory.php b/src/dba/models/HashlistFactory.php index 56e567f0a..87768caa2 100644 --- a/src/dba/models/HashlistFactory.php +++ b/src/dba/models/HashlistFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Hashlist { /** * @param array $options * @param bool $single - * @return Hashlist|Hashlist[] + * @return Hashlist|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Hashlist|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Hashlist|array|null { /** * @param string $pk * @return ?Hashlist + * @throws Exception */ function get($pk): ?Hashlist { return Util::cast(parent::get($pk), Hashlist::class); @@ -85,6 +88,7 @@ function get($pk): ?Hashlist { /** * @param Hashlist $model * @return Hashlist + * @throws Exception */ function save($model): Hashlist { return Util::cast(parent::save($model), Hashlist::class); diff --git a/src/dba/models/HashlistHashlistFactory.php b/src/dba/models/HashlistHashlistFactory.php index 379458f92..729ab2720 100644 --- a/src/dba/models/HashlistHashlistFactory.php +++ b/src/dba/models/HashlistHashlistFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): HashlistHashlist { /** * @param array $options * @param bool $single - * @return HashlistHashlist|HashlistHashlist[] + * @return HashlistHashlist|array|null + * @throws Exception */ function filter(array $options, bool $single = false): HashlistHashlist|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): HashlistHashlist|array|nu /** * @param string $pk * @return ?HashlistHashlist + * @throws Exception */ function get($pk): ?HashlistHashlist { return Util::cast(parent::get($pk), HashlistHashlist::class); @@ -85,6 +88,7 @@ function get($pk): ?HashlistHashlist { /** * @param HashlistHashlist $model * @return HashlistHashlist + * @throws Exception */ function save($model): HashlistHashlist { return Util::cast(parent::save($model), HashlistHashlist::class); diff --git a/src/dba/models/HealthCheckAgentFactory.php b/src/dba/models/HealthCheckAgentFactory.php index d7f04abf0..20116f4d9 100644 --- a/src/dba/models/HealthCheckAgentFactory.php +++ b/src/dba/models/HealthCheckAgentFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -51,7 +52,8 @@ function createObjectFromDict($pk, $dict): HealthCheckAgent { /** * @param array $options * @param bool $single - * @return HealthCheckAgent|HealthCheckAgent[] + * @return HealthCheckAgent|array|null + * @throws Exception */ function filter(array $options, bool $single = false): HealthCheckAgent|array|null { $join = false; @@ -78,6 +80,7 @@ function filter(array $options, bool $single = false): HealthCheckAgent|array|nu /** * @param string $pk * @return ?HealthCheckAgent + * @throws Exception */ function get($pk): ?HealthCheckAgent { return Util::cast(parent::get($pk), HealthCheckAgent::class); @@ -86,6 +89,7 @@ function get($pk): ?HealthCheckAgent { /** * @param HealthCheckAgent $model * @return HealthCheckAgent + * @throws Exception */ function save($model): HealthCheckAgent { return Util::cast(parent::save($model), HealthCheckAgent::class); diff --git a/src/dba/models/HealthCheckFactory.php b/src/dba/models/HealthCheckFactory.php index 817302082..e805d21e6 100644 --- a/src/dba/models/HealthCheckFactory.php +++ b/src/dba/models/HealthCheckFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): HealthCheck { /** * @param array $options * @param bool $single - * @return HealthCheck|HealthCheck[] + * @return HealthCheck|array|null + * @throws Exception */ function filter(array $options, bool $single = false): HealthCheck|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): HealthCheck|array|null { /** * @param string $pk * @return ?HealthCheck + * @throws Exception */ function get($pk): ?HealthCheck { return Util::cast(parent::get($pk), HealthCheck::class); @@ -85,6 +88,7 @@ function get($pk): ?HealthCheck { /** * @param HealthCheck $model * @return HealthCheck + * @throws Exception */ function save($model): HealthCheck { return Util::cast(parent::save($model), HealthCheck::class); diff --git a/src/dba/models/JwtApiKeyFactory.php b/src/dba/models/JwtApiKeyFactory.php index 8ba88d68e..f4b548141 100644 --- a/src/dba/models/JwtApiKeyFactory.php +++ b/src/dba/models/JwtApiKeyFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): JwtApiKey { /** * @param array $options * @param bool $single - * @return JwtApiKey|JwtApiKey[] + * @return JwtApiKey|array|null + * @throws Exception */ function filter(array $options, bool $single = false): JwtApiKey|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): JwtApiKey|array|null { /** * @param string $pk * @return ?JwtApiKey + * @throws Exception */ function get($pk): ?JwtApiKey { return Util::cast(parent::get($pk), JwtApiKey::class); @@ -85,6 +88,7 @@ function get($pk): ?JwtApiKey { /** * @param JwtApiKey $model * @return JwtApiKey + * @throws Exception */ function save($model): JwtApiKey { return Util::cast(parent::save($model), JwtApiKey::class); diff --git a/src/dba/models/LogEntryFactory.php b/src/dba/models/LogEntryFactory.php index ddcb4d849..d9f52bc45 100644 --- a/src/dba/models/LogEntryFactory.php +++ b/src/dba/models/LogEntryFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): LogEntry { /** * @param array $options * @param bool $single - * @return LogEntry|LogEntry[] + * @return LogEntry|array|null + * @throws Exception */ function filter(array $options, bool $single = false): LogEntry|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): LogEntry|array|null { /** * @param string $pk * @return ?LogEntry + * @throws Exception */ function get($pk): ?LogEntry { return Util::cast(parent::get($pk), LogEntry::class); @@ -85,6 +88,7 @@ function get($pk): ?LogEntry { /** * @param LogEntry $model * @return LogEntry + * @throws Exception */ function save($model): LogEntry { return Util::cast(parent::save($model), LogEntry::class); diff --git a/src/dba/models/NotificationSettingFactory.php b/src/dba/models/NotificationSettingFactory.php index d51485078..5fb92d726 100644 --- a/src/dba/models/NotificationSettingFactory.php +++ b/src/dba/models/NotificationSettingFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): NotificationSetting { /** * @param array $options * @param bool $single - * @return NotificationSetting|NotificationSetting[] + * @return NotificationSetting|array|null + * @throws Exception */ function filter(array $options, bool $single = false): NotificationSetting|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): NotificationSetting|array /** * @param string $pk * @return ?NotificationSetting + * @throws Exception */ function get($pk): ?NotificationSetting { return Util::cast(parent::get($pk), NotificationSetting::class); @@ -85,6 +88,7 @@ function get($pk): ?NotificationSetting { /** * @param NotificationSetting $model * @return NotificationSetting + * @throws Exception */ function save($model): NotificationSetting { return Util::cast(parent::save($model), NotificationSetting::class); diff --git a/src/dba/models/PreprocessorFactory.php b/src/dba/models/PreprocessorFactory.php index 097ab22d7..545d95481 100644 --- a/src/dba/models/PreprocessorFactory.php +++ b/src/dba/models/PreprocessorFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Preprocessor { /** * @param array $options * @param bool $single - * @return Preprocessor|Preprocessor[] + * @return Preprocessor|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Preprocessor|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Preprocessor|array|null { /** * @param string $pk * @return ?Preprocessor + * @throws Exception */ function get($pk): ?Preprocessor { return Util::cast(parent::get($pk), Preprocessor::class); @@ -85,6 +88,7 @@ function get($pk): ?Preprocessor { /** * @param Preprocessor $model * @return Preprocessor + * @throws Exception */ function save($model): Preprocessor { return Util::cast(parent::save($model), Preprocessor::class); diff --git a/src/dba/models/PretaskFactory.php b/src/dba/models/PretaskFactory.php index 07e37e930..b20f6f6c4 100644 --- a/src/dba/models/PretaskFactory.php +++ b/src/dba/models/PretaskFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Pretask { /** * @param array $options * @param bool $single - * @return Pretask|Pretask[] + * @return Pretask|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Pretask|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Pretask|array|null { /** * @param string $pk * @return ?Pretask + * @throws Exception */ function get($pk): ?Pretask { return Util::cast(parent::get($pk), Pretask::class); @@ -85,6 +88,7 @@ function get($pk): ?Pretask { /** * @param Pretask $model * @return Pretask + * @throws Exception */ function save($model): Pretask { return Util::cast(parent::save($model), Pretask::class); diff --git a/src/dba/models/RegVoucherFactory.php b/src/dba/models/RegVoucherFactory.php index 476ddf92f..cf7ac8c7b 100644 --- a/src/dba/models/RegVoucherFactory.php +++ b/src/dba/models/RegVoucherFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): RegVoucher { /** * @param array $options * @param bool $single - * @return RegVoucher|RegVoucher[] + * @return RegVoucher|array|null + * @throws Exception */ function filter(array $options, bool $single = false): RegVoucher|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): RegVoucher|array|null { /** * @param string $pk * @return ?RegVoucher + * @throws Exception */ function get($pk): ?RegVoucher { return Util::cast(parent::get($pk), RegVoucher::class); @@ -85,6 +88,7 @@ function get($pk): ?RegVoucher { /** * @param RegVoucher $model * @return RegVoucher + * @throws Exception */ function save($model): RegVoucher { return Util::cast(parent::save($model), RegVoucher::class); diff --git a/src/dba/models/RightGroupFactory.php b/src/dba/models/RightGroupFactory.php index 8ba2132ed..7331eb655 100644 --- a/src/dba/models/RightGroupFactory.php +++ b/src/dba/models/RightGroupFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): RightGroup { /** * @param array $options * @param bool $single - * @return RightGroup|RightGroup[] + * @return RightGroup|array|null + * @throws Exception */ function filter(array $options, bool $single = false): RightGroup|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): RightGroup|array|null { /** * @param string $pk * @return ?RightGroup + * @throws Exception */ function get($pk): ?RightGroup { return Util::cast(parent::get($pk), RightGroup::class); @@ -85,6 +88,7 @@ function get($pk): ?RightGroup { /** * @param RightGroup $model * @return RightGroup + * @throws Exception */ function save($model): RightGroup { return Util::cast(parent::save($model), RightGroup::class); diff --git a/src/dba/models/SessionFactory.php b/src/dba/models/SessionFactory.php index 9132e5a19..a1b075e8a 100644 --- a/src/dba/models/SessionFactory.php +++ b/src/dba/models/SessionFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Session { /** * @param array $options * @param bool $single - * @return Session|Session[] + * @return Session|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Session|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Session|array|null { /** * @param string $pk * @return ?Session + * @throws Exception */ function get($pk): ?Session { return Util::cast(parent::get($pk), Session::class); @@ -85,6 +88,7 @@ function get($pk): ?Session { /** * @param Session $model * @return Session + * @throws Exception */ function save($model): Session { return Util::cast(parent::save($model), Session::class); diff --git a/src/dba/models/SpeedFactory.php b/src/dba/models/SpeedFactory.php index 4c9ccebdd..62db42d19 100644 --- a/src/dba/models/SpeedFactory.php +++ b/src/dba/models/SpeedFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Speed { /** * @param array $options * @param bool $single - * @return Speed|Speed[] + * @return Speed|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Speed|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Speed|array|null { /** * @param string $pk * @return ?Speed + * @throws Exception */ function get($pk): ?Speed { return Util::cast(parent::get($pk), Speed::class); @@ -85,6 +88,7 @@ function get($pk): ?Speed { /** * @param Speed $model * @return Speed + * @throws Exception */ function save($model): Speed { return Util::cast(parent::save($model), Speed::class); diff --git a/src/dba/models/StoredValueFactory.php b/src/dba/models/StoredValueFactory.php index df42fc923..5aa083bfc 100644 --- a/src/dba/models/StoredValueFactory.php +++ b/src/dba/models/StoredValueFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): StoredValue { /** * @param array $options * @param bool $single - * @return StoredValue|StoredValue[] + * @return StoredValue|array|null + * @throws Exception */ function filter(array $options, bool $single = false): StoredValue|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): StoredValue|array|null { /** * @param string $pk * @return ?StoredValue + * @throws Exception */ function get($pk): ?StoredValue { return Util::cast(parent::get($pk), StoredValue::class); @@ -85,6 +88,7 @@ function get($pk): ?StoredValue { /** * @param StoredValue $model * @return StoredValue + * @throws Exception */ function save($model): StoredValue { return Util::cast(parent::save($model), StoredValue::class); diff --git a/src/dba/models/SupertaskFactory.php b/src/dba/models/SupertaskFactory.php index ff6fa36a5..9ee14da7d 100644 --- a/src/dba/models/SupertaskFactory.php +++ b/src/dba/models/SupertaskFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Supertask { /** * @param array $options * @param bool $single - * @return Supertask|Supertask[] + * @return Supertask|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Supertask|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Supertask|array|null { /** * @param string $pk * @return ?Supertask + * @throws Exception */ function get($pk): ?Supertask { return Util::cast(parent::get($pk), Supertask::class); @@ -85,6 +88,7 @@ function get($pk): ?Supertask { /** * @param Supertask $model * @return Supertask + * @throws Exception */ function save($model): Supertask { return Util::cast(parent::save($model), Supertask::class); diff --git a/src/dba/models/SupertaskPretaskFactory.php b/src/dba/models/SupertaskPretaskFactory.php index c1bb9298d..83c064b56 100644 --- a/src/dba/models/SupertaskPretaskFactory.php +++ b/src/dba/models/SupertaskPretaskFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): SupertaskPretask { /** * @param array $options * @param bool $single - * @return SupertaskPretask|SupertaskPretask[] + * @return SupertaskPretask|array|null + * @throws Exception */ function filter(array $options, bool $single = false): SupertaskPretask|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): SupertaskPretask|array|nu /** * @param string $pk * @return ?SupertaskPretask + * @throws Exception */ function get($pk): ?SupertaskPretask { return Util::cast(parent::get($pk), SupertaskPretask::class); @@ -85,6 +88,7 @@ function get($pk): ?SupertaskPretask { /** * @param SupertaskPretask $model * @return SupertaskPretask + * @throws Exception */ function save($model): SupertaskPretask { return Util::cast(parent::save($model), SupertaskPretask::class); diff --git a/src/dba/models/TaskDebugOutputFactory.php b/src/dba/models/TaskDebugOutputFactory.php index c10274a70..c9d0f5257 100644 --- a/src/dba/models/TaskDebugOutputFactory.php +++ b/src/dba/models/TaskDebugOutputFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): TaskDebugOutput { /** * @param array $options * @param bool $single - * @return TaskDebugOutput|TaskDebugOutput[] + * @return TaskDebugOutput|array|null + * @throws Exception */ function filter(array $options, bool $single = false): TaskDebugOutput|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): TaskDebugOutput|array|nul /** * @param string $pk * @return ?TaskDebugOutput + * @throws Exception */ function get($pk): ?TaskDebugOutput { return Util::cast(parent::get($pk), TaskDebugOutput::class); @@ -85,6 +88,7 @@ function get($pk): ?TaskDebugOutput { /** * @param TaskDebugOutput $model * @return TaskDebugOutput + * @throws Exception */ function save($model): TaskDebugOutput { return Util::cast(parent::save($model), TaskDebugOutput::class); diff --git a/src/dba/models/TaskFactory.php b/src/dba/models/TaskFactory.php index b0e4b6ce8..2166ec777 100644 --- a/src/dba/models/TaskFactory.php +++ b/src/dba/models/TaskFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Task { /** * @param array $options * @param bool $single - * @return Task|Task[] + * @return Task|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Task|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Task|array|null { /** * @param string $pk * @return ?Task + * @throws Exception */ function get($pk): ?Task { return Util::cast(parent::get($pk), Task::class); @@ -85,6 +88,7 @@ function get($pk): ?Task { /** * @param Task $model * @return Task + * @throws Exception */ function save($model): Task { return Util::cast(parent::save($model), Task::class); diff --git a/src/dba/models/TaskWrapperDisplayFactory.php b/src/dba/models/TaskWrapperDisplayFactory.php index b32d0250f..93ffeb43b 100644 --- a/src/dba/models/TaskWrapperDisplayFactory.php +++ b/src/dba/models/TaskWrapperDisplayFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): TaskWrapperDisplay { /** * @param array $options * @param bool $single - * @return TaskWrapperDisplay|TaskWrapperDisplay[] + * @return TaskWrapperDisplay|array|null + * @throws Exception */ function filter(array $options, bool $single = false): TaskWrapperDisplay|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): TaskWrapperDisplay|array| /** * @param string $pk * @return ?TaskWrapperDisplay + * @throws Exception */ function get($pk): ?TaskWrapperDisplay { return Util::cast(parent::get($pk), TaskWrapperDisplay::class); @@ -85,6 +88,7 @@ function get($pk): ?TaskWrapperDisplay { /** * @param TaskWrapperDisplay $model * @return TaskWrapperDisplay + * @throws Exception */ function save($model): TaskWrapperDisplay { return Util::cast(parent::save($model), TaskWrapperDisplay::class); diff --git a/src/dba/models/TaskWrapperFactory.php b/src/dba/models/TaskWrapperFactory.php index c546d049f..f88b195d8 100644 --- a/src/dba/models/TaskWrapperFactory.php +++ b/src/dba/models/TaskWrapperFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): TaskWrapper { /** * @param array $options * @param bool $single - * @return TaskWrapper|TaskWrapper[] + * @return TaskWrapper|array|null + * @throws Exception */ function filter(array $options, bool $single = false): TaskWrapper|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): TaskWrapper|array|null { /** * @param string $pk * @return ?TaskWrapper + * @throws Exception */ function get($pk): ?TaskWrapper { return Util::cast(parent::get($pk), TaskWrapper::class); @@ -85,6 +88,7 @@ function get($pk): ?TaskWrapper { /** * @param TaskWrapper $model * @return TaskWrapper + * @throws Exception */ function save($model): TaskWrapper { return Util::cast(parent::save($model), TaskWrapper::class); diff --git a/src/dba/models/UserFactory.php b/src/dba/models/UserFactory.php index 2dd6722e9..70a51458e 100644 --- a/src/dba/models/UserFactory.php +++ b/src/dba/models/UserFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): User { /** * @param array $options * @param bool $single - * @return User|User[] + * @return User|array|null + * @throws Exception */ function filter(array $options, bool $single = false): User|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): User|array|null { /** * @param string $pk * @return ?User + * @throws Exception */ function get($pk): ?User { return Util::cast(parent::get($pk), User::class); @@ -85,6 +88,7 @@ function get($pk): ?User { /** * @param User $model * @return User + * @throws Exception */ function save($model): User { return Util::cast(parent::save($model), User::class); diff --git a/src/dba/models/ZapFactory.php b/src/dba/models/ZapFactory.php index c8654fd22..7b4bc73ef 100644 --- a/src/dba/models/ZapFactory.php +++ b/src/dba/models/ZapFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -50,7 +51,8 @@ function createObjectFromDict($pk, $dict): Zap { /** * @param array $options * @param bool $single - * @return Zap|Zap[] + * @return Zap|array|null + * @throws Exception */ function filter(array $options, bool $single = false): Zap|array|null { $join = false; @@ -77,6 +79,7 @@ function filter(array $options, bool $single = false): Zap|array|null { /** * @param string $pk * @return ?Zap + * @throws Exception */ function get($pk): ?Zap { return Util::cast(parent::get($pk), Zap::class); @@ -85,6 +88,7 @@ function get($pk): ?Zap { /** * @param Zap $model * @return Zap + * @throws Exception */ function save($model): Zap { return Util::cast(parent::save($model), Zap::class); diff --git a/src/dba/models/_sqlx_migrationsFactory.php b/src/dba/models/_sqlx_migrationsFactory.php index d2f7037b9..375580d5e 100644 --- a/src/dba/models/_sqlx_migrationsFactory.php +++ b/src/dba/models/_sqlx_migrationsFactory.php @@ -2,6 +2,7 @@ namespace Hashtopolis\dba\models; +use Exception; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\Util; @@ -55,7 +56,8 @@ function createObjectFromDict($pk, $dict): _sqlx_migrations { /** * @param array $options * @param bool $single - * @return _sqlx_migrations|_sqlx_migrations[] + * @return _sqlx_migrations|array|null + * @throws Exception */ function filter(array $options, bool $single = false): _sqlx_migrations|array|null { $join = false; @@ -82,6 +84,7 @@ function filter(array $options, bool $single = false): _sqlx_migrations|array|nu /** * @param string $pk * @return ?_sqlx_migrations + * @throws Exception */ function get($pk): ?_sqlx_migrations { return Util::cast(parent::get($pk), _sqlx_migrations::class); @@ -90,6 +93,7 @@ function get($pk): ?_sqlx_migrations { /** * @param _sqlx_migrations $model * @return _sqlx_migrations + * @throws Exception */ function save($model): _sqlx_migrations { return Util::cast(parent::save($model), _sqlx_migrations::class); diff --git a/src/inc/api/APIBasic.php b/src/inc/api/APIBasic.php index b863d6d0b..8595f5c27 100644 --- a/src/inc/api/APIBasic.php +++ b/src/inc/api/APIBasic.php @@ -2,6 +2,7 @@ namespace Hashtopolis\inc\api; +use Exception; use Hashtopolis\inc\agent\PResponseErrorMessage; use Hashtopolis\inc\agent\PValues; use Hashtopolis\inc\defines\DServerLog; @@ -13,23 +14,25 @@ use Hashtopolis\inc\Util; abstract class APIBasic { - /** @var Agent */ - protected $agent = null; + protected ?Agent $agent = null; /** * @param array $QUERY input query sent to the API * @throws HTException */ - public abstract function execute($QUERY = array()); + public abstract function execute(array $QUERY = []); - protected function sendResponse($RESPONSE) { + protected function sendResponse($RESPONSE): void { header("Content-Type: application/json"); echo json_encode($RESPONSE); die(); } + /** + * @throws Exception + */ protected function updateAgent($action): void { - Factory::getAgentFactory()->mset($this->agent, [Agent::LAST_IP => Util::getIP(), Agent::LAST_ACT => $action, Agent::LAST_TIME => time()]); + $this->agent = Factory::getAgentFactory()->mset($this->agent, [Agent::LAST_IP => Util::getIP(), Agent::LAST_ACT => $action, Agent::LAST_TIME => time()]); } public function sendErrorResponse($action, $msg): void { diff --git a/src/inc/api/APICheckClientVersion.php b/src/inc/api/APICheckClientVersion.php index f7017b92a..3e55b2c1e 100644 --- a/src/inc/api/APICheckClientVersion.php +++ b/src/inc/api/APICheckClientVersion.php @@ -17,7 +17,7 @@ use Hashtopolis\inc\Util; class APICheckClientVersion extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { // check if provided hash is the same as script and send file contents if not if (!PQueryCheckClientVersion::isValid($QUERY)) { $this->sendErrorResponse(PActions::CHECK_CLIENT_VERSION, 'Invalid version check query!'); diff --git a/src/inc/api/APIClientError.php b/src/inc/api/APIClientError.php index 614540b59..9caede8a9 100644 --- a/src/inc/api/APIClientError.php +++ b/src/inc/api/APIClientError.php @@ -21,7 +21,7 @@ use Hashtopolis\inc\SConfig; class APIClientError extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { //check required values if (!PQueryClientError::isValid($QUERY)) { $this->sendErrorResponse(PActions::CLIENT_ERROR, "Invalid error query!"); diff --git a/src/inc/api/APIDeRegisterAgent.php b/src/inc/api/APIDeRegisterAgent.php index 14e92dc9e..83a939cef 100644 --- a/src/inc/api/APIDeRegisterAgent.php +++ b/src/inc/api/APIDeRegisterAgent.php @@ -12,7 +12,7 @@ use Hashtopolis\inc\SConfig; class APIDeRegisterAgent extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { //check required values if (!PQueryDeRegister::isValid($QUERY)) { $this->sendErrorResponse(PActions::DEREGISTER, "Invalid de-registering query!"); diff --git a/src/inc/api/APIDownloadBinary.php b/src/inc/api/APIDownloadBinary.php index 278a1f4fc..ff4cd7558 100644 --- a/src/inc/api/APIDownloadBinary.php +++ b/src/inc/api/APIDownloadBinary.php @@ -14,7 +14,7 @@ use Hashtopolis\inc\Util; class APIDownloadBinary extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { if (!PQueryDownloadBinary::isValid($QUERY)) { $this->sendErrorResponse(PActions::DOWNLOAD_BINARY, "Invalid download query!"); } diff --git a/src/inc/api/APIGetChunk.php b/src/inc/api/APIGetChunk.php index 614fb12c0..2cf8c12ce 100644 --- a/src/inc/api/APIGetChunk.php +++ b/src/inc/api/APIGetChunk.php @@ -32,7 +32,7 @@ class APIGetChunk extends APIBasic { * @throws HTException * @throws Exception */ - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { if (!PQueryGetChunk::isValid($QUERY)) { $this->sendErrorResponse(PActions::GET_CHUNK, "Invalid chunk query!"); } diff --git a/src/inc/api/APIGetFile.php b/src/inc/api/APIGetFile.php index 6bffb5bc0..d69d624ca 100644 --- a/src/inc/api/APIGetFile.php +++ b/src/inc/api/APIGetFile.php @@ -14,7 +14,7 @@ use Hashtopolis\dba\Factory; class APIGetFile extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { //check required values if (!PQueryGetFile::isValid($QUERY)) { $this->sendErrorResponse(PActions::GET_FILE, "Invalid file query!"); diff --git a/src/inc/api/APIGetFileStatus.php b/src/inc/api/APIGetFileStatus.php index 185092295..6683a7e4e 100644 --- a/src/inc/api/APIGetFileStatus.php +++ b/src/inc/api/APIGetFileStatus.php @@ -8,7 +8,7 @@ use Hashtopolis\inc\agent\PValues; class APIGetFileStatus extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { $deleteRequests = Factory::getFileDeleteFactory()->filter([]); $files = []; foreach ($deleteRequests as $deleteRequest) { diff --git a/src/inc/api/APIGetFound.php b/src/inc/api/APIGetFound.php index bcb54c8e9..942f8b03e 100644 --- a/src/inc/api/APIGetFound.php +++ b/src/inc/api/APIGetFound.php @@ -13,7 +13,7 @@ use Hashtopolis\inc\Util; class APIGetFound extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { //check required values if (!PQueryGetFound::isValid($QUERY)) { $this->sendErrorResponse(PActions::GET_FOUND, "Invalid found query!"); diff --git a/src/inc/api/APIGetHashlist.php b/src/inc/api/APIGetHashlist.php index 7aadfa235..8958ca7cc 100644 --- a/src/inc/api/APIGetHashlist.php +++ b/src/inc/api/APIGetHashlist.php @@ -13,7 +13,7 @@ use Hashtopolis\inc\Util; class APIGetHashlist extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { //check required values if (!PQueryGetHashlist::isValid($QUERY)) { $this->sendErrorResponse(PActions::GET_HASHLIST, "Invalid hashlist query!"); diff --git a/src/inc/api/APIGetHealthCheck.php b/src/inc/api/APIGetHealthCheck.php index 1f7e76801..92026aeb3 100644 --- a/src/inc/api/APIGetHealthCheck.php +++ b/src/inc/api/APIGetHealthCheck.php @@ -13,7 +13,7 @@ use Hashtopolis\inc\SConfig; class APIGetHealthCheck extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { if (!PQueryGetHealthCheck::isValid($QUERY)) { $this->sendErrorResponse(PActions::GET_HEALTH_CHECK, "Invalid get health check query!"); } diff --git a/src/inc/api/APIGetTask.php b/src/inc/api/APIGetTask.php index 4c0b85eff..c830806b9 100644 --- a/src/inc/api/APIGetTask.php +++ b/src/inc/api/APIGetTask.php @@ -21,7 +21,7 @@ use Hashtopolis\inc\utils\TaskUtils; class APIGetTask extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { if (!PQueryGetTask::isValid($QUERY)) { $this->sendErrorResponse(PActions::GET_TASK, "Invalid task query!"); } diff --git a/src/inc/api/APILogin.php b/src/inc/api/APILogin.php index 8289c929f..8afb5fa73 100644 --- a/src/inc/api/APILogin.php +++ b/src/inc/api/APILogin.php @@ -15,7 +15,7 @@ use Hashtopolis\inc\Util; class APILogin extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { if (!PQueryLogin::isValid($QUERY)) { $this->sendErrorResponse(PActions::LOGIN, "Invalid login query!"); } diff --git a/src/inc/api/APIRegisterAgent.php b/src/inc/api/APIRegisterAgent.php index 3b3aed3f2..51d199f27 100644 --- a/src/inc/api/APIRegisterAgent.php +++ b/src/inc/api/APIRegisterAgent.php @@ -22,7 +22,7 @@ use Hashtopolis\inc\Util; class APIRegisterAgent extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { //check required values if (!PQueryRegister::isValid($QUERY)) { $this->sendErrorResponse(PActions::REGISTER, "Invalid registering query!"); diff --git a/src/inc/api/APISendBenchmark.php b/src/inc/api/APISendBenchmark.php index e63a479f3..57ded9645 100644 --- a/src/inc/api/APISendBenchmark.php +++ b/src/inc/api/APISendBenchmark.php @@ -16,7 +16,7 @@ use Hashtopolis\inc\SConfig; class APISendBenchmark extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { if (!PQuerySendBenchmark::isValid($QUERY)) { $this->sendErrorResponse(PActions::SEND_BENCHMARK, "Invalid benchmark query!"); } diff --git a/src/inc/api/APISendHealthCheck.php b/src/inc/api/APISendHealthCheck.php index 06987e7d6..698c37908 100644 --- a/src/inc/api/APISendHealthCheck.php +++ b/src/inc/api/APISendHealthCheck.php @@ -15,7 +15,7 @@ use Hashtopolis\inc\utils\HealthUtils; class APISendHealthCheck extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { if (!PQuerySendHealthCheck::isValid($QUERY)) { $this->sendErrorResponse(PActions::SEND_HEALTH_CHECK, "Invalid send health check query!"); } diff --git a/src/inc/api/APISendKeyspace.php b/src/inc/api/APISendKeyspace.php index 9f71f1f2d..6b7ea7220 100644 --- a/src/inc/api/APISendKeyspace.php +++ b/src/inc/api/APISendKeyspace.php @@ -17,7 +17,7 @@ use Hashtopolis\inc\Util; class APISendKeyspace extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { if (!PQuerySendKeyspace::isValid($QUERY)) { $this->sendErrorResponse(PActions::SEND_KEYSPACE, "Invalid keyspace query!"); } diff --git a/src/inc/api/APISendProgress.php b/src/inc/api/APISendProgress.php index ef3073d43..e469cd86e 100644 --- a/src/inc/api/APISendProgress.php +++ b/src/inc/api/APISendProgress.php @@ -44,7 +44,7 @@ use Hashtopolis\inc\Util; class APISendProgress extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { if (!PQuerySendProgress::isValid($QUERY)) { $this->sendErrorResponse(PActions::SEND_PROGRESS, "Invalid progress query!"); } diff --git a/src/inc/api/APITestConnection.php b/src/inc/api/APITestConnection.php index 1dcda9c44..1f7dc38cf 100644 --- a/src/inc/api/APITestConnection.php +++ b/src/inc/api/APITestConnection.php @@ -8,7 +8,7 @@ use Hashtopolis\inc\agent\PValues; class APITestConnection extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { $this->sendResponse(array( PResponse::ACTION => PActions::TEST_CONNECTION, PResponse::RESPONSE => PValues::SUCCESS diff --git a/src/inc/api/APIUpdateClientInformation.php b/src/inc/api/APIUpdateClientInformation.php index 373fe12e8..0dad9e096 100644 --- a/src/inc/api/APIUpdateClientInformation.php +++ b/src/inc/api/APIUpdateClientInformation.php @@ -11,7 +11,7 @@ use Hashtopolis\dba\Factory; class APIUpdateClientInformation extends APIBasic { - public function execute($QUERY = array()) { + public function execute(array $QUERY = array()) { // check required values and token if (!PQueryUpdateInformation::isValid($QUERY)) { $this->sendErrorResponse(PActions::UPDATE_CLIENT_INFORMATION, "Invalid update query!"); diff --git a/src/inc/apiv2/common/AbstractModelAPI.php b/src/inc/apiv2/common/AbstractModelAPI.php index d95488af8..7833b8dfe 100644 --- a/src/inc/apiv2/common/AbstractModelAPI.php +++ b/src/inc/apiv2/common/AbstractModelAPI.php @@ -1716,7 +1716,7 @@ public function deleteToManyRelationshipLink(Request $request, Response $respons $this->preCommon($request); $jsonBody = $request->getParsedBody(); - if ($jsonBody === null || !array_key_exists('data', $jsonBody) && is_array($jsonBody['data'])) { + if ($jsonBody === null || !array_key_exists('data', $jsonBody) || !is_array($jsonBody['data'])) { throw new HttpError('No data was sent! Send the json data in the following format: {"data":[{"type": "foo", "id": 1}}]'); } From 534e32a646fbb3b23fa1a019b2025aa4919366a2 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Thu, 2 Jul 2026 16:10:02 +0200 Subject: [PATCH 02/19] wrapping mset function to parent function to allow typing --- .../models/AbstractModelFactory.template.txt | 14 ++++++++++++++ src/dba/models/AccessGroupAgentFactory.php | 14 ++++++++++++++ src/dba/models/AccessGroupFactory.php | 14 ++++++++++++++ src/dba/models/AccessGroupUserFactory.php | 14 ++++++++++++++ src/dba/models/AgentBinaryFactory.php | 14 ++++++++++++++ src/dba/models/AgentErrorFactory.php | 14 ++++++++++++++ src/dba/models/AgentFactory.php | 18 +++++++++++++++--- src/dba/models/AgentStatFactory.php | 14 ++++++++++++++ src/dba/models/AgentZapFactory.php | 14 ++++++++++++++ src/dba/models/ApiGroupFactory.php | 14 ++++++++++++++ src/dba/models/ApiKeyFactory.php | 14 ++++++++++++++ src/dba/models/AssignmentFactory.php | 14 ++++++++++++++ src/dba/models/ChunkFactory.php | 14 ++++++++++++++ src/dba/models/ConfigFactory.php | 14 ++++++++++++++ src/dba/models/ConfigSectionFactory.php | 14 ++++++++++++++ src/dba/models/CrackerBinaryFactory.php | 14 ++++++++++++++ src/dba/models/CrackerBinaryTypeFactory.php | 14 ++++++++++++++ src/dba/models/FileDeleteFactory.php | 14 ++++++++++++++ src/dba/models/FileDownloadFactory.php | 14 ++++++++++++++ src/dba/models/FileFactory.php | 14 ++++++++++++++ src/dba/models/FilePretaskFactory.php | 14 ++++++++++++++ src/dba/models/FileTaskFactory.php | 14 ++++++++++++++ src/dba/models/HashBinaryFactory.php | 14 ++++++++++++++ src/dba/models/HashFactory.php | 14 ++++++++++++++ src/dba/models/HashTypeFactory.php | 14 ++++++++++++++ src/dba/models/HashlistFactory.php | 14 ++++++++++++++ src/dba/models/HashlistHashlistFactory.php | 14 ++++++++++++++ src/dba/models/HealthCheckAgentFactory.php | 14 ++++++++++++++ src/dba/models/HealthCheckFactory.php | 14 ++++++++++++++ src/dba/models/JwtApiKeyFactory.php | 14 ++++++++++++++ src/dba/models/LogEntryFactory.php | 14 ++++++++++++++ src/dba/models/NotificationSettingFactory.php | 14 ++++++++++++++ src/dba/models/PreprocessorFactory.php | 14 ++++++++++++++ src/dba/models/PretaskFactory.php | 14 ++++++++++++++ src/dba/models/RegVoucherFactory.php | 14 ++++++++++++++ src/dba/models/RightGroupFactory.php | 14 ++++++++++++++ src/dba/models/SessionFactory.php | 14 ++++++++++++++ src/dba/models/SpeedFactory.php | 14 ++++++++++++++ src/dba/models/StoredValueFactory.php | 14 ++++++++++++++ src/dba/models/SupertaskFactory.php | 14 ++++++++++++++ src/dba/models/SupertaskPretaskFactory.php | 14 ++++++++++++++ src/dba/models/TaskDebugOutputFactory.php | 14 ++++++++++++++ src/dba/models/TaskFactory.php | 14 ++++++++++++++ src/dba/models/TaskWrapperDisplayFactory.php | 14 ++++++++++++++ src/dba/models/TaskWrapperFactory.php | 14 ++++++++++++++ src/dba/models/UserFactory.php | 14 ++++++++++++++ src/dba/models/ZapFactory.php | 14 ++++++++++++++ src/dba/models/_sqlx_migrationsFactory.php | 14 ++++++++++++++ 48 files changed, 673 insertions(+), 3 deletions(-) diff --git a/src/dba/models/AbstractModelFactory.template.txt b/src/dba/models/AbstractModelFactory.template.txt index e2274e494..893084090 100644 --- a/src/dba/models/AbstractModelFactory.template.txt +++ b/src/dba/models/AbstractModelFactory.template.txt @@ -4,6 +4,7 @@ namespace Hashtopolis\dba\models; use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class __MODEL_NAME__Factory extends AbstractModelFactory { @@ -84,6 +85,19 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { function get($pk): ?__MODEL_NAME__ { return Util::cast(parent::get($pk), __MODEL_NAME__::class); } + + /** + * @param __MODEL_NAME__ $model + * @param array $arr + * @return __MODEL_NAME__ + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): __MODEL_NAME__ { + assert($model instanceof __MODEL_NAME__); + $model = parent::mset($model, $arr); + assert($model instanceof __MODEL_NAME__); + return $model; + } /** * @param __MODEL_NAME__ $model diff --git a/src/dba/models/AccessGroupAgentFactory.php b/src/dba/models/AccessGroupAgentFactory.php index b788bfcd4..46cdb9a64 100644 --- a/src/dba/models/AccessGroupAgentFactory.php +++ b/src/dba/models/AccessGroupAgentFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class AccessGroupAgentFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): AccessGroupAgent|array|nu function get($pk): ?AccessGroupAgent { return Util::cast(parent::get($pk), AccessGroupAgent::class); } + + /** + * @param AccessGroupAgent $model + * @param array $arr + * @return AccessGroupAgent + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): AccessGroupAgent { + assert($model instanceof AccessGroupAgent); + $model = parent::mset($model, $arr); + assert($model instanceof AccessGroupAgent); + return $model; + } /** * @param AccessGroupAgent $model diff --git a/src/dba/models/AccessGroupFactory.php b/src/dba/models/AccessGroupFactory.php index 92c640351..1d4155e4e 100644 --- a/src/dba/models/AccessGroupFactory.php +++ b/src/dba/models/AccessGroupFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class AccessGroupFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): AccessGroup|array|null { function get($pk): ?AccessGroup { return Util::cast(parent::get($pk), AccessGroup::class); } + + /** + * @param AccessGroup $model + * @param array $arr + * @return AccessGroup + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): AccessGroup { + assert($model instanceof AccessGroup); + $model = parent::mset($model, $arr); + assert($model instanceof AccessGroup); + return $model; + } /** * @param AccessGroup $model diff --git a/src/dba/models/AccessGroupUserFactory.php b/src/dba/models/AccessGroupUserFactory.php index 128981da4..eb1371d5e 100644 --- a/src/dba/models/AccessGroupUserFactory.php +++ b/src/dba/models/AccessGroupUserFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class AccessGroupUserFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): AccessGroupUser|array|nul function get($pk): ?AccessGroupUser { return Util::cast(parent::get($pk), AccessGroupUser::class); } + + /** + * @param AccessGroupUser $model + * @param array $arr + * @return AccessGroupUser + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): AccessGroupUser { + assert($model instanceof AccessGroupUser); + $model = parent::mset($model, $arr); + assert($model instanceof AccessGroupUser); + return $model; + } /** * @param AccessGroupUser $model diff --git a/src/dba/models/AgentBinaryFactory.php b/src/dba/models/AgentBinaryFactory.php index 88eebe1f6..b72861a2a 100644 --- a/src/dba/models/AgentBinaryFactory.php +++ b/src/dba/models/AgentBinaryFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class AgentBinaryFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): AgentBinary|array|null { function get($pk): ?AgentBinary { return Util::cast(parent::get($pk), AgentBinary::class); } + + /** + * @param AgentBinary $model + * @param array $arr + * @return AgentBinary + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): AgentBinary { + assert($model instanceof AgentBinary); + $model = parent::mset($model, $arr); + assert($model instanceof AgentBinary); + return $model; + } /** * @param AgentBinary $model diff --git a/src/dba/models/AgentErrorFactory.php b/src/dba/models/AgentErrorFactory.php index 755c3707c..300311132 100644 --- a/src/dba/models/AgentErrorFactory.php +++ b/src/dba/models/AgentErrorFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class AgentErrorFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): AgentError|array|null { function get($pk): ?AgentError { return Util::cast(parent::get($pk), AgentError::class); } + + /** + * @param AgentError $model + * @param array $arr + * @return AgentError + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): AgentError { + assert($model instanceof AgentError); + $model = parent::mset($model, $arr); + assert($model instanceof AgentError); + return $model; + } /** * @param AgentError $model diff --git a/src/dba/models/AgentFactory.php b/src/dba/models/AgentFactory.php index 4d7cb7e8f..1d0c130d9 100644 --- a/src/dba/models/AgentFactory.php +++ b/src/dba/models/AgentFactory.php @@ -3,10 +3,9 @@ namespace Hashtopolis\dba\models; use Exception; -use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; -use PDOStatement; class AgentFactory extends AbstractModelFactory { function getModelName(): string { @@ -16,7 +15,7 @@ function getModelName(): string { function getModelTable(): string { return "Agent"; } - + function isMapping(): bool { return False; } @@ -86,6 +85,19 @@ function filter(array $options, bool $single = false): Agent|array|null { function get($pk): ?Agent { return Util::cast(parent::get($pk), Agent::class); } + + /** + * @param Agent $model + * @param array $arr + * @return Agent + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Agent { + assert($model instanceof Agent); + $model = parent::mset($model, $arr); + assert($model instanceof Agent); + return $model; + } /** * @param Agent $model diff --git a/src/dba/models/AgentStatFactory.php b/src/dba/models/AgentStatFactory.php index 88a6e8bb3..217adee2a 100644 --- a/src/dba/models/AgentStatFactory.php +++ b/src/dba/models/AgentStatFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class AgentStatFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): AgentStat|array|null { function get($pk): ?AgentStat { return Util::cast(parent::get($pk), AgentStat::class); } + + /** + * @param AgentStat $model + * @param array $arr + * @return AgentStat + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): AgentStat { + assert($model instanceof AgentStat); + $model = parent::mset($model, $arr); + assert($model instanceof AgentStat); + return $model; + } /** * @param AgentStat $model diff --git a/src/dba/models/AgentZapFactory.php b/src/dba/models/AgentZapFactory.php index ce5ba52d2..9a9a1a6a2 100644 --- a/src/dba/models/AgentZapFactory.php +++ b/src/dba/models/AgentZapFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class AgentZapFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): AgentZap|array|null { function get($pk): ?AgentZap { return Util::cast(parent::get($pk), AgentZap::class); } + + /** + * @param AgentZap $model + * @param array $arr + * @return AgentZap + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): AgentZap { + assert($model instanceof AgentZap); + $model = parent::mset($model, $arr); + assert($model instanceof AgentZap); + return $model; + } /** * @param AgentZap $model diff --git a/src/dba/models/ApiGroupFactory.php b/src/dba/models/ApiGroupFactory.php index 333f0b0f1..09c6c23f7 100644 --- a/src/dba/models/ApiGroupFactory.php +++ b/src/dba/models/ApiGroupFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class ApiGroupFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): ApiGroup|array|null { function get($pk): ?ApiGroup { return Util::cast(parent::get($pk), ApiGroup::class); } + + /** + * @param ApiGroup $model + * @param array $arr + * @return ApiGroup + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): ApiGroup { + assert($model instanceof ApiGroup); + $model = parent::mset($model, $arr); + assert($model instanceof ApiGroup); + return $model; + } /** * @param ApiGroup $model diff --git a/src/dba/models/ApiKeyFactory.php b/src/dba/models/ApiKeyFactory.php index 51c09e8a6..146ed513c 100644 --- a/src/dba/models/ApiKeyFactory.php +++ b/src/dba/models/ApiKeyFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class ApiKeyFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): ApiKey|array|null { function get($pk): ?ApiKey { return Util::cast(parent::get($pk), ApiKey::class); } + + /** + * @param ApiKey $model + * @param array $arr + * @return ApiKey + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): ApiKey { + assert($model instanceof ApiKey); + $model = parent::mset($model, $arr); + assert($model instanceof ApiKey); + return $model; + } /** * @param ApiKey $model diff --git a/src/dba/models/AssignmentFactory.php b/src/dba/models/AssignmentFactory.php index 402bf6a32..4b92c1956 100644 --- a/src/dba/models/AssignmentFactory.php +++ b/src/dba/models/AssignmentFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class AssignmentFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Assignment|array|null { function get($pk): ?Assignment { return Util::cast(parent::get($pk), Assignment::class); } + + /** + * @param Assignment $model + * @param array $arr + * @return Assignment + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Assignment { + assert($model instanceof Assignment); + $model = parent::mset($model, $arr); + assert($model instanceof Assignment); + return $model; + } /** * @param Assignment $model diff --git a/src/dba/models/ChunkFactory.php b/src/dba/models/ChunkFactory.php index 198b285f1..60c7891a9 100644 --- a/src/dba/models/ChunkFactory.php +++ b/src/dba/models/ChunkFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class ChunkFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Chunk|array|null { function get($pk): ?Chunk { return Util::cast(parent::get($pk), Chunk::class); } + + /** + * @param Chunk $model + * @param array $arr + * @return Chunk + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Chunk { + assert($model instanceof Chunk); + $model = parent::mset($model, $arr); + assert($model instanceof Chunk); + return $model; + } /** * @param Chunk $model diff --git a/src/dba/models/ConfigFactory.php b/src/dba/models/ConfigFactory.php index 18b383991..b40a84541 100644 --- a/src/dba/models/ConfigFactory.php +++ b/src/dba/models/ConfigFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class ConfigFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Config|array|null { function get($pk): ?Config { return Util::cast(parent::get($pk), Config::class); } + + /** + * @param Config $model + * @param array $arr + * @return Config + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Config { + assert($model instanceof Config); + $model = parent::mset($model, $arr); + assert($model instanceof Config); + return $model; + } /** * @param Config $model diff --git a/src/dba/models/ConfigSectionFactory.php b/src/dba/models/ConfigSectionFactory.php index dd98dd409..9adec009b 100644 --- a/src/dba/models/ConfigSectionFactory.php +++ b/src/dba/models/ConfigSectionFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class ConfigSectionFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): ConfigSection|array|null function get($pk): ?ConfigSection { return Util::cast(parent::get($pk), ConfigSection::class); } + + /** + * @param ConfigSection $model + * @param array $arr + * @return ConfigSection + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): ConfigSection { + assert($model instanceof ConfigSection); + $model = parent::mset($model, $arr); + assert($model instanceof ConfigSection); + return $model; + } /** * @param ConfigSection $model diff --git a/src/dba/models/CrackerBinaryFactory.php b/src/dba/models/CrackerBinaryFactory.php index 30bd6af50..41f09a795 100644 --- a/src/dba/models/CrackerBinaryFactory.php +++ b/src/dba/models/CrackerBinaryFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class CrackerBinaryFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): CrackerBinary|array|null function get($pk): ?CrackerBinary { return Util::cast(parent::get($pk), CrackerBinary::class); } + + /** + * @param CrackerBinary $model + * @param array $arr + * @return CrackerBinary + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): CrackerBinary { + assert($model instanceof CrackerBinary); + $model = parent::mset($model, $arr); + assert($model instanceof CrackerBinary); + return $model; + } /** * @param CrackerBinary $model diff --git a/src/dba/models/CrackerBinaryTypeFactory.php b/src/dba/models/CrackerBinaryTypeFactory.php index e11855f12..89e7917c6 100644 --- a/src/dba/models/CrackerBinaryTypeFactory.php +++ b/src/dba/models/CrackerBinaryTypeFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class CrackerBinaryTypeFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): CrackerBinaryType|array|n function get($pk): ?CrackerBinaryType { return Util::cast(parent::get($pk), CrackerBinaryType::class); } + + /** + * @param CrackerBinaryType $model + * @param array $arr + * @return CrackerBinaryType + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): CrackerBinaryType { + assert($model instanceof CrackerBinaryType); + $model = parent::mset($model, $arr); + assert($model instanceof CrackerBinaryType); + return $model; + } /** * @param CrackerBinaryType $model diff --git a/src/dba/models/FileDeleteFactory.php b/src/dba/models/FileDeleteFactory.php index 620dae4c2..b363c128b 100644 --- a/src/dba/models/FileDeleteFactory.php +++ b/src/dba/models/FileDeleteFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class FileDeleteFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): FileDelete|array|null { function get($pk): ?FileDelete { return Util::cast(parent::get($pk), FileDelete::class); } + + /** + * @param FileDelete $model + * @param array $arr + * @return FileDelete + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): FileDelete { + assert($model instanceof FileDelete); + $model = parent::mset($model, $arr); + assert($model instanceof FileDelete); + return $model; + } /** * @param FileDelete $model diff --git a/src/dba/models/FileDownloadFactory.php b/src/dba/models/FileDownloadFactory.php index 887372ee4..bf3fb3695 100644 --- a/src/dba/models/FileDownloadFactory.php +++ b/src/dba/models/FileDownloadFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class FileDownloadFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): FileDownload|array|null { function get($pk): ?FileDownload { return Util::cast(parent::get($pk), FileDownload::class); } + + /** + * @param FileDownload $model + * @param array $arr + * @return FileDownload + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): FileDownload { + assert($model instanceof FileDownload); + $model = parent::mset($model, $arr); + assert($model instanceof FileDownload); + return $model; + } /** * @param FileDownload $model diff --git a/src/dba/models/FileFactory.php b/src/dba/models/FileFactory.php index 265256266..927dc670f 100644 --- a/src/dba/models/FileFactory.php +++ b/src/dba/models/FileFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class FileFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): File|array|null { function get($pk): ?File { return Util::cast(parent::get($pk), File::class); } + + /** + * @param File $model + * @param array $arr + * @return File + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): File { + assert($model instanceof File); + $model = parent::mset($model, $arr); + assert($model instanceof File); + return $model; + } /** * @param File $model diff --git a/src/dba/models/FilePretaskFactory.php b/src/dba/models/FilePretaskFactory.php index 61287e65a..3f30bdacd 100644 --- a/src/dba/models/FilePretaskFactory.php +++ b/src/dba/models/FilePretaskFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class FilePretaskFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): FilePretask|array|null { function get($pk): ?FilePretask { return Util::cast(parent::get($pk), FilePretask::class); } + + /** + * @param FilePretask $model + * @param array $arr + * @return FilePretask + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): FilePretask { + assert($model instanceof FilePretask); + $model = parent::mset($model, $arr); + assert($model instanceof FilePretask); + return $model; + } /** * @param FilePretask $model diff --git a/src/dba/models/FileTaskFactory.php b/src/dba/models/FileTaskFactory.php index 4089c5ebd..1d20d394a 100644 --- a/src/dba/models/FileTaskFactory.php +++ b/src/dba/models/FileTaskFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class FileTaskFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): FileTask|array|null { function get($pk): ?FileTask { return Util::cast(parent::get($pk), FileTask::class); } + + /** + * @param FileTask $model + * @param array $arr + * @return FileTask + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): FileTask { + assert($model instanceof FileTask); + $model = parent::mset($model, $arr); + assert($model instanceof FileTask); + return $model; + } /** * @param FileTask $model diff --git a/src/dba/models/HashBinaryFactory.php b/src/dba/models/HashBinaryFactory.php index 1c0f7ac97..5fee6ef36 100644 --- a/src/dba/models/HashBinaryFactory.php +++ b/src/dba/models/HashBinaryFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class HashBinaryFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): HashBinary|array|null { function get($pk): ?HashBinary { return Util::cast(parent::get($pk), HashBinary::class); } + + /** + * @param HashBinary $model + * @param array $arr + * @return HashBinary + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): HashBinary { + assert($model instanceof HashBinary); + $model = parent::mset($model, $arr); + assert($model instanceof HashBinary); + return $model; + } /** * @param HashBinary $model diff --git a/src/dba/models/HashFactory.php b/src/dba/models/HashFactory.php index d1ee95e70..21f1cd505 100644 --- a/src/dba/models/HashFactory.php +++ b/src/dba/models/HashFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class HashFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Hash|array|null { function get($pk): ?Hash { return Util::cast(parent::get($pk), Hash::class); } + + /** + * @param Hash $model + * @param array $arr + * @return Hash + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Hash { + assert($model instanceof Hash); + $model = parent::mset($model, $arr); + assert($model instanceof Hash); + return $model; + } /** * @param Hash $model diff --git a/src/dba/models/HashTypeFactory.php b/src/dba/models/HashTypeFactory.php index 6540436f1..3ddd496bc 100644 --- a/src/dba/models/HashTypeFactory.php +++ b/src/dba/models/HashTypeFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class HashTypeFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): HashType|array|null { function get($pk): ?HashType { return Util::cast(parent::get($pk), HashType::class); } + + /** + * @param HashType $model + * @param array $arr + * @return HashType + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): HashType { + assert($model instanceof HashType); + $model = parent::mset($model, $arr); + assert($model instanceof HashType); + return $model; + } /** * @param HashType $model diff --git a/src/dba/models/HashlistFactory.php b/src/dba/models/HashlistFactory.php index 87768caa2..cd122deab 100644 --- a/src/dba/models/HashlistFactory.php +++ b/src/dba/models/HashlistFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class HashlistFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Hashlist|array|null { function get($pk): ?Hashlist { return Util::cast(parent::get($pk), Hashlist::class); } + + /** + * @param Hashlist $model + * @param array $arr + * @return Hashlist + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Hashlist { + assert($model instanceof Hashlist); + $model = parent::mset($model, $arr); + assert($model instanceof Hashlist); + return $model; + } /** * @param Hashlist $model diff --git a/src/dba/models/HashlistHashlistFactory.php b/src/dba/models/HashlistHashlistFactory.php index 729ab2720..cc608040b 100644 --- a/src/dba/models/HashlistHashlistFactory.php +++ b/src/dba/models/HashlistHashlistFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class HashlistHashlistFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): HashlistHashlist|array|nu function get($pk): ?HashlistHashlist { return Util::cast(parent::get($pk), HashlistHashlist::class); } + + /** + * @param HashlistHashlist $model + * @param array $arr + * @return HashlistHashlist + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): HashlistHashlist { + assert($model instanceof HashlistHashlist); + $model = parent::mset($model, $arr); + assert($model instanceof HashlistHashlist); + return $model; + } /** * @param HashlistHashlist $model diff --git a/src/dba/models/HealthCheckAgentFactory.php b/src/dba/models/HealthCheckAgentFactory.php index 20116f4d9..5b1657ff8 100644 --- a/src/dba/models/HealthCheckAgentFactory.php +++ b/src/dba/models/HealthCheckAgentFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class HealthCheckAgentFactory extends AbstractModelFactory { @@ -85,6 +86,19 @@ function filter(array $options, bool $single = false): HealthCheckAgent|array|nu function get($pk): ?HealthCheckAgent { return Util::cast(parent::get($pk), HealthCheckAgent::class); } + + /** + * @param HealthCheckAgent $model + * @param array $arr + * @return HealthCheckAgent + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): HealthCheckAgent { + assert($model instanceof HealthCheckAgent); + $model = parent::mset($model, $arr); + assert($model instanceof HealthCheckAgent); + return $model; + } /** * @param HealthCheckAgent $model diff --git a/src/dba/models/HealthCheckFactory.php b/src/dba/models/HealthCheckFactory.php index e805d21e6..15ae54499 100644 --- a/src/dba/models/HealthCheckFactory.php +++ b/src/dba/models/HealthCheckFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class HealthCheckFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): HealthCheck|array|null { function get($pk): ?HealthCheck { return Util::cast(parent::get($pk), HealthCheck::class); } + + /** + * @param HealthCheck $model + * @param array $arr + * @return HealthCheck + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): HealthCheck { + assert($model instanceof HealthCheck); + $model = parent::mset($model, $arr); + assert($model instanceof HealthCheck); + return $model; + } /** * @param HealthCheck $model diff --git a/src/dba/models/JwtApiKeyFactory.php b/src/dba/models/JwtApiKeyFactory.php index f4b548141..1011629b8 100644 --- a/src/dba/models/JwtApiKeyFactory.php +++ b/src/dba/models/JwtApiKeyFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class JwtApiKeyFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): JwtApiKey|array|null { function get($pk): ?JwtApiKey { return Util::cast(parent::get($pk), JwtApiKey::class); } + + /** + * @param JwtApiKey $model + * @param array $arr + * @return JwtApiKey + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): JwtApiKey { + assert($model instanceof JwtApiKey); + $model = parent::mset($model, $arr); + assert($model instanceof JwtApiKey); + return $model; + } /** * @param JwtApiKey $model diff --git a/src/dba/models/LogEntryFactory.php b/src/dba/models/LogEntryFactory.php index d9f52bc45..0e37a6ed1 100644 --- a/src/dba/models/LogEntryFactory.php +++ b/src/dba/models/LogEntryFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class LogEntryFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): LogEntry|array|null { function get($pk): ?LogEntry { return Util::cast(parent::get($pk), LogEntry::class); } + + /** + * @param LogEntry $model + * @param array $arr + * @return LogEntry + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): LogEntry { + assert($model instanceof LogEntry); + $model = parent::mset($model, $arr); + assert($model instanceof LogEntry); + return $model; + } /** * @param LogEntry $model diff --git a/src/dba/models/NotificationSettingFactory.php b/src/dba/models/NotificationSettingFactory.php index 5fb92d726..a27ef1e91 100644 --- a/src/dba/models/NotificationSettingFactory.php +++ b/src/dba/models/NotificationSettingFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class NotificationSettingFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): NotificationSetting|array function get($pk): ?NotificationSetting { return Util::cast(parent::get($pk), NotificationSetting::class); } + + /** + * @param NotificationSetting $model + * @param array $arr + * @return NotificationSetting + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): NotificationSetting { + assert($model instanceof NotificationSetting); + $model = parent::mset($model, $arr); + assert($model instanceof NotificationSetting); + return $model; + } /** * @param NotificationSetting $model diff --git a/src/dba/models/PreprocessorFactory.php b/src/dba/models/PreprocessorFactory.php index 545d95481..86cea9993 100644 --- a/src/dba/models/PreprocessorFactory.php +++ b/src/dba/models/PreprocessorFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class PreprocessorFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Preprocessor|array|null { function get($pk): ?Preprocessor { return Util::cast(parent::get($pk), Preprocessor::class); } + + /** + * @param Preprocessor $model + * @param array $arr + * @return Preprocessor + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Preprocessor { + assert($model instanceof Preprocessor); + $model = parent::mset($model, $arr); + assert($model instanceof Preprocessor); + return $model; + } /** * @param Preprocessor $model diff --git a/src/dba/models/PretaskFactory.php b/src/dba/models/PretaskFactory.php index b20f6f6c4..3079938d8 100644 --- a/src/dba/models/PretaskFactory.php +++ b/src/dba/models/PretaskFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class PretaskFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Pretask|array|null { function get($pk): ?Pretask { return Util::cast(parent::get($pk), Pretask::class); } + + /** + * @param Pretask $model + * @param array $arr + * @return Pretask + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Pretask { + assert($model instanceof Pretask); + $model = parent::mset($model, $arr); + assert($model instanceof Pretask); + return $model; + } /** * @param Pretask $model diff --git a/src/dba/models/RegVoucherFactory.php b/src/dba/models/RegVoucherFactory.php index cf7ac8c7b..f46f7002c 100644 --- a/src/dba/models/RegVoucherFactory.php +++ b/src/dba/models/RegVoucherFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class RegVoucherFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): RegVoucher|array|null { function get($pk): ?RegVoucher { return Util::cast(parent::get($pk), RegVoucher::class); } + + /** + * @param RegVoucher $model + * @param array $arr + * @return RegVoucher + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): RegVoucher { + assert($model instanceof RegVoucher); + $model = parent::mset($model, $arr); + assert($model instanceof RegVoucher); + return $model; + } /** * @param RegVoucher $model diff --git a/src/dba/models/RightGroupFactory.php b/src/dba/models/RightGroupFactory.php index 7331eb655..431a182fe 100644 --- a/src/dba/models/RightGroupFactory.php +++ b/src/dba/models/RightGroupFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class RightGroupFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): RightGroup|array|null { function get($pk): ?RightGroup { return Util::cast(parent::get($pk), RightGroup::class); } + + /** + * @param RightGroup $model + * @param array $arr + * @return RightGroup + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): RightGroup { + assert($model instanceof RightGroup); + $model = parent::mset($model, $arr); + assert($model instanceof RightGroup); + return $model; + } /** * @param RightGroup $model diff --git a/src/dba/models/SessionFactory.php b/src/dba/models/SessionFactory.php index a1b075e8a..b0ab4bc50 100644 --- a/src/dba/models/SessionFactory.php +++ b/src/dba/models/SessionFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class SessionFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Session|array|null { function get($pk): ?Session { return Util::cast(parent::get($pk), Session::class); } + + /** + * @param Session $model + * @param array $arr + * @return Session + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Session { + assert($model instanceof Session); + $model = parent::mset($model, $arr); + assert($model instanceof Session); + return $model; + } /** * @param Session $model diff --git a/src/dba/models/SpeedFactory.php b/src/dba/models/SpeedFactory.php index 62db42d19..293c431eb 100644 --- a/src/dba/models/SpeedFactory.php +++ b/src/dba/models/SpeedFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class SpeedFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Speed|array|null { function get($pk): ?Speed { return Util::cast(parent::get($pk), Speed::class); } + + /** + * @param Speed $model + * @param array $arr + * @return Speed + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Speed { + assert($model instanceof Speed); + $model = parent::mset($model, $arr); + assert($model instanceof Speed); + return $model; + } /** * @param Speed $model diff --git a/src/dba/models/StoredValueFactory.php b/src/dba/models/StoredValueFactory.php index 5aa083bfc..80e31c4e7 100644 --- a/src/dba/models/StoredValueFactory.php +++ b/src/dba/models/StoredValueFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class StoredValueFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): StoredValue|array|null { function get($pk): ?StoredValue { return Util::cast(parent::get($pk), StoredValue::class); } + + /** + * @param StoredValue $model + * @param array $arr + * @return StoredValue + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): StoredValue { + assert($model instanceof StoredValue); + $model = parent::mset($model, $arr); + assert($model instanceof StoredValue); + return $model; + } /** * @param StoredValue $model diff --git a/src/dba/models/SupertaskFactory.php b/src/dba/models/SupertaskFactory.php index 9ee14da7d..90cecef62 100644 --- a/src/dba/models/SupertaskFactory.php +++ b/src/dba/models/SupertaskFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class SupertaskFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Supertask|array|null { function get($pk): ?Supertask { return Util::cast(parent::get($pk), Supertask::class); } + + /** + * @param Supertask $model + * @param array $arr + * @return Supertask + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Supertask { + assert($model instanceof Supertask); + $model = parent::mset($model, $arr); + assert($model instanceof Supertask); + return $model; + } /** * @param Supertask $model diff --git a/src/dba/models/SupertaskPretaskFactory.php b/src/dba/models/SupertaskPretaskFactory.php index 83c064b56..fc0d58f5d 100644 --- a/src/dba/models/SupertaskPretaskFactory.php +++ b/src/dba/models/SupertaskPretaskFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class SupertaskPretaskFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): SupertaskPretask|array|nu function get($pk): ?SupertaskPretask { return Util::cast(parent::get($pk), SupertaskPretask::class); } + + /** + * @param SupertaskPretask $model + * @param array $arr + * @return SupertaskPretask + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): SupertaskPretask { + assert($model instanceof SupertaskPretask); + $model = parent::mset($model, $arr); + assert($model instanceof SupertaskPretask); + return $model; + } /** * @param SupertaskPretask $model diff --git a/src/dba/models/TaskDebugOutputFactory.php b/src/dba/models/TaskDebugOutputFactory.php index c9d0f5257..b9844b592 100644 --- a/src/dba/models/TaskDebugOutputFactory.php +++ b/src/dba/models/TaskDebugOutputFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class TaskDebugOutputFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): TaskDebugOutput|array|nul function get($pk): ?TaskDebugOutput { return Util::cast(parent::get($pk), TaskDebugOutput::class); } + + /** + * @param TaskDebugOutput $model + * @param array $arr + * @return TaskDebugOutput + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): TaskDebugOutput { + assert($model instanceof TaskDebugOutput); + $model = parent::mset($model, $arr); + assert($model instanceof TaskDebugOutput); + return $model; + } /** * @param TaskDebugOutput $model diff --git a/src/dba/models/TaskFactory.php b/src/dba/models/TaskFactory.php index 2166ec777..2a71df9f6 100644 --- a/src/dba/models/TaskFactory.php +++ b/src/dba/models/TaskFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class TaskFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Task|array|null { function get($pk): ?Task { return Util::cast(parent::get($pk), Task::class); } + + /** + * @param Task $model + * @param array $arr + * @return Task + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Task { + assert($model instanceof Task); + $model = parent::mset($model, $arr); + assert($model instanceof Task); + return $model; + } /** * @param Task $model diff --git a/src/dba/models/TaskWrapperDisplayFactory.php b/src/dba/models/TaskWrapperDisplayFactory.php index 93ffeb43b..d87941941 100644 --- a/src/dba/models/TaskWrapperDisplayFactory.php +++ b/src/dba/models/TaskWrapperDisplayFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class TaskWrapperDisplayFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): TaskWrapperDisplay|array| function get($pk): ?TaskWrapperDisplay { return Util::cast(parent::get($pk), TaskWrapperDisplay::class); } + + /** + * @param TaskWrapperDisplay $model + * @param array $arr + * @return TaskWrapperDisplay + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): TaskWrapperDisplay { + assert($model instanceof TaskWrapperDisplay); + $model = parent::mset($model, $arr); + assert($model instanceof TaskWrapperDisplay); + return $model; + } /** * @param TaskWrapperDisplay $model diff --git a/src/dba/models/TaskWrapperFactory.php b/src/dba/models/TaskWrapperFactory.php index f88b195d8..55c8e5d07 100644 --- a/src/dba/models/TaskWrapperFactory.php +++ b/src/dba/models/TaskWrapperFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class TaskWrapperFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): TaskWrapper|array|null { function get($pk): ?TaskWrapper { return Util::cast(parent::get($pk), TaskWrapper::class); } + + /** + * @param TaskWrapper $model + * @param array $arr + * @return TaskWrapper + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): TaskWrapper { + assert($model instanceof TaskWrapper); + $model = parent::mset($model, $arr); + assert($model instanceof TaskWrapper); + return $model; + } /** * @param TaskWrapper $model diff --git a/src/dba/models/UserFactory.php b/src/dba/models/UserFactory.php index 70a51458e..5461413dd 100644 --- a/src/dba/models/UserFactory.php +++ b/src/dba/models/UserFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class UserFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): User|array|null { function get($pk): ?User { return Util::cast(parent::get($pk), User::class); } + + /** + * @param User $model + * @param array $arr + * @return User + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): User { + assert($model instanceof User); + $model = parent::mset($model, $arr); + assert($model instanceof User); + return $model; + } /** * @param User $model diff --git a/src/dba/models/ZapFactory.php b/src/dba/models/ZapFactory.php index 7b4bc73ef..998840c4e 100644 --- a/src/dba/models/ZapFactory.php +++ b/src/dba/models/ZapFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class ZapFactory extends AbstractModelFactory { @@ -84,6 +85,19 @@ function filter(array $options, bool $single = false): Zap|array|null { function get($pk): ?Zap { return Util::cast(parent::get($pk), Zap::class); } + + /** + * @param Zap $model + * @param array $arr + * @return Zap + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): Zap { + assert($model instanceof Zap); + $model = parent::mset($model, $arr); + assert($model instanceof Zap); + return $model; + } /** * @param Zap $model diff --git a/src/dba/models/_sqlx_migrationsFactory.php b/src/dba/models/_sqlx_migrationsFactory.php index 375580d5e..b60c4fc93 100644 --- a/src/dba/models/_sqlx_migrationsFactory.php +++ b/src/dba/models/_sqlx_migrationsFactory.php @@ -4,6 +4,7 @@ use Exception; use Hashtopolis\dba\AbstractModelFactory; +use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; class _sqlx_migrationsFactory extends AbstractModelFactory { @@ -89,6 +90,19 @@ function filter(array $options, bool $single = false): _sqlx_migrations|array|nu function get($pk): ?_sqlx_migrations { return Util::cast(parent::get($pk), _sqlx_migrations::class); } + + /** + * @param _sqlx_migrations $model + * @param array $arr + * @return _sqlx_migrations + * @throws Exception + */ + function mset(AbstractModel $model, array $arr): _sqlx_migrations { + assert($model instanceof _sqlx_migrations); + $model = parent::mset($model, $arr); + assert($model instanceof _sqlx_migrations); + return $model; + } /** * @param _sqlx_migrations $model From 22537fa97b66f696a543427b8663a9fe8bf6195f Mon Sep 17 00:00:00 2001 From: s3inlc Date: Thu, 2 Jul 2026 16:32:14 +0200 Subject: [PATCH 03/19] further improvements to make typing better --- src/dba/AbstractModelFactory.php | 7 ++--- .../models/AbstractModelFactory.template.txt | 23 +++++++++++++--- src/dba/models/AccessGroupAgentFactory.php | 23 +++++++++++++--- src/dba/models/AccessGroupFactory.php | 23 +++++++++++++--- src/dba/models/AccessGroupUserFactory.php | 23 +++++++++++++--- src/dba/models/AgentBinaryFactory.php | 23 +++++++++++++--- src/dba/models/AgentErrorFactory.php | 23 +++++++++++++--- src/dba/models/AgentFactory.php | 27 ++++++++++++++----- src/dba/models/AgentStatFactory.php | 23 +++++++++++++--- src/dba/models/AgentZapFactory.php | 23 +++++++++++++--- src/dba/models/ApiGroupFactory.php | 23 +++++++++++++--- src/dba/models/ApiKeyFactory.php | 23 +++++++++++++--- src/dba/models/AssignmentFactory.php | 23 +++++++++++++--- src/dba/models/ChunkFactory.php | 23 +++++++++++++--- src/dba/models/ConfigFactory.php | 23 +++++++++++++--- src/dba/models/ConfigSectionFactory.php | 23 +++++++++++++--- src/dba/models/CrackerBinaryFactory.php | 23 +++++++++++++--- src/dba/models/CrackerBinaryTypeFactory.php | 23 +++++++++++++--- src/dba/models/FileDeleteFactory.php | 23 +++++++++++++--- src/dba/models/FileDownloadFactory.php | 23 +++++++++++++--- src/dba/models/FileFactory.php | 23 +++++++++++++--- src/dba/models/FilePretaskFactory.php | 23 +++++++++++++--- src/dba/models/FileTaskFactory.php | 23 +++++++++++++--- src/dba/models/HashBinaryFactory.php | 23 +++++++++++++--- src/dba/models/HashFactory.php | 23 +++++++++++++--- src/dba/models/HashTypeFactory.php | 23 +++++++++++++--- src/dba/models/HashlistFactory.php | 23 +++++++++++++--- src/dba/models/HashlistHashlistFactory.php | 23 +++++++++++++--- src/dba/models/HealthCheckAgentFactory.php | 23 +++++++++++++--- src/dba/models/HealthCheckFactory.php | 23 +++++++++++++--- src/dba/models/JwtApiKeyFactory.php | 23 +++++++++++++--- src/dba/models/LogEntryFactory.php | 23 +++++++++++++--- src/dba/models/NotificationSettingFactory.php | 23 +++++++++++++--- src/dba/models/PreprocessorFactory.php | 23 +++++++++++++--- src/dba/models/PretaskFactory.php | 23 +++++++++++++--- src/dba/models/RegVoucherFactory.php | 23 +++++++++++++--- src/dba/models/RightGroupFactory.php | 23 +++++++++++++--- src/dba/models/SessionFactory.php | 23 +++++++++++++--- src/dba/models/SpeedFactory.php | 23 +++++++++++++--- src/dba/models/StoredValueFactory.php | 23 +++++++++++++--- src/dba/models/SupertaskFactory.php | 23 +++++++++++++--- src/dba/models/SupertaskPretaskFactory.php | 23 +++++++++++++--- src/dba/models/TaskDebugOutputFactory.php | 23 +++++++++++++--- src/dba/models/TaskFactory.php | 23 +++++++++++++--- src/dba/models/TaskWrapperDisplayFactory.php | 23 +++++++++++++--- src/dba/models/TaskWrapperFactory.php | 23 +++++++++++++--- src/dba/models/UserFactory.php | 23 +++++++++++++--- src/dba/models/ZapFactory.php | 23 +++++++++++++--- src/dba/models/_sqlx_migrationsFactory.php | 23 +++++++++++++--- src/inc/api/APIBasic.php | 2 +- src/inc/apiv2/common/AbstractModelAPI.php | 4 --- 51 files changed, 919 insertions(+), 202 deletions(-) diff --git a/src/dba/AbstractModelFactory.php b/src/dba/AbstractModelFactory.php index e36d6bdc3..5f4e771e7 100755 --- a/src/dba/AbstractModelFactory.php +++ b/src/dba/AbstractModelFactory.php @@ -293,10 +293,10 @@ public function update(AbstractModel $model): PDOStatement { * Returns the return of PDO::execute() or null if nothing was executed * @param AbstractModel $model AbstractModel primary key of model * @param $arr array key-value associations for update - * @return AbstractModel + * @return PDOStatement * @throws Exception */ - public function mset(AbstractModel $model, array $arr): AbstractModel { + public function mset(AbstractModel &$model, array $arr): PDOStatement { $query = "UPDATE " . $this->getMappedModelTable() . " SET "; $elements = []; $values = []; @@ -312,7 +312,8 @@ public function mset(AbstractModel $model, array $arr): AbstractModel { $stmt = $this->getDB()->prepare($query); $stmt->execute($values); - return $this->get($model->getPrimaryKeyValue()); + $model = $this->get($model->getPrimaryKeyValue()); + return $stmt; } /** diff --git a/src/dba/models/AbstractModelFactory.template.txt b/src/dba/models/AbstractModelFactory.template.txt index 893084090..ff01030b7 100644 --- a/src/dba/models/AbstractModelFactory.template.txt +++ b/src/dba/models/AbstractModelFactory.template.txt @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { /** * @param __MODEL_NAME__ $model * @param array $arr - * @return __MODEL_NAME__ + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof __MODEL_NAME__); + $stmt = parent::mset($model, $arr); + assert($model instanceof __MODEL_NAME__); + return $stmt; + } + + /** + * @param __MODEL_NAME__ $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): __MODEL_NAME__ { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof __MODEL_NAME__); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof __MODEL_NAME__); - return $model; + return $stmt; } /** diff --git a/src/dba/models/AccessGroupAgentFactory.php b/src/dba/models/AccessGroupAgentFactory.php index 46cdb9a64..fa0917c0a 100644 --- a/src/dba/models/AccessGroupAgentFactory.php +++ b/src/dba/models/AccessGroupAgentFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?AccessGroupAgent { /** * @param AccessGroupAgent $model * @param array $arr - * @return AccessGroupAgent + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof AccessGroupAgent); + $stmt = parent::mset($model, $arr); + assert($model instanceof AccessGroupAgent); + return $stmt; + } + + /** + * @param AccessGroupAgent $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): AccessGroupAgent { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof AccessGroupAgent); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof AccessGroupAgent); - return $model; + return $stmt; } /** diff --git a/src/dba/models/AccessGroupFactory.php b/src/dba/models/AccessGroupFactory.php index 1d4155e4e..697fc6f1e 100644 --- a/src/dba/models/AccessGroupFactory.php +++ b/src/dba/models/AccessGroupFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?AccessGroup { /** * @param AccessGroup $model * @param array $arr - * @return AccessGroup + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof AccessGroup); + $stmt = parent::mset($model, $arr); + assert($model instanceof AccessGroup); + return $stmt; + } + + /** + * @param AccessGroup $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): AccessGroup { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof AccessGroup); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof AccessGroup); - return $model; + return $stmt; } /** diff --git a/src/dba/models/AccessGroupUserFactory.php b/src/dba/models/AccessGroupUserFactory.php index eb1371d5e..e713aae75 100644 --- a/src/dba/models/AccessGroupUserFactory.php +++ b/src/dba/models/AccessGroupUserFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?AccessGroupUser { /** * @param AccessGroupUser $model * @param array $arr - * @return AccessGroupUser + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof AccessGroupUser); + $stmt = parent::mset($model, $arr); + assert($model instanceof AccessGroupUser); + return $stmt; + } + + /** + * @param AccessGroupUser $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): AccessGroupUser { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof AccessGroupUser); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof AccessGroupUser); - return $model; + return $stmt; } /** diff --git a/src/dba/models/AgentBinaryFactory.php b/src/dba/models/AgentBinaryFactory.php index b72861a2a..0376cf9a4 100644 --- a/src/dba/models/AgentBinaryFactory.php +++ b/src/dba/models/AgentBinaryFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?AgentBinary { /** * @param AgentBinary $model * @param array $arr - * @return AgentBinary + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof AgentBinary); + $stmt = parent::mset($model, $arr); + assert($model instanceof AgentBinary); + return $stmt; + } + + /** + * @param AgentBinary $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): AgentBinary { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof AgentBinary); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof AgentBinary); - return $model; + return $stmt; } /** diff --git a/src/dba/models/AgentErrorFactory.php b/src/dba/models/AgentErrorFactory.php index 300311132..24ffab911 100644 --- a/src/dba/models/AgentErrorFactory.php +++ b/src/dba/models/AgentErrorFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?AgentError { /** * @param AgentError $model * @param array $arr - * @return AgentError + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof AgentError); + $stmt = parent::mset($model, $arr); + assert($model instanceof AgentError); + return $stmt; + } + + /** + * @param AgentError $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): AgentError { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof AgentError); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof AgentError); - return $model; + return $stmt; } /** diff --git a/src/dba/models/AgentFactory.php b/src/dba/models/AgentFactory.php index 1d0c130d9..142b849c7 100644 --- a/src/dba/models/AgentFactory.php +++ b/src/dba/models/AgentFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -15,7 +16,7 @@ function getModelName(): string { function getModelTable(): string { return "Agent"; } - + function isMapping(): bool { return False; } @@ -85,18 +86,32 @@ function filter(array $options, bool $single = false): Agent|array|null { function get($pk): ?Agent { return Util::cast(parent::get($pk), Agent::class); } - + /** * @param Agent $model * @param array $arr - * @return Agent + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Agent); + $stmt = parent::mset($model, $arr); + assert($model instanceof Agent); + return $stmt; + } + + /** + * @param Agent $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Agent { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Agent); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Agent); - return $model; + return $stmt; } /** diff --git a/src/dba/models/AgentStatFactory.php b/src/dba/models/AgentStatFactory.php index 217adee2a..63cc7ce3f 100644 --- a/src/dba/models/AgentStatFactory.php +++ b/src/dba/models/AgentStatFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?AgentStat { /** * @param AgentStat $model * @param array $arr - * @return AgentStat + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof AgentStat); + $stmt = parent::mset($model, $arr); + assert($model instanceof AgentStat); + return $stmt; + } + + /** + * @param AgentStat $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): AgentStat { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof AgentStat); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof AgentStat); - return $model; + return $stmt; } /** diff --git a/src/dba/models/AgentZapFactory.php b/src/dba/models/AgentZapFactory.php index 9a9a1a6a2..44fc14e6e 100644 --- a/src/dba/models/AgentZapFactory.php +++ b/src/dba/models/AgentZapFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?AgentZap { /** * @param AgentZap $model * @param array $arr - * @return AgentZap + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof AgentZap); + $stmt = parent::mset($model, $arr); + assert($model instanceof AgentZap); + return $stmt; + } + + /** + * @param AgentZap $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): AgentZap { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof AgentZap); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof AgentZap); - return $model; + return $stmt; } /** diff --git a/src/dba/models/ApiGroupFactory.php b/src/dba/models/ApiGroupFactory.php index 09c6c23f7..a7c5eb68c 100644 --- a/src/dba/models/ApiGroupFactory.php +++ b/src/dba/models/ApiGroupFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?ApiGroup { /** * @param ApiGroup $model * @param array $arr - * @return ApiGroup + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof ApiGroup); + $stmt = parent::mset($model, $arr); + assert($model instanceof ApiGroup); + return $stmt; + } + + /** + * @param ApiGroup $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): ApiGroup { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof ApiGroup); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof ApiGroup); - return $model; + return $stmt; } /** diff --git a/src/dba/models/ApiKeyFactory.php b/src/dba/models/ApiKeyFactory.php index 146ed513c..25b941159 100644 --- a/src/dba/models/ApiKeyFactory.php +++ b/src/dba/models/ApiKeyFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?ApiKey { /** * @param ApiKey $model * @param array $arr - * @return ApiKey + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof ApiKey); + $stmt = parent::mset($model, $arr); + assert($model instanceof ApiKey); + return $stmt; + } + + /** + * @param ApiKey $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): ApiKey { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof ApiKey); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof ApiKey); - return $model; + return $stmt; } /** diff --git a/src/dba/models/AssignmentFactory.php b/src/dba/models/AssignmentFactory.php index 4b92c1956..8854896a7 100644 --- a/src/dba/models/AssignmentFactory.php +++ b/src/dba/models/AssignmentFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Assignment { /** * @param Assignment $model * @param array $arr - * @return Assignment + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Assignment); + $stmt = parent::mset($model, $arr); + assert($model instanceof Assignment); + return $stmt; + } + + /** + * @param Assignment $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Assignment { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Assignment); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Assignment); - return $model; + return $stmt; } /** diff --git a/src/dba/models/ChunkFactory.php b/src/dba/models/ChunkFactory.php index 60c7891a9..482fe9657 100644 --- a/src/dba/models/ChunkFactory.php +++ b/src/dba/models/ChunkFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Chunk { /** * @param Chunk $model * @param array $arr - * @return Chunk + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Chunk); + $stmt = parent::mset($model, $arr); + assert($model instanceof Chunk); + return $stmt; + } + + /** + * @param Chunk $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Chunk { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Chunk); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Chunk); - return $model; + return $stmt; } /** diff --git a/src/dba/models/ConfigFactory.php b/src/dba/models/ConfigFactory.php index b40a84541..657326ccf 100644 --- a/src/dba/models/ConfigFactory.php +++ b/src/dba/models/ConfigFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Config { /** * @param Config $model * @param array $arr - * @return Config + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Config); + $stmt = parent::mset($model, $arr); + assert($model instanceof Config); + return $stmt; + } + + /** + * @param Config $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Config { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Config); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Config); - return $model; + return $stmt; } /** diff --git a/src/dba/models/ConfigSectionFactory.php b/src/dba/models/ConfigSectionFactory.php index 9adec009b..39791c5a2 100644 --- a/src/dba/models/ConfigSectionFactory.php +++ b/src/dba/models/ConfigSectionFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?ConfigSection { /** * @param ConfigSection $model * @param array $arr - * @return ConfigSection + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof ConfigSection); + $stmt = parent::mset($model, $arr); + assert($model instanceof ConfigSection); + return $stmt; + } + + /** + * @param ConfigSection $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): ConfigSection { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof ConfigSection); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof ConfigSection); - return $model; + return $stmt; } /** diff --git a/src/dba/models/CrackerBinaryFactory.php b/src/dba/models/CrackerBinaryFactory.php index 41f09a795..3953fbec7 100644 --- a/src/dba/models/CrackerBinaryFactory.php +++ b/src/dba/models/CrackerBinaryFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?CrackerBinary { /** * @param CrackerBinary $model * @param array $arr - * @return CrackerBinary + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof CrackerBinary); + $stmt = parent::mset($model, $arr); + assert($model instanceof CrackerBinary); + return $stmt; + } + + /** + * @param CrackerBinary $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): CrackerBinary { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof CrackerBinary); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof CrackerBinary); - return $model; + return $stmt; } /** diff --git a/src/dba/models/CrackerBinaryTypeFactory.php b/src/dba/models/CrackerBinaryTypeFactory.php index 89e7917c6..ad50890b0 100644 --- a/src/dba/models/CrackerBinaryTypeFactory.php +++ b/src/dba/models/CrackerBinaryTypeFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?CrackerBinaryType { /** * @param CrackerBinaryType $model * @param array $arr - * @return CrackerBinaryType + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof CrackerBinaryType); + $stmt = parent::mset($model, $arr); + assert($model instanceof CrackerBinaryType); + return $stmt; + } + + /** + * @param CrackerBinaryType $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): CrackerBinaryType { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof CrackerBinaryType); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof CrackerBinaryType); - return $model; + return $stmt; } /** diff --git a/src/dba/models/FileDeleteFactory.php b/src/dba/models/FileDeleteFactory.php index b363c128b..ffbf3c7b4 100644 --- a/src/dba/models/FileDeleteFactory.php +++ b/src/dba/models/FileDeleteFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?FileDelete { /** * @param FileDelete $model * @param array $arr - * @return FileDelete + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof FileDelete); + $stmt = parent::mset($model, $arr); + assert($model instanceof FileDelete); + return $stmt; + } + + /** + * @param FileDelete $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): FileDelete { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof FileDelete); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof FileDelete); - return $model; + return $stmt; } /** diff --git a/src/dba/models/FileDownloadFactory.php b/src/dba/models/FileDownloadFactory.php index bf3fb3695..02cda5883 100644 --- a/src/dba/models/FileDownloadFactory.php +++ b/src/dba/models/FileDownloadFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?FileDownload { /** * @param FileDownload $model * @param array $arr - * @return FileDownload + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof FileDownload); + $stmt = parent::mset($model, $arr); + assert($model instanceof FileDownload); + return $stmt; + } + + /** + * @param FileDownload $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): FileDownload { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof FileDownload); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof FileDownload); - return $model; + return $stmt; } /** diff --git a/src/dba/models/FileFactory.php b/src/dba/models/FileFactory.php index 927dc670f..a1da076df 100644 --- a/src/dba/models/FileFactory.php +++ b/src/dba/models/FileFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?File { /** * @param File $model * @param array $arr - * @return File + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof File); + $stmt = parent::mset($model, $arr); + assert($model instanceof File); + return $stmt; + } + + /** + * @param File $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): File { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof File); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof File); - return $model; + return $stmt; } /** diff --git a/src/dba/models/FilePretaskFactory.php b/src/dba/models/FilePretaskFactory.php index 3f30bdacd..dce930ce1 100644 --- a/src/dba/models/FilePretaskFactory.php +++ b/src/dba/models/FilePretaskFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?FilePretask { /** * @param FilePretask $model * @param array $arr - * @return FilePretask + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof FilePretask); + $stmt = parent::mset($model, $arr); + assert($model instanceof FilePretask); + return $stmt; + } + + /** + * @param FilePretask $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): FilePretask { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof FilePretask); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof FilePretask); - return $model; + return $stmt; } /** diff --git a/src/dba/models/FileTaskFactory.php b/src/dba/models/FileTaskFactory.php index 1d20d394a..d60f5670a 100644 --- a/src/dba/models/FileTaskFactory.php +++ b/src/dba/models/FileTaskFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?FileTask { /** * @param FileTask $model * @param array $arr - * @return FileTask + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof FileTask); + $stmt = parent::mset($model, $arr); + assert($model instanceof FileTask); + return $stmt; + } + + /** + * @param FileTask $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): FileTask { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof FileTask); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof FileTask); - return $model; + return $stmt; } /** diff --git a/src/dba/models/HashBinaryFactory.php b/src/dba/models/HashBinaryFactory.php index 5fee6ef36..697b65122 100644 --- a/src/dba/models/HashBinaryFactory.php +++ b/src/dba/models/HashBinaryFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?HashBinary { /** * @param HashBinary $model * @param array $arr - * @return HashBinary + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof HashBinary); + $stmt = parent::mset($model, $arr); + assert($model instanceof HashBinary); + return $stmt; + } + + /** + * @param HashBinary $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): HashBinary { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof HashBinary); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof HashBinary); - return $model; + return $stmt; } /** diff --git a/src/dba/models/HashFactory.php b/src/dba/models/HashFactory.php index 21f1cd505..675b17396 100644 --- a/src/dba/models/HashFactory.php +++ b/src/dba/models/HashFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Hash { /** * @param Hash $model * @param array $arr - * @return Hash + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Hash); + $stmt = parent::mset($model, $arr); + assert($model instanceof Hash); + return $stmt; + } + + /** + * @param Hash $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Hash { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Hash); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Hash); - return $model; + return $stmt; } /** diff --git a/src/dba/models/HashTypeFactory.php b/src/dba/models/HashTypeFactory.php index 3ddd496bc..8f7826bab 100644 --- a/src/dba/models/HashTypeFactory.php +++ b/src/dba/models/HashTypeFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?HashType { /** * @param HashType $model * @param array $arr - * @return HashType + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof HashType); + $stmt = parent::mset($model, $arr); + assert($model instanceof HashType); + return $stmt; + } + + /** + * @param HashType $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): HashType { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof HashType); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof HashType); - return $model; + return $stmt; } /** diff --git a/src/dba/models/HashlistFactory.php b/src/dba/models/HashlistFactory.php index cd122deab..aa79a49e6 100644 --- a/src/dba/models/HashlistFactory.php +++ b/src/dba/models/HashlistFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Hashlist { /** * @param Hashlist $model * @param array $arr - * @return Hashlist + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Hashlist); + $stmt = parent::mset($model, $arr); + assert($model instanceof Hashlist); + return $stmt; + } + + /** + * @param Hashlist $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Hashlist { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Hashlist); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Hashlist); - return $model; + return $stmt; } /** diff --git a/src/dba/models/HashlistHashlistFactory.php b/src/dba/models/HashlistHashlistFactory.php index cc608040b..55b5f61ed 100644 --- a/src/dba/models/HashlistHashlistFactory.php +++ b/src/dba/models/HashlistHashlistFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?HashlistHashlist { /** * @param HashlistHashlist $model * @param array $arr - * @return HashlistHashlist + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof HashlistHashlist); + $stmt = parent::mset($model, $arr); + assert($model instanceof HashlistHashlist); + return $stmt; + } + + /** + * @param HashlistHashlist $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): HashlistHashlist { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof HashlistHashlist); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof HashlistHashlist); - return $model; + return $stmt; } /** diff --git a/src/dba/models/HealthCheckAgentFactory.php b/src/dba/models/HealthCheckAgentFactory.php index 5b1657ff8..c9a953ecc 100644 --- a/src/dba/models/HealthCheckAgentFactory.php +++ b/src/dba/models/HealthCheckAgentFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -90,14 +91,28 @@ function get($pk): ?HealthCheckAgent { /** * @param HealthCheckAgent $model * @param array $arr - * @return HealthCheckAgent + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof HealthCheckAgent); + $stmt = parent::mset($model, $arr); + assert($model instanceof HealthCheckAgent); + return $stmt; + } + + /** + * @param HealthCheckAgent $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): HealthCheckAgent { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof HealthCheckAgent); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof HealthCheckAgent); - return $model; + return $stmt; } /** diff --git a/src/dba/models/HealthCheckFactory.php b/src/dba/models/HealthCheckFactory.php index 15ae54499..df66d184d 100644 --- a/src/dba/models/HealthCheckFactory.php +++ b/src/dba/models/HealthCheckFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?HealthCheck { /** * @param HealthCheck $model * @param array $arr - * @return HealthCheck + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof HealthCheck); + $stmt = parent::mset($model, $arr); + assert($model instanceof HealthCheck); + return $stmt; + } + + /** + * @param HealthCheck $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): HealthCheck { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof HealthCheck); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof HealthCheck); - return $model; + return $stmt; } /** diff --git a/src/dba/models/JwtApiKeyFactory.php b/src/dba/models/JwtApiKeyFactory.php index 1011629b8..ca9829703 100644 --- a/src/dba/models/JwtApiKeyFactory.php +++ b/src/dba/models/JwtApiKeyFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?JwtApiKey { /** * @param JwtApiKey $model * @param array $arr - * @return JwtApiKey + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof JwtApiKey); + $stmt = parent::mset($model, $arr); + assert($model instanceof JwtApiKey); + return $stmt; + } + + /** + * @param JwtApiKey $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): JwtApiKey { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof JwtApiKey); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof JwtApiKey); - return $model; + return $stmt; } /** diff --git a/src/dba/models/LogEntryFactory.php b/src/dba/models/LogEntryFactory.php index 0e37a6ed1..46c2839fb 100644 --- a/src/dba/models/LogEntryFactory.php +++ b/src/dba/models/LogEntryFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?LogEntry { /** * @param LogEntry $model * @param array $arr - * @return LogEntry + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof LogEntry); + $stmt = parent::mset($model, $arr); + assert($model instanceof LogEntry); + return $stmt; + } + + /** + * @param LogEntry $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): LogEntry { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof LogEntry); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof LogEntry); - return $model; + return $stmt; } /** diff --git a/src/dba/models/NotificationSettingFactory.php b/src/dba/models/NotificationSettingFactory.php index a27ef1e91..48190c9ef 100644 --- a/src/dba/models/NotificationSettingFactory.php +++ b/src/dba/models/NotificationSettingFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?NotificationSetting { /** * @param NotificationSetting $model * @param array $arr - * @return NotificationSetting + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof NotificationSetting); + $stmt = parent::mset($model, $arr); + assert($model instanceof NotificationSetting); + return $stmt; + } + + /** + * @param NotificationSetting $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): NotificationSetting { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof NotificationSetting); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof NotificationSetting); - return $model; + return $stmt; } /** diff --git a/src/dba/models/PreprocessorFactory.php b/src/dba/models/PreprocessorFactory.php index 86cea9993..de3e543ff 100644 --- a/src/dba/models/PreprocessorFactory.php +++ b/src/dba/models/PreprocessorFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Preprocessor { /** * @param Preprocessor $model * @param array $arr - * @return Preprocessor + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Preprocessor); + $stmt = parent::mset($model, $arr); + assert($model instanceof Preprocessor); + return $stmt; + } + + /** + * @param Preprocessor $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Preprocessor { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Preprocessor); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Preprocessor); - return $model; + return $stmt; } /** diff --git a/src/dba/models/PretaskFactory.php b/src/dba/models/PretaskFactory.php index 3079938d8..d7a82ce30 100644 --- a/src/dba/models/PretaskFactory.php +++ b/src/dba/models/PretaskFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Pretask { /** * @param Pretask $model * @param array $arr - * @return Pretask + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Pretask); + $stmt = parent::mset($model, $arr); + assert($model instanceof Pretask); + return $stmt; + } + + /** + * @param Pretask $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Pretask { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Pretask); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Pretask); - return $model; + return $stmt; } /** diff --git a/src/dba/models/RegVoucherFactory.php b/src/dba/models/RegVoucherFactory.php index f46f7002c..38bfd6c1d 100644 --- a/src/dba/models/RegVoucherFactory.php +++ b/src/dba/models/RegVoucherFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?RegVoucher { /** * @param RegVoucher $model * @param array $arr - * @return RegVoucher + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof RegVoucher); + $stmt = parent::mset($model, $arr); + assert($model instanceof RegVoucher); + return $stmt; + } + + /** + * @param RegVoucher $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): RegVoucher { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof RegVoucher); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof RegVoucher); - return $model; + return $stmt; } /** diff --git a/src/dba/models/RightGroupFactory.php b/src/dba/models/RightGroupFactory.php index 431a182fe..d97beb2d7 100644 --- a/src/dba/models/RightGroupFactory.php +++ b/src/dba/models/RightGroupFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?RightGroup { /** * @param RightGroup $model * @param array $arr - * @return RightGroup + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof RightGroup); + $stmt = parent::mset($model, $arr); + assert($model instanceof RightGroup); + return $stmt; + } + + /** + * @param RightGroup $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): RightGroup { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof RightGroup); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof RightGroup); - return $model; + return $stmt; } /** diff --git a/src/dba/models/SessionFactory.php b/src/dba/models/SessionFactory.php index b0ab4bc50..5a4dee782 100644 --- a/src/dba/models/SessionFactory.php +++ b/src/dba/models/SessionFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Session { /** * @param Session $model * @param array $arr - * @return Session + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Session); + $stmt = parent::mset($model, $arr); + assert($model instanceof Session); + return $stmt; + } + + /** + * @param Session $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Session { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Session); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Session); - return $model; + return $stmt; } /** diff --git a/src/dba/models/SpeedFactory.php b/src/dba/models/SpeedFactory.php index 293c431eb..97cd61a17 100644 --- a/src/dba/models/SpeedFactory.php +++ b/src/dba/models/SpeedFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Speed { /** * @param Speed $model * @param array $arr - * @return Speed + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Speed); + $stmt = parent::mset($model, $arr); + assert($model instanceof Speed); + return $stmt; + } + + /** + * @param Speed $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Speed { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Speed); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Speed); - return $model; + return $stmt; } /** diff --git a/src/dba/models/StoredValueFactory.php b/src/dba/models/StoredValueFactory.php index 80e31c4e7..62509235a 100644 --- a/src/dba/models/StoredValueFactory.php +++ b/src/dba/models/StoredValueFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?StoredValue { /** * @param StoredValue $model * @param array $arr - * @return StoredValue + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof StoredValue); + $stmt = parent::mset($model, $arr); + assert($model instanceof StoredValue); + return $stmt; + } + + /** + * @param StoredValue $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): StoredValue { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof StoredValue); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof StoredValue); - return $model; + return $stmt; } /** diff --git a/src/dba/models/SupertaskFactory.php b/src/dba/models/SupertaskFactory.php index 90cecef62..61023409b 100644 --- a/src/dba/models/SupertaskFactory.php +++ b/src/dba/models/SupertaskFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Supertask { /** * @param Supertask $model * @param array $arr - * @return Supertask + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Supertask); + $stmt = parent::mset($model, $arr); + assert($model instanceof Supertask); + return $stmt; + } + + /** + * @param Supertask $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Supertask { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Supertask); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Supertask); - return $model; + return $stmt; } /** diff --git a/src/dba/models/SupertaskPretaskFactory.php b/src/dba/models/SupertaskPretaskFactory.php index fc0d58f5d..7d4178de2 100644 --- a/src/dba/models/SupertaskPretaskFactory.php +++ b/src/dba/models/SupertaskPretaskFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?SupertaskPretask { /** * @param SupertaskPretask $model * @param array $arr - * @return SupertaskPretask + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof SupertaskPretask); + $stmt = parent::mset($model, $arr); + assert($model instanceof SupertaskPretask); + return $stmt; + } + + /** + * @param SupertaskPretask $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): SupertaskPretask { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof SupertaskPretask); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof SupertaskPretask); - return $model; + return $stmt; } /** diff --git a/src/dba/models/TaskDebugOutputFactory.php b/src/dba/models/TaskDebugOutputFactory.php index b9844b592..0d9d7e97c 100644 --- a/src/dba/models/TaskDebugOutputFactory.php +++ b/src/dba/models/TaskDebugOutputFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?TaskDebugOutput { /** * @param TaskDebugOutput $model * @param array $arr - * @return TaskDebugOutput + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof TaskDebugOutput); + $stmt = parent::mset($model, $arr); + assert($model instanceof TaskDebugOutput); + return $stmt; + } + + /** + * @param TaskDebugOutput $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): TaskDebugOutput { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof TaskDebugOutput); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof TaskDebugOutput); - return $model; + return $stmt; } /** diff --git a/src/dba/models/TaskFactory.php b/src/dba/models/TaskFactory.php index 2a71df9f6..8c19a94be 100644 --- a/src/dba/models/TaskFactory.php +++ b/src/dba/models/TaskFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Task { /** * @param Task $model * @param array $arr - * @return Task + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Task); + $stmt = parent::mset($model, $arr); + assert($model instanceof Task); + return $stmt; + } + + /** + * @param Task $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Task { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Task); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Task); - return $model; + return $stmt; } /** diff --git a/src/dba/models/TaskWrapperDisplayFactory.php b/src/dba/models/TaskWrapperDisplayFactory.php index d87941941..8f4b7250f 100644 --- a/src/dba/models/TaskWrapperDisplayFactory.php +++ b/src/dba/models/TaskWrapperDisplayFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?TaskWrapperDisplay { /** * @param TaskWrapperDisplay $model * @param array $arr - * @return TaskWrapperDisplay + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof TaskWrapperDisplay); + $stmt = parent::mset($model, $arr); + assert($model instanceof TaskWrapperDisplay); + return $stmt; + } + + /** + * @param TaskWrapperDisplay $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): TaskWrapperDisplay { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof TaskWrapperDisplay); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof TaskWrapperDisplay); - return $model; + return $stmt; } /** diff --git a/src/dba/models/TaskWrapperFactory.php b/src/dba/models/TaskWrapperFactory.php index 55c8e5d07..0dbe73e36 100644 --- a/src/dba/models/TaskWrapperFactory.php +++ b/src/dba/models/TaskWrapperFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?TaskWrapper { /** * @param TaskWrapper $model * @param array $arr - * @return TaskWrapper + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof TaskWrapper); + $stmt = parent::mset($model, $arr); + assert($model instanceof TaskWrapper); + return $stmt; + } + + /** + * @param TaskWrapper $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): TaskWrapper { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof TaskWrapper); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof TaskWrapper); - return $model; + return $stmt; } /** diff --git a/src/dba/models/UserFactory.php b/src/dba/models/UserFactory.php index 5461413dd..59927f9e4 100644 --- a/src/dba/models/UserFactory.php +++ b/src/dba/models/UserFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?User { /** * @param User $model * @param array $arr - * @return User + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof User); + $stmt = parent::mset($model, $arr); + assert($model instanceof User); + return $stmt; + } + + /** + * @param User $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): User { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof User); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof User); - return $model; + return $stmt; } /** diff --git a/src/dba/models/ZapFactory.php b/src/dba/models/ZapFactory.php index 998840c4e..4a3669726 100644 --- a/src/dba/models/ZapFactory.php +++ b/src/dba/models/ZapFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -89,14 +90,28 @@ function get($pk): ?Zap { /** * @param Zap $model * @param array $arr - * @return Zap + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof Zap); + $stmt = parent::mset($model, $arr); + assert($model instanceof Zap); + return $stmt; + } + + /** + * @param Zap $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): Zap { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof Zap); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof Zap); - return $model; + return $stmt; } /** diff --git a/src/dba/models/_sqlx_migrationsFactory.php b/src/dba/models/_sqlx_migrationsFactory.php index b60c4fc93..6cc83c87b 100644 --- a/src/dba/models/_sqlx_migrationsFactory.php +++ b/src/dba/models/_sqlx_migrationsFactory.php @@ -3,6 +3,7 @@ namespace Hashtopolis\dba\models; use Exception; +use PDOStatement; use Hashtopolis\dba\AbstractModelFactory; use Hashtopolis\dba\AbstractModel; use Hashtopolis\dba\Util; @@ -94,14 +95,28 @@ function get($pk): ?_sqlx_migrations { /** * @param _sqlx_migrations $model * @param array $arr - * @return _sqlx_migrations + * @return PDOStatement + * @throws Exception + */ + function mset(AbstractModel &$model, array $arr): PDOStatement { + assert($model instanceof _sqlx_migrations); + $stmt = parent::mset($model, $arr); + assert($model instanceof _sqlx_migrations); + return $stmt; + } + + /** + * @param _sqlx_migrations $model + * @param $key string key of the column to update + * @param $value + * @return PDOStatement * @throws Exception */ - function mset(AbstractModel $model, array $arr): _sqlx_migrations { + function set(AbstractModel &$model, string $key, $value): PDOStatement { assert($model instanceof _sqlx_migrations); - $model = parent::mset($model, $arr); + $stmt = parent::set($model, $key, $value); assert($model instanceof _sqlx_migrations); - return $model; + return $stmt; } /** diff --git a/src/inc/api/APIBasic.php b/src/inc/api/APIBasic.php index 8595f5c27..bc258b327 100644 --- a/src/inc/api/APIBasic.php +++ b/src/inc/api/APIBasic.php @@ -32,7 +32,7 @@ protected function sendResponse($RESPONSE): void { * @throws Exception */ protected function updateAgent($action): void { - $this->agent = Factory::getAgentFactory()->mset($this->agent, [Agent::LAST_IP => Util::getIP(), Agent::LAST_ACT => $action, Agent::LAST_TIME => time()]); + Factory::getAgentFactory()->mset($this->agent, [Agent::LAST_IP => Util::getIP(), Agent::LAST_ACT => $action, Agent::LAST_TIME => time()]); } public function sendErrorResponse($action, $msg): void { diff --git a/src/inc/apiv2/common/AbstractModelAPI.php b/src/inc/apiv2/common/AbstractModelAPI.php index 7833b8dfe..9cc64fd87 100644 --- a/src/inc/apiv2/common/AbstractModelAPI.php +++ b/src/inc/apiv2/common/AbstractModelAPI.php @@ -1740,10 +1740,6 @@ public function deleteToManyRelationshipLink(Request $request, Response $respons $data = $jsonBody['data']; - if (!is_array($data)) { - throw new HttpError("Data is not an array, data should be an array of resource records."); - } - $factory = (isset($junction_table)) ? self::getModelFactory($junction_table) : self::getModelFactory($relationType); if (isset($junction_table)) { $parent_id = $args["id"]; From 697d66897f2fa611c330e34dea0e1e01e35225cf Mon Sep 17 00:00:00 2001 From: s3inlc Date: Thu, 2 Jul 2026 16:32:36 +0200 Subject: [PATCH 04/19] for the moment we want to add the agent api to be scanned --- phpstan.neon | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon b/phpstan.neon index 2be365de4..bb1e5bba2 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,6 +2,7 @@ parameters: paths: - src/inc/apiv2 - ci/phpunit + - src/inc/api level: 4 treatPhpDocTypesAsCertain: false scanDirectories: From 384a2fb2ae2a8490a18511622881941379b7711a Mon Sep 17 00:00:00 2001 From: s3inlc Date: Thu, 2 Jul 2026 16:32:53 +0200 Subject: [PATCH 05/19] also add DBA to scan as it's quite essential --- phpstan.neon | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon b/phpstan.neon index bb1e5bba2..eaacc12f8 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,6 +2,7 @@ parameters: paths: - src/inc/apiv2 - ci/phpunit + - src/dba - src/inc/api level: 4 treatPhpDocTypesAsCertain: false From 5f50adafda205048dcc049af219cce85bec5dac0 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 09:40:25 +0200 Subject: [PATCH 06/19] updating phpdocs for model conversion and fixed some issues --- src/dba/AbstractModelFactory.php | 33 ++++++++----------- .../models/AbstractModelFactory.template.txt | 4 ++- src/dba/models/AccessGroupAgentFactory.php | 4 ++- src/dba/models/AccessGroupFactory.php | 4 ++- src/dba/models/AccessGroupUserFactory.php | 4 ++- src/dba/models/AgentBinaryFactory.php | 4 ++- src/dba/models/AgentErrorFactory.php | 4 ++- src/dba/models/AgentFactory.php | 10 +++--- src/dba/models/AgentStatFactory.php | 4 ++- src/dba/models/AgentZapFactory.php | 4 ++- src/dba/models/ApiGroupFactory.php | 4 ++- src/dba/models/ApiKeyFactory.php | 4 ++- src/dba/models/AssignmentFactory.php | 4 ++- src/dba/models/ChunkFactory.php | 4 ++- src/dba/models/ConfigFactory.php | 4 ++- src/dba/models/ConfigSectionFactory.php | 4 ++- src/dba/models/CrackerBinaryFactory.php | 4 ++- src/dba/models/CrackerBinaryTypeFactory.php | 4 ++- src/dba/models/FileDeleteFactory.php | 4 ++- src/dba/models/FileDownloadFactory.php | 4 ++- src/dba/models/FileFactory.php | 4 ++- src/dba/models/FilePretaskFactory.php | 4 ++- src/dba/models/FileTaskFactory.php | 4 ++- src/dba/models/HashBinaryFactory.php | 4 ++- src/dba/models/HashFactory.php | 4 ++- src/dba/models/HashTypeFactory.php | 4 ++- src/dba/models/HashlistFactory.php | 4 ++- src/dba/models/HashlistHashlistFactory.php | 4 ++- src/dba/models/HealthCheckAgentFactory.php | 4 ++- src/dba/models/HealthCheckFactory.php | 4 ++- src/dba/models/JwtApiKeyFactory.php | 4 ++- src/dba/models/LogEntryFactory.php | 4 ++- src/dba/models/NotificationSettingFactory.php | 4 ++- src/dba/models/PreprocessorFactory.php | 4 ++- src/dba/models/PretaskFactory.php | 4 ++- src/dba/models/RegVoucherFactory.php | 4 ++- src/dba/models/RightGroupFactory.php | 4 ++- src/dba/models/SessionFactory.php | 4 ++- src/dba/models/SpeedFactory.php | 4 ++- src/dba/models/StoredValueFactory.php | 4 ++- src/dba/models/SupertaskFactory.php | 4 ++- src/dba/models/SupertaskPretaskFactory.php | 4 ++- src/dba/models/TaskDebugOutputFactory.php | 4 ++- src/dba/models/TaskFactory.php | 4 ++- src/dba/models/TaskWrapperDisplayFactory.php | 4 ++- src/dba/models/TaskWrapperFactory.php | 4 ++- src/dba/models/UserFactory.php | 4 ++- src/dba/models/ZapFactory.php | 4 ++- src/dba/models/_sqlx_migrationsFactory.php | 4 ++- src/inc/api/APIGetChunk.php | 2 +- src/inc/api/APIGetTask.php | 2 +- 51 files changed, 162 insertions(+), 73 deletions(-) diff --git a/src/dba/AbstractModelFactory.php b/src/dba/AbstractModelFactory.php index 5f4e771e7..8c758f441 100755 --- a/src/dba/AbstractModelFactory.php +++ b/src/dba/AbstractModelFactory.php @@ -312,7 +312,9 @@ public function mset(AbstractModel &$model, array $arr): PDOStatement { $stmt = $this->getDB()->prepare($query); $stmt->execute($values); - $model = $this->get($model->getPrimaryKeyValue()); + $refreshed = $this->get($model->getPrimaryKeyValue()); + assert($refreshed instanceof AbstractModel); + $model = $refreshed; return $stmt; } @@ -337,7 +339,9 @@ public function set(AbstractModel &$model, string $key, $value): PDOStatement { $stmt = $this->getDB()->prepare($query); $stmt->execute($values); - $model = $this->get($model->getPrimaryKeyValue()); + $refreshed = $this->get($model->getPrimaryKeyValue()); + assert($refreshed instanceof AbstractModel); + $model = $refreshed; return $stmt; } @@ -367,7 +371,9 @@ public function inc(AbstractModel &$model, string $key, int $value = 1): PDOStat $stmt = $this->getDB()->prepare($query); $stmt->execute($values); - $model = $this->get($model->getPrimaryKeyValue()); + $refreshed = $this->get($model->getPrimaryKeyValue()); + assert($refreshed instanceof AbstractModel); + $model = $refreshed; return $stmt; } @@ -397,7 +403,9 @@ public function dec(AbstractModel &$model, string $key, int $value = 1): PDOStat $stmt = $this->getDB()->prepare($query); $stmt->execute($values); - $model = $this->get($model->getPrimaryKeyValue()); + $refreshed = $this->get($model->getPrimaryKeyValue()); + assert($refreshed instanceof AbstractModel); + $model = $refreshed; return $stmt; } @@ -700,7 +708,7 @@ public function getFromDB($pk): ?AbstractModel { * $options[Factory::JOIN] is an array of JoinFilter options * * @param $options array containing option settings - * @return AbstractModel[] Returns a list of matching objects + * @return AbstractModel[]|array Returns a list of matching objects * @throws Exception */ private function filterWithJoin(array $options): array { @@ -932,21 +940,6 @@ private function applyLimit($limit): string { return " LIMIT " . $limit->getQueryString($this); } - /** - * @param $groups - * @return string - */ - private function applyGroups($groups): string { - $groupsQueries = array(); - if (!is_array($groups)) { - $groups = array($groups); - } - foreach ($groups as $group) { - $groupsQueries[] = $group->getQueryString($this, true); - } - return " GROUP BY " . implode(", ", $groupsQueries); - } - /** * Deletes the given model * diff --git a/src/dba/models/AbstractModelFactory.template.txt b/src/dba/models/AbstractModelFactory.template.txt index ff01030b7..8287b92c8 100644 --- a/src/dba/models/AbstractModelFactory.template.txt +++ b/src/dba/models/AbstractModelFactory.template.txt @@ -89,6 +89,7 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { /** * @param __MODEL_NAME__ $model + * @param-out __MODEL_NAME__ $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { /** * @param __MODEL_NAME__ $model - * @param $key string key of the column to update + * @param-out __MODEL_NAME__ $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/AccessGroupAgentFactory.php b/src/dba/models/AccessGroupAgentFactory.php index fa0917c0a..80fe0421d 100644 --- a/src/dba/models/AccessGroupAgentFactory.php +++ b/src/dba/models/AccessGroupAgentFactory.php @@ -89,6 +89,7 @@ function get($pk): ?AccessGroupAgent { /** * @param AccessGroupAgent $model + * @param-out AccessGroupAgent $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param AccessGroupAgent $model - * @param $key string key of the column to update + * @param-out AccessGroupAgent $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/AccessGroupFactory.php b/src/dba/models/AccessGroupFactory.php index 697fc6f1e..189e95de3 100644 --- a/src/dba/models/AccessGroupFactory.php +++ b/src/dba/models/AccessGroupFactory.php @@ -89,6 +89,7 @@ function get($pk): ?AccessGroup { /** * @param AccessGroup $model + * @param-out AccessGroup $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param AccessGroup $model - * @param $key string key of the column to update + * @param-out AccessGroup $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/AccessGroupUserFactory.php b/src/dba/models/AccessGroupUserFactory.php index e713aae75..394e39b46 100644 --- a/src/dba/models/AccessGroupUserFactory.php +++ b/src/dba/models/AccessGroupUserFactory.php @@ -89,6 +89,7 @@ function get($pk): ?AccessGroupUser { /** * @param AccessGroupUser $model + * @param-out AccessGroupUser $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param AccessGroupUser $model - * @param $key string key of the column to update + * @param-out AccessGroupUser $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/AgentBinaryFactory.php b/src/dba/models/AgentBinaryFactory.php index 0376cf9a4..d38f0c776 100644 --- a/src/dba/models/AgentBinaryFactory.php +++ b/src/dba/models/AgentBinaryFactory.php @@ -89,6 +89,7 @@ function get($pk): ?AgentBinary { /** * @param AgentBinary $model + * @param-out AgentBinary $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param AgentBinary $model - * @param $key string key of the column to update + * @param-out AgentBinary $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/AgentErrorFactory.php b/src/dba/models/AgentErrorFactory.php index 24ffab911..d19c7d9eb 100644 --- a/src/dba/models/AgentErrorFactory.php +++ b/src/dba/models/AgentErrorFactory.php @@ -89,6 +89,7 @@ function get($pk): ?AgentError { /** * @param AgentError $model + * @param-out AgentError $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param AgentError $model - * @param $key string key of the column to update + * @param-out AgentError $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/AgentFactory.php b/src/dba/models/AgentFactory.php index 142b849c7..314e81d72 100644 --- a/src/dba/models/AgentFactory.php +++ b/src/dba/models/AgentFactory.php @@ -16,7 +16,7 @@ function getModelName(): string { function getModelTable(): string { return "Agent"; } - + function isMapping(): bool { return False; } @@ -86,9 +86,10 @@ function filter(array $options, bool $single = false): Agent|array|null { function get($pk): ?Agent { return Util::cast(parent::get($pk), Agent::class); } - + /** * @param Agent $model + * @param-out Agent $model * @param array $arr * @return PDOStatement * @throws Exception @@ -99,10 +100,11 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { assert($model instanceof Agent); return $stmt; } - + /** * @param Agent $model - * @param $key string key of the column to update + * @param-out Agent $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/AgentStatFactory.php b/src/dba/models/AgentStatFactory.php index 63cc7ce3f..764841e22 100644 --- a/src/dba/models/AgentStatFactory.php +++ b/src/dba/models/AgentStatFactory.php @@ -89,6 +89,7 @@ function get($pk): ?AgentStat { /** * @param AgentStat $model + * @param-out AgentStat $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param AgentStat $model - * @param $key string key of the column to update + * @param-out AgentStat $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/AgentZapFactory.php b/src/dba/models/AgentZapFactory.php index 44fc14e6e..4e472be9b 100644 --- a/src/dba/models/AgentZapFactory.php +++ b/src/dba/models/AgentZapFactory.php @@ -89,6 +89,7 @@ function get($pk): ?AgentZap { /** * @param AgentZap $model + * @param-out AgentZap $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param AgentZap $model - * @param $key string key of the column to update + * @param-out AgentZap $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/ApiGroupFactory.php b/src/dba/models/ApiGroupFactory.php index a7c5eb68c..c30de693d 100644 --- a/src/dba/models/ApiGroupFactory.php +++ b/src/dba/models/ApiGroupFactory.php @@ -89,6 +89,7 @@ function get($pk): ?ApiGroup { /** * @param ApiGroup $model + * @param-out ApiGroup $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param ApiGroup $model - * @param $key string key of the column to update + * @param-out ApiGroup $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/ApiKeyFactory.php b/src/dba/models/ApiKeyFactory.php index 25b941159..0b1c3d95a 100644 --- a/src/dba/models/ApiKeyFactory.php +++ b/src/dba/models/ApiKeyFactory.php @@ -89,6 +89,7 @@ function get($pk): ?ApiKey { /** * @param ApiKey $model + * @param-out ApiKey $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param ApiKey $model - * @param $key string key of the column to update + * @param-out ApiKey $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/AssignmentFactory.php b/src/dba/models/AssignmentFactory.php index 8854896a7..bcd6dd3dd 100644 --- a/src/dba/models/AssignmentFactory.php +++ b/src/dba/models/AssignmentFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Assignment { /** * @param Assignment $model + * @param-out Assignment $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Assignment $model - * @param $key string key of the column to update + * @param-out Assignment $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/ChunkFactory.php b/src/dba/models/ChunkFactory.php index 482fe9657..612f0a54b 100644 --- a/src/dba/models/ChunkFactory.php +++ b/src/dba/models/ChunkFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Chunk { /** * @param Chunk $model + * @param-out Chunk $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Chunk $model - * @param $key string key of the column to update + * @param-out Chunk $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/ConfigFactory.php b/src/dba/models/ConfigFactory.php index 657326ccf..bb5e0052b 100644 --- a/src/dba/models/ConfigFactory.php +++ b/src/dba/models/ConfigFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Config { /** * @param Config $model + * @param-out Config $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Config $model - * @param $key string key of the column to update + * @param-out Config $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/ConfigSectionFactory.php b/src/dba/models/ConfigSectionFactory.php index 39791c5a2..729c4e7a8 100644 --- a/src/dba/models/ConfigSectionFactory.php +++ b/src/dba/models/ConfigSectionFactory.php @@ -89,6 +89,7 @@ function get($pk): ?ConfigSection { /** * @param ConfigSection $model + * @param-out ConfigSection $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param ConfigSection $model - * @param $key string key of the column to update + * @param-out ConfigSection $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/CrackerBinaryFactory.php b/src/dba/models/CrackerBinaryFactory.php index 3953fbec7..4c6a49958 100644 --- a/src/dba/models/CrackerBinaryFactory.php +++ b/src/dba/models/CrackerBinaryFactory.php @@ -89,6 +89,7 @@ function get($pk): ?CrackerBinary { /** * @param CrackerBinary $model + * @param-out CrackerBinary $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param CrackerBinary $model - * @param $key string key of the column to update + * @param-out CrackerBinary $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/CrackerBinaryTypeFactory.php b/src/dba/models/CrackerBinaryTypeFactory.php index ad50890b0..870d3a51b 100644 --- a/src/dba/models/CrackerBinaryTypeFactory.php +++ b/src/dba/models/CrackerBinaryTypeFactory.php @@ -89,6 +89,7 @@ function get($pk): ?CrackerBinaryType { /** * @param CrackerBinaryType $model + * @param-out CrackerBinaryType $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param CrackerBinaryType $model - * @param $key string key of the column to update + * @param-out CrackerBinaryType $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/FileDeleteFactory.php b/src/dba/models/FileDeleteFactory.php index ffbf3c7b4..c16f0e61a 100644 --- a/src/dba/models/FileDeleteFactory.php +++ b/src/dba/models/FileDeleteFactory.php @@ -89,6 +89,7 @@ function get($pk): ?FileDelete { /** * @param FileDelete $model + * @param-out FileDelete $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param FileDelete $model - * @param $key string key of the column to update + * @param-out FileDelete $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/FileDownloadFactory.php b/src/dba/models/FileDownloadFactory.php index 02cda5883..69becd19e 100644 --- a/src/dba/models/FileDownloadFactory.php +++ b/src/dba/models/FileDownloadFactory.php @@ -89,6 +89,7 @@ function get($pk): ?FileDownload { /** * @param FileDownload $model + * @param-out FileDownload $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param FileDownload $model - * @param $key string key of the column to update + * @param-out FileDownload $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/FileFactory.php b/src/dba/models/FileFactory.php index a1da076df..ff5310214 100644 --- a/src/dba/models/FileFactory.php +++ b/src/dba/models/FileFactory.php @@ -89,6 +89,7 @@ function get($pk): ?File { /** * @param File $model + * @param-out File $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param File $model - * @param $key string key of the column to update + * @param-out File $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/FilePretaskFactory.php b/src/dba/models/FilePretaskFactory.php index dce930ce1..0b132d9b0 100644 --- a/src/dba/models/FilePretaskFactory.php +++ b/src/dba/models/FilePretaskFactory.php @@ -89,6 +89,7 @@ function get($pk): ?FilePretask { /** * @param FilePretask $model + * @param-out FilePretask $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param FilePretask $model - * @param $key string key of the column to update + * @param-out FilePretask $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/FileTaskFactory.php b/src/dba/models/FileTaskFactory.php index d60f5670a..a9bfcd9eb 100644 --- a/src/dba/models/FileTaskFactory.php +++ b/src/dba/models/FileTaskFactory.php @@ -89,6 +89,7 @@ function get($pk): ?FileTask { /** * @param FileTask $model + * @param-out FileTask $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param FileTask $model - * @param $key string key of the column to update + * @param-out FileTask $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/HashBinaryFactory.php b/src/dba/models/HashBinaryFactory.php index 697b65122..f9938b0ae 100644 --- a/src/dba/models/HashBinaryFactory.php +++ b/src/dba/models/HashBinaryFactory.php @@ -89,6 +89,7 @@ function get($pk): ?HashBinary { /** * @param HashBinary $model + * @param-out HashBinary $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param HashBinary $model - * @param $key string key of the column to update + * @param-out HashBinary $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/HashFactory.php b/src/dba/models/HashFactory.php index 675b17396..264fb2ba4 100644 --- a/src/dba/models/HashFactory.php +++ b/src/dba/models/HashFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Hash { /** * @param Hash $model + * @param-out Hash $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Hash $model - * @param $key string key of the column to update + * @param-out Hash $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/HashTypeFactory.php b/src/dba/models/HashTypeFactory.php index 8f7826bab..368b379ee 100644 --- a/src/dba/models/HashTypeFactory.php +++ b/src/dba/models/HashTypeFactory.php @@ -89,6 +89,7 @@ function get($pk): ?HashType { /** * @param HashType $model + * @param-out HashType $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param HashType $model - * @param $key string key of the column to update + * @param-out HashType $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/HashlistFactory.php b/src/dba/models/HashlistFactory.php index aa79a49e6..2e74d5dd0 100644 --- a/src/dba/models/HashlistFactory.php +++ b/src/dba/models/HashlistFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Hashlist { /** * @param Hashlist $model + * @param-out Hashlist $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Hashlist $model - * @param $key string key of the column to update + * @param-out Hashlist $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/HashlistHashlistFactory.php b/src/dba/models/HashlistHashlistFactory.php index 55b5f61ed..f028e77fe 100644 --- a/src/dba/models/HashlistHashlistFactory.php +++ b/src/dba/models/HashlistHashlistFactory.php @@ -89,6 +89,7 @@ function get($pk): ?HashlistHashlist { /** * @param HashlistHashlist $model + * @param-out HashlistHashlist $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param HashlistHashlist $model - * @param $key string key of the column to update + * @param-out HashlistHashlist $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/HealthCheckAgentFactory.php b/src/dba/models/HealthCheckAgentFactory.php index c9a953ecc..0cffc8e14 100644 --- a/src/dba/models/HealthCheckAgentFactory.php +++ b/src/dba/models/HealthCheckAgentFactory.php @@ -90,6 +90,7 @@ function get($pk): ?HealthCheckAgent { /** * @param HealthCheckAgent $model + * @param-out HealthCheckAgent $model * @param array $arr * @return PDOStatement * @throws Exception @@ -103,7 +104,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param HealthCheckAgent $model - * @param $key string key of the column to update + * @param-out HealthCheckAgent $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/HealthCheckFactory.php b/src/dba/models/HealthCheckFactory.php index df66d184d..c273555f9 100644 --- a/src/dba/models/HealthCheckFactory.php +++ b/src/dba/models/HealthCheckFactory.php @@ -89,6 +89,7 @@ function get($pk): ?HealthCheck { /** * @param HealthCheck $model + * @param-out HealthCheck $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param HealthCheck $model - * @param $key string key of the column to update + * @param-out HealthCheck $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/JwtApiKeyFactory.php b/src/dba/models/JwtApiKeyFactory.php index ca9829703..7de4613d9 100644 --- a/src/dba/models/JwtApiKeyFactory.php +++ b/src/dba/models/JwtApiKeyFactory.php @@ -89,6 +89,7 @@ function get($pk): ?JwtApiKey { /** * @param JwtApiKey $model + * @param-out JwtApiKey $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param JwtApiKey $model - * @param $key string key of the column to update + * @param-out JwtApiKey $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/LogEntryFactory.php b/src/dba/models/LogEntryFactory.php index 46c2839fb..098b5e4f3 100644 --- a/src/dba/models/LogEntryFactory.php +++ b/src/dba/models/LogEntryFactory.php @@ -89,6 +89,7 @@ function get($pk): ?LogEntry { /** * @param LogEntry $model + * @param-out LogEntry $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param LogEntry $model - * @param $key string key of the column to update + * @param-out LogEntry $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/NotificationSettingFactory.php b/src/dba/models/NotificationSettingFactory.php index 48190c9ef..d0a224422 100644 --- a/src/dba/models/NotificationSettingFactory.php +++ b/src/dba/models/NotificationSettingFactory.php @@ -89,6 +89,7 @@ function get($pk): ?NotificationSetting { /** * @param NotificationSetting $model + * @param-out NotificationSetting $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param NotificationSetting $model - * @param $key string key of the column to update + * @param-out NotificationSetting $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/PreprocessorFactory.php b/src/dba/models/PreprocessorFactory.php index de3e543ff..08a6a54f4 100644 --- a/src/dba/models/PreprocessorFactory.php +++ b/src/dba/models/PreprocessorFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Preprocessor { /** * @param Preprocessor $model + * @param-out Preprocessor $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Preprocessor $model - * @param $key string key of the column to update + * @param-out Preprocessor $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/PretaskFactory.php b/src/dba/models/PretaskFactory.php index d7a82ce30..03ad4ad74 100644 --- a/src/dba/models/PretaskFactory.php +++ b/src/dba/models/PretaskFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Pretask { /** * @param Pretask $model + * @param-out Pretask $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Pretask $model - * @param $key string key of the column to update + * @param-out Pretask $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/RegVoucherFactory.php b/src/dba/models/RegVoucherFactory.php index 38bfd6c1d..a00ad6ba6 100644 --- a/src/dba/models/RegVoucherFactory.php +++ b/src/dba/models/RegVoucherFactory.php @@ -89,6 +89,7 @@ function get($pk): ?RegVoucher { /** * @param RegVoucher $model + * @param-out RegVoucher $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param RegVoucher $model - * @param $key string key of the column to update + * @param-out RegVoucher $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/RightGroupFactory.php b/src/dba/models/RightGroupFactory.php index d97beb2d7..4096deb81 100644 --- a/src/dba/models/RightGroupFactory.php +++ b/src/dba/models/RightGroupFactory.php @@ -89,6 +89,7 @@ function get($pk): ?RightGroup { /** * @param RightGroup $model + * @param-out RightGroup $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param RightGroup $model - * @param $key string key of the column to update + * @param-out RightGroup $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/SessionFactory.php b/src/dba/models/SessionFactory.php index 5a4dee782..8d5279c07 100644 --- a/src/dba/models/SessionFactory.php +++ b/src/dba/models/SessionFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Session { /** * @param Session $model + * @param-out Session $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Session $model - * @param $key string key of the column to update + * @param-out Session $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/SpeedFactory.php b/src/dba/models/SpeedFactory.php index 97cd61a17..b59628e77 100644 --- a/src/dba/models/SpeedFactory.php +++ b/src/dba/models/SpeedFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Speed { /** * @param Speed $model + * @param-out Speed $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Speed $model - * @param $key string key of the column to update + * @param-out Speed $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/StoredValueFactory.php b/src/dba/models/StoredValueFactory.php index 62509235a..1ad8d8836 100644 --- a/src/dba/models/StoredValueFactory.php +++ b/src/dba/models/StoredValueFactory.php @@ -89,6 +89,7 @@ function get($pk): ?StoredValue { /** * @param StoredValue $model + * @param-out StoredValue $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param StoredValue $model - * @param $key string key of the column to update + * @param-out StoredValue $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/SupertaskFactory.php b/src/dba/models/SupertaskFactory.php index 61023409b..8f151ba0f 100644 --- a/src/dba/models/SupertaskFactory.php +++ b/src/dba/models/SupertaskFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Supertask { /** * @param Supertask $model + * @param-out Supertask $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Supertask $model - * @param $key string key of the column to update + * @param-out Supertask $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/SupertaskPretaskFactory.php b/src/dba/models/SupertaskPretaskFactory.php index 7d4178de2..6e4c7cc54 100644 --- a/src/dba/models/SupertaskPretaskFactory.php +++ b/src/dba/models/SupertaskPretaskFactory.php @@ -89,6 +89,7 @@ function get($pk): ?SupertaskPretask { /** * @param SupertaskPretask $model + * @param-out SupertaskPretask $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param SupertaskPretask $model - * @param $key string key of the column to update + * @param-out SupertaskPretask $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/TaskDebugOutputFactory.php b/src/dba/models/TaskDebugOutputFactory.php index 0d9d7e97c..2159cb0d3 100644 --- a/src/dba/models/TaskDebugOutputFactory.php +++ b/src/dba/models/TaskDebugOutputFactory.php @@ -89,6 +89,7 @@ function get($pk): ?TaskDebugOutput { /** * @param TaskDebugOutput $model + * @param-out TaskDebugOutput $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param TaskDebugOutput $model - * @param $key string key of the column to update + * @param-out TaskDebugOutput $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/TaskFactory.php b/src/dba/models/TaskFactory.php index 8c19a94be..139475710 100644 --- a/src/dba/models/TaskFactory.php +++ b/src/dba/models/TaskFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Task { /** * @param Task $model + * @param-out Task $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Task $model - * @param $key string key of the column to update + * @param-out Task $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/TaskWrapperDisplayFactory.php b/src/dba/models/TaskWrapperDisplayFactory.php index 8f4b7250f..b612130d4 100644 --- a/src/dba/models/TaskWrapperDisplayFactory.php +++ b/src/dba/models/TaskWrapperDisplayFactory.php @@ -89,6 +89,7 @@ function get($pk): ?TaskWrapperDisplay { /** * @param TaskWrapperDisplay $model + * @param-out TaskWrapperDisplay $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param TaskWrapperDisplay $model - * @param $key string key of the column to update + * @param-out TaskWrapperDisplay $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/TaskWrapperFactory.php b/src/dba/models/TaskWrapperFactory.php index 0dbe73e36..99e228121 100644 --- a/src/dba/models/TaskWrapperFactory.php +++ b/src/dba/models/TaskWrapperFactory.php @@ -89,6 +89,7 @@ function get($pk): ?TaskWrapper { /** * @param TaskWrapper $model + * @param-out TaskWrapper $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param TaskWrapper $model - * @param $key string key of the column to update + * @param-out TaskWrapper $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/UserFactory.php b/src/dba/models/UserFactory.php index 59927f9e4..30bd849a7 100644 --- a/src/dba/models/UserFactory.php +++ b/src/dba/models/UserFactory.php @@ -89,6 +89,7 @@ function get($pk): ?User { /** * @param User $model + * @param-out User $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param User $model - * @param $key string key of the column to update + * @param-out User $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/ZapFactory.php b/src/dba/models/ZapFactory.php index 4a3669726..529790a66 100644 --- a/src/dba/models/ZapFactory.php +++ b/src/dba/models/ZapFactory.php @@ -89,6 +89,7 @@ function get($pk): ?Zap { /** * @param Zap $model + * @param-out Zap $model * @param array $arr * @return PDOStatement * @throws Exception @@ -102,7 +103,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param Zap $model - * @param $key string key of the column to update + * @param-out Zap $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/dba/models/_sqlx_migrationsFactory.php b/src/dba/models/_sqlx_migrationsFactory.php index 6cc83c87b..ddc8b61e2 100644 --- a/src/dba/models/_sqlx_migrationsFactory.php +++ b/src/dba/models/_sqlx_migrationsFactory.php @@ -94,6 +94,7 @@ function get($pk): ?_sqlx_migrations { /** * @param _sqlx_migrations $model + * @param-out _sqlx_migrations $model * @param array $arr * @return PDOStatement * @throws Exception @@ -107,7 +108,8 @@ function mset(AbstractModel &$model, array $arr): PDOStatement { /** * @param _sqlx_migrations $model - * @param $key string key of the column to update + * @param-out _sqlx_migrations $model + * @param string $key key of the column to update * @param $value * @return PDOStatement * @throws Exception diff --git a/src/inc/api/APIGetChunk.php b/src/inc/api/APIGetChunk.php index 2cf8c12ce..cdf0f5fcf 100644 --- a/src/inc/api/APIGetChunk.php +++ b/src/inc/api/APIGetChunk.php @@ -154,7 +154,7 @@ public function execute(array $QUERY = array()) { $oF = new OrderFilter(Chunk::SKIP, "ASC"); $chunks = Factory::getChunkFactory()->filter([Factory::FILTER => [$qF1, $qF2], Factory::ORDER => $oF]); $qF1 = new QueryFilter(Chunk::PROGRESS, null, "="); - /** @var $chunks Chunk[] */ + /** @var Chunk[] $chunks */ $chunks = array_merge($chunks, Factory::getChunkFactory()->filter([Factory::FILTER => [$qF1, $qF2], Factory::ORDER => $oF])); foreach ($chunks as $chunk) { if ($chunk->getAgentId() == $this->agent->getId()) { diff --git a/src/inc/api/APIGetTask.php b/src/inc/api/APIGetTask.php index c830806b9..735b90ef6 100644 --- a/src/inc/api/APIGetTask.php +++ b/src/inc/api/APIGetTask.php @@ -158,7 +158,7 @@ private function sendTask($task, $assignment) { $qF = new QueryFilter(FileTask::TASK_ID, $task->getId(), "=", Factory::getFileTaskFactory()); $jF = new JoinFilter(Factory::getFileTaskFactory(), File::FILE_ID, FileTask::FILE_ID); $joined = Factory::getFileFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $files File[] */ + /** @var File[] $files */ $files = $joined[Factory::getFileFactory()->getModelName()]; foreach ($files as $file) { $taskFiles[] = $file->getFilename(); From df7bf571efe9a1c92e4efcb4ae481c67809a426f Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 09:54:58 +0200 Subject: [PATCH 07/19] check if stan is happy now --- src/dba/AbstractModelFactory.php | 24 ++++++++++++------- .../models/AbstractModelFactory.template.txt | 18 +++++++------- src/dba/models/AccessGroupAgentFactory.php | 18 +++++++------- src/dba/models/AccessGroupFactory.php | 18 +++++++------- src/dba/models/AccessGroupUserFactory.php | 18 +++++++------- src/dba/models/AgentBinaryFactory.php | 18 +++++++------- src/dba/models/AgentErrorFactory.php | 18 +++++++------- src/dba/models/AgentFactory.php | 18 +++++++------- src/dba/models/AgentStatFactory.php | 18 +++++++------- src/dba/models/AgentZapFactory.php | 18 +++++++------- src/dba/models/ApiGroupFactory.php | 18 +++++++------- src/dba/models/ApiKeyFactory.php | 18 +++++++------- src/dba/models/AssignmentFactory.php | 18 +++++++------- src/dba/models/ChunkFactory.php | 18 +++++++------- src/dba/models/ConfigFactory.php | 18 +++++++------- src/dba/models/ConfigSectionFactory.php | 18 +++++++------- src/dba/models/CrackerBinaryFactory.php | 18 +++++++------- src/dba/models/CrackerBinaryTypeFactory.php | 18 +++++++------- src/dba/models/FileDeleteFactory.php | 18 +++++++------- src/dba/models/FileDownloadFactory.php | 18 +++++++------- src/dba/models/FileFactory.php | 18 +++++++------- src/dba/models/FilePretaskFactory.php | 18 +++++++------- src/dba/models/FileTaskFactory.php | 18 +++++++------- src/dba/models/HashBinaryFactory.php | 18 +++++++------- src/dba/models/HashFactory.php | 18 +++++++------- src/dba/models/HashTypeFactory.php | 18 +++++++------- src/dba/models/HashlistFactory.php | 18 +++++++------- src/dba/models/HashlistHashlistFactory.php | 18 +++++++------- src/dba/models/HealthCheckAgentFactory.php | 18 +++++++------- src/dba/models/HealthCheckFactory.php | 18 +++++++------- src/dba/models/JwtApiKeyFactory.php | 18 +++++++------- src/dba/models/LogEntryFactory.php | 18 +++++++------- src/dba/models/NotificationSettingFactory.php | 18 +++++++------- src/dba/models/PreprocessorFactory.php | 18 +++++++------- src/dba/models/PretaskFactory.php | 18 +++++++------- src/dba/models/RegVoucherFactory.php | 18 +++++++------- src/dba/models/RightGroupFactory.php | 18 +++++++------- src/dba/models/SessionFactory.php | 18 +++++++------- src/dba/models/SpeedFactory.php | 18 +++++++------- src/dba/models/StoredValueFactory.php | 18 +++++++------- src/dba/models/SupertaskFactory.php | 18 +++++++------- src/dba/models/SupertaskPretaskFactory.php | 18 +++++++------- src/dba/models/TaskDebugOutputFactory.php | 18 +++++++------- src/dba/models/TaskFactory.php | 18 +++++++------- src/dba/models/TaskWrapperDisplayFactory.php | 18 +++++++------- src/dba/models/TaskWrapperFactory.php | 18 +++++++------- src/dba/models/UserFactory.php | 18 +++++++------- src/dba/models/ZapFactory.php | 18 +++++++------- src/dba/models/_sqlx_migrationsFactory.php | 18 +++++++------- 49 files changed, 400 insertions(+), 488 deletions(-) diff --git a/src/dba/AbstractModelFactory.php b/src/dba/AbstractModelFactory.php index 8c758f441..9c0de7616 100755 --- a/src/dba/AbstractModelFactory.php +++ b/src/dba/AbstractModelFactory.php @@ -291,12 +291,16 @@ public function update(AbstractModel $model): PDOStatement { * Atomically sets the given keys of this model to the given values without setting all other values (like ->update() does) * * Returns the return of PDO::execute() or null if nothing was executed - * @param AbstractModel $model AbstractModel primary key of model - * @param $arr array key-value associations for update - * @return PDOStatement + * @param ?AbstractModel $model AbstractModel primary key of model + * @param array $arr key-value associations for update + * @return ?PDOStatement * @throws Exception */ - public function mset(AbstractModel &$model, array $arr): PDOStatement { + protected function mset(?AbstractModel &$model, array $arr): ?PDOStatement { + if ($model === null) { + return null; + } + $query = "UPDATE " . $this->getMappedModelTable() . " SET "; $elements = []; $values = []; @@ -322,13 +326,17 @@ public function mset(AbstractModel &$model, array $arr): PDOStatement { * Atomically sets the given key of this model to the given value without altering other values * * Returns the return of PDO::execute() - * @param $model AbstractModel primary key of model - * @param $key string key of the column to update + * @param ?AbstractModel $model primary key of model + * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - public function set(AbstractModel &$model, string $key, $value): PDOStatement { + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { + if ($model === null) { + return null; + } + $query = "UPDATE " . $this->getMappedModelTable() . " SET " . self::getMappedModelKey($model, $key) . "=" . self::binaryPlaceholder($model, $key); $values = []; diff --git a/src/dba/models/AbstractModelFactory.template.txt b/src/dba/models/AbstractModelFactory.template.txt index 8287b92c8..62f1988fe 100644 --- a/src/dba/models/AbstractModelFactory.template.txt +++ b/src/dba/models/AbstractModelFactory.template.txt @@ -88,29 +88,27 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { } /** - * @param __MODEL_NAME__ $model - * @param-out __MODEL_NAME__ $model + * @param ?__MODEL_NAME__ $model + * @param-out ?__MODEL_NAME__ $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof __MODEL_NAME__); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof __MODEL_NAME__); return $stmt; } /** - * @param __MODEL_NAME__ $model - * @param-out __MODEL_NAME__ $model + * @param ?__MODEL_NAME__ $model + * @param-out ?__MODEL_NAME__ $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof __MODEL_NAME__); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof __MODEL_NAME__); return $stmt; diff --git a/src/dba/models/AccessGroupAgentFactory.php b/src/dba/models/AccessGroupAgentFactory.php index 80fe0421d..87010ce5c 100644 --- a/src/dba/models/AccessGroupAgentFactory.php +++ b/src/dba/models/AccessGroupAgentFactory.php @@ -88,29 +88,27 @@ function get($pk): ?AccessGroupAgent { } /** - * @param AccessGroupAgent $model - * @param-out AccessGroupAgent $model + * @param ?AccessGroupAgent $model + * @param-out ?AccessGroupAgent $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof AccessGroupAgent); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof AccessGroupAgent); return $stmt; } /** - * @param AccessGroupAgent $model - * @param-out AccessGroupAgent $model + * @param ?AccessGroupAgent $model + * @param-out ?AccessGroupAgent $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof AccessGroupAgent); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof AccessGroupAgent); return $stmt; diff --git a/src/dba/models/AccessGroupFactory.php b/src/dba/models/AccessGroupFactory.php index 189e95de3..d71206914 100644 --- a/src/dba/models/AccessGroupFactory.php +++ b/src/dba/models/AccessGroupFactory.php @@ -88,29 +88,27 @@ function get($pk): ?AccessGroup { } /** - * @param AccessGroup $model - * @param-out AccessGroup $model + * @param ?AccessGroup $model + * @param-out ?AccessGroup $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof AccessGroup); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof AccessGroup); return $stmt; } /** - * @param AccessGroup $model - * @param-out AccessGroup $model + * @param ?AccessGroup $model + * @param-out ?AccessGroup $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof AccessGroup); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof AccessGroup); return $stmt; diff --git a/src/dba/models/AccessGroupUserFactory.php b/src/dba/models/AccessGroupUserFactory.php index 394e39b46..d313c9df1 100644 --- a/src/dba/models/AccessGroupUserFactory.php +++ b/src/dba/models/AccessGroupUserFactory.php @@ -88,29 +88,27 @@ function get($pk): ?AccessGroupUser { } /** - * @param AccessGroupUser $model - * @param-out AccessGroupUser $model + * @param ?AccessGroupUser $model + * @param-out ?AccessGroupUser $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof AccessGroupUser); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof AccessGroupUser); return $stmt; } /** - * @param AccessGroupUser $model - * @param-out AccessGroupUser $model + * @param ?AccessGroupUser $model + * @param-out ?AccessGroupUser $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof AccessGroupUser); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof AccessGroupUser); return $stmt; diff --git a/src/dba/models/AgentBinaryFactory.php b/src/dba/models/AgentBinaryFactory.php index d38f0c776..0090181dd 100644 --- a/src/dba/models/AgentBinaryFactory.php +++ b/src/dba/models/AgentBinaryFactory.php @@ -88,29 +88,27 @@ function get($pk): ?AgentBinary { } /** - * @param AgentBinary $model - * @param-out AgentBinary $model + * @param ?AgentBinary $model + * @param-out ?AgentBinary $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof AgentBinary); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof AgentBinary); return $stmt; } /** - * @param AgentBinary $model - * @param-out AgentBinary $model + * @param ?AgentBinary $model + * @param-out ?AgentBinary $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof AgentBinary); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof AgentBinary); return $stmt; diff --git a/src/dba/models/AgentErrorFactory.php b/src/dba/models/AgentErrorFactory.php index d19c7d9eb..97f9258e9 100644 --- a/src/dba/models/AgentErrorFactory.php +++ b/src/dba/models/AgentErrorFactory.php @@ -88,29 +88,27 @@ function get($pk): ?AgentError { } /** - * @param AgentError $model - * @param-out AgentError $model + * @param ?AgentError $model + * @param-out ?AgentError $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof AgentError); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof AgentError); return $stmt; } /** - * @param AgentError $model - * @param-out AgentError $model + * @param ?AgentError $model + * @param-out ?AgentError $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof AgentError); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof AgentError); return $stmt; diff --git a/src/dba/models/AgentFactory.php b/src/dba/models/AgentFactory.php index 314e81d72..fc2285be5 100644 --- a/src/dba/models/AgentFactory.php +++ b/src/dba/models/AgentFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Agent { } /** - * @param Agent $model - * @param-out Agent $model + * @param ?Agent $model + * @param-out ?Agent $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Agent); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Agent); return $stmt; } /** - * @param Agent $model - * @param-out Agent $model + * @param ?Agent $model + * @param-out ?Agent $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Agent); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Agent); return $stmt; diff --git a/src/dba/models/AgentStatFactory.php b/src/dba/models/AgentStatFactory.php index 764841e22..9b7cad562 100644 --- a/src/dba/models/AgentStatFactory.php +++ b/src/dba/models/AgentStatFactory.php @@ -88,29 +88,27 @@ function get($pk): ?AgentStat { } /** - * @param AgentStat $model - * @param-out AgentStat $model + * @param ?AgentStat $model + * @param-out ?AgentStat $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof AgentStat); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof AgentStat); return $stmt; } /** - * @param AgentStat $model - * @param-out AgentStat $model + * @param ?AgentStat $model + * @param-out ?AgentStat $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof AgentStat); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof AgentStat); return $stmt; diff --git a/src/dba/models/AgentZapFactory.php b/src/dba/models/AgentZapFactory.php index 4e472be9b..f25a1b1d6 100644 --- a/src/dba/models/AgentZapFactory.php +++ b/src/dba/models/AgentZapFactory.php @@ -88,29 +88,27 @@ function get($pk): ?AgentZap { } /** - * @param AgentZap $model - * @param-out AgentZap $model + * @param ?AgentZap $model + * @param-out ?AgentZap $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof AgentZap); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof AgentZap); return $stmt; } /** - * @param AgentZap $model - * @param-out AgentZap $model + * @param ?AgentZap $model + * @param-out ?AgentZap $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof AgentZap); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof AgentZap); return $stmt; diff --git a/src/dba/models/ApiGroupFactory.php b/src/dba/models/ApiGroupFactory.php index c30de693d..9904e5864 100644 --- a/src/dba/models/ApiGroupFactory.php +++ b/src/dba/models/ApiGroupFactory.php @@ -88,29 +88,27 @@ function get($pk): ?ApiGroup { } /** - * @param ApiGroup $model - * @param-out ApiGroup $model + * @param ?ApiGroup $model + * @param-out ?ApiGroup $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof ApiGroup); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof ApiGroup); return $stmt; } /** - * @param ApiGroup $model - * @param-out ApiGroup $model + * @param ?ApiGroup $model + * @param-out ?ApiGroup $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof ApiGroup); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof ApiGroup); return $stmt; diff --git a/src/dba/models/ApiKeyFactory.php b/src/dba/models/ApiKeyFactory.php index 0b1c3d95a..885d8c0e1 100644 --- a/src/dba/models/ApiKeyFactory.php +++ b/src/dba/models/ApiKeyFactory.php @@ -88,29 +88,27 @@ function get($pk): ?ApiKey { } /** - * @param ApiKey $model - * @param-out ApiKey $model + * @param ?ApiKey $model + * @param-out ?ApiKey $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof ApiKey); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof ApiKey); return $stmt; } /** - * @param ApiKey $model - * @param-out ApiKey $model + * @param ?ApiKey $model + * @param-out ?ApiKey $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof ApiKey); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof ApiKey); return $stmt; diff --git a/src/dba/models/AssignmentFactory.php b/src/dba/models/AssignmentFactory.php index bcd6dd3dd..1bb7cfe0c 100644 --- a/src/dba/models/AssignmentFactory.php +++ b/src/dba/models/AssignmentFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Assignment { } /** - * @param Assignment $model - * @param-out Assignment $model + * @param ?Assignment $model + * @param-out ?Assignment $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Assignment); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Assignment); return $stmt; } /** - * @param Assignment $model - * @param-out Assignment $model + * @param ?Assignment $model + * @param-out ?Assignment $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Assignment); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Assignment); return $stmt; diff --git a/src/dba/models/ChunkFactory.php b/src/dba/models/ChunkFactory.php index 612f0a54b..0fa7b11a3 100644 --- a/src/dba/models/ChunkFactory.php +++ b/src/dba/models/ChunkFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Chunk { } /** - * @param Chunk $model - * @param-out Chunk $model + * @param ?Chunk $model + * @param-out ?Chunk $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Chunk); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Chunk); return $stmt; } /** - * @param Chunk $model - * @param-out Chunk $model + * @param ?Chunk $model + * @param-out ?Chunk $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Chunk); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Chunk); return $stmt; diff --git a/src/dba/models/ConfigFactory.php b/src/dba/models/ConfigFactory.php index bb5e0052b..f7cb9fb45 100644 --- a/src/dba/models/ConfigFactory.php +++ b/src/dba/models/ConfigFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Config { } /** - * @param Config $model - * @param-out Config $model + * @param ?Config $model + * @param-out ?Config $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Config); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Config); return $stmt; } /** - * @param Config $model - * @param-out Config $model + * @param ?Config $model + * @param-out ?Config $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Config); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Config); return $stmt; diff --git a/src/dba/models/ConfigSectionFactory.php b/src/dba/models/ConfigSectionFactory.php index 729c4e7a8..4279a8d84 100644 --- a/src/dba/models/ConfigSectionFactory.php +++ b/src/dba/models/ConfigSectionFactory.php @@ -88,29 +88,27 @@ function get($pk): ?ConfigSection { } /** - * @param ConfigSection $model - * @param-out ConfigSection $model + * @param ?ConfigSection $model + * @param-out ?ConfigSection $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof ConfigSection); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof ConfigSection); return $stmt; } /** - * @param ConfigSection $model - * @param-out ConfigSection $model + * @param ?ConfigSection $model + * @param-out ?ConfigSection $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof ConfigSection); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof ConfigSection); return $stmt; diff --git a/src/dba/models/CrackerBinaryFactory.php b/src/dba/models/CrackerBinaryFactory.php index 4c6a49958..03fb90ef8 100644 --- a/src/dba/models/CrackerBinaryFactory.php +++ b/src/dba/models/CrackerBinaryFactory.php @@ -88,29 +88,27 @@ function get($pk): ?CrackerBinary { } /** - * @param CrackerBinary $model - * @param-out CrackerBinary $model + * @param ?CrackerBinary $model + * @param-out ?CrackerBinary $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof CrackerBinary); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof CrackerBinary); return $stmt; } /** - * @param CrackerBinary $model - * @param-out CrackerBinary $model + * @param ?CrackerBinary $model + * @param-out ?CrackerBinary $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof CrackerBinary); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof CrackerBinary); return $stmt; diff --git a/src/dba/models/CrackerBinaryTypeFactory.php b/src/dba/models/CrackerBinaryTypeFactory.php index 870d3a51b..d8a932cb8 100644 --- a/src/dba/models/CrackerBinaryTypeFactory.php +++ b/src/dba/models/CrackerBinaryTypeFactory.php @@ -88,29 +88,27 @@ function get($pk): ?CrackerBinaryType { } /** - * @param CrackerBinaryType $model - * @param-out CrackerBinaryType $model + * @param ?CrackerBinaryType $model + * @param-out ?CrackerBinaryType $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof CrackerBinaryType); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof CrackerBinaryType); return $stmt; } /** - * @param CrackerBinaryType $model - * @param-out CrackerBinaryType $model + * @param ?CrackerBinaryType $model + * @param-out ?CrackerBinaryType $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof CrackerBinaryType); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof CrackerBinaryType); return $stmt; diff --git a/src/dba/models/FileDeleteFactory.php b/src/dba/models/FileDeleteFactory.php index c16f0e61a..36c3ca140 100644 --- a/src/dba/models/FileDeleteFactory.php +++ b/src/dba/models/FileDeleteFactory.php @@ -88,29 +88,27 @@ function get($pk): ?FileDelete { } /** - * @param FileDelete $model - * @param-out FileDelete $model + * @param ?FileDelete $model + * @param-out ?FileDelete $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof FileDelete); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof FileDelete); return $stmt; } /** - * @param FileDelete $model - * @param-out FileDelete $model + * @param ?FileDelete $model + * @param-out ?FileDelete $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof FileDelete); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof FileDelete); return $stmt; diff --git a/src/dba/models/FileDownloadFactory.php b/src/dba/models/FileDownloadFactory.php index 69becd19e..27f2afe2a 100644 --- a/src/dba/models/FileDownloadFactory.php +++ b/src/dba/models/FileDownloadFactory.php @@ -88,29 +88,27 @@ function get($pk): ?FileDownload { } /** - * @param FileDownload $model - * @param-out FileDownload $model + * @param ?FileDownload $model + * @param-out ?FileDownload $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof FileDownload); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof FileDownload); return $stmt; } /** - * @param FileDownload $model - * @param-out FileDownload $model + * @param ?FileDownload $model + * @param-out ?FileDownload $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof FileDownload); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof FileDownload); return $stmt; diff --git a/src/dba/models/FileFactory.php b/src/dba/models/FileFactory.php index ff5310214..c8bcaf2d4 100644 --- a/src/dba/models/FileFactory.php +++ b/src/dba/models/FileFactory.php @@ -88,29 +88,27 @@ function get($pk): ?File { } /** - * @param File $model - * @param-out File $model + * @param ?File $model + * @param-out ?File $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof File); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof File); return $stmt; } /** - * @param File $model - * @param-out File $model + * @param ?File $model + * @param-out ?File $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof File); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof File); return $stmt; diff --git a/src/dba/models/FilePretaskFactory.php b/src/dba/models/FilePretaskFactory.php index 0b132d9b0..6534421aa 100644 --- a/src/dba/models/FilePretaskFactory.php +++ b/src/dba/models/FilePretaskFactory.php @@ -88,29 +88,27 @@ function get($pk): ?FilePretask { } /** - * @param FilePretask $model - * @param-out FilePretask $model + * @param ?FilePretask $model + * @param-out ?FilePretask $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof FilePretask); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof FilePretask); return $stmt; } /** - * @param FilePretask $model - * @param-out FilePretask $model + * @param ?FilePretask $model + * @param-out ?FilePretask $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof FilePretask); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof FilePretask); return $stmt; diff --git a/src/dba/models/FileTaskFactory.php b/src/dba/models/FileTaskFactory.php index a9bfcd9eb..18269a7ca 100644 --- a/src/dba/models/FileTaskFactory.php +++ b/src/dba/models/FileTaskFactory.php @@ -88,29 +88,27 @@ function get($pk): ?FileTask { } /** - * @param FileTask $model - * @param-out FileTask $model + * @param ?FileTask $model + * @param-out ?FileTask $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof FileTask); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof FileTask); return $stmt; } /** - * @param FileTask $model - * @param-out FileTask $model + * @param ?FileTask $model + * @param-out ?FileTask $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof FileTask); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof FileTask); return $stmt; diff --git a/src/dba/models/HashBinaryFactory.php b/src/dba/models/HashBinaryFactory.php index f9938b0ae..62b62975a 100644 --- a/src/dba/models/HashBinaryFactory.php +++ b/src/dba/models/HashBinaryFactory.php @@ -88,29 +88,27 @@ function get($pk): ?HashBinary { } /** - * @param HashBinary $model - * @param-out HashBinary $model + * @param ?HashBinary $model + * @param-out ?HashBinary $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof HashBinary); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof HashBinary); return $stmt; } /** - * @param HashBinary $model - * @param-out HashBinary $model + * @param ?HashBinary $model + * @param-out ?HashBinary $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof HashBinary); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof HashBinary); return $stmt; diff --git a/src/dba/models/HashFactory.php b/src/dba/models/HashFactory.php index 264fb2ba4..515a71f2a 100644 --- a/src/dba/models/HashFactory.php +++ b/src/dba/models/HashFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Hash { } /** - * @param Hash $model - * @param-out Hash $model + * @param ?Hash $model + * @param-out ?Hash $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Hash); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Hash); return $stmt; } /** - * @param Hash $model - * @param-out Hash $model + * @param ?Hash $model + * @param-out ?Hash $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Hash); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Hash); return $stmt; diff --git a/src/dba/models/HashTypeFactory.php b/src/dba/models/HashTypeFactory.php index 368b379ee..d6676ce95 100644 --- a/src/dba/models/HashTypeFactory.php +++ b/src/dba/models/HashTypeFactory.php @@ -88,29 +88,27 @@ function get($pk): ?HashType { } /** - * @param HashType $model - * @param-out HashType $model + * @param ?HashType $model + * @param-out ?HashType $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof HashType); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof HashType); return $stmt; } /** - * @param HashType $model - * @param-out HashType $model + * @param ?HashType $model + * @param-out ?HashType $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof HashType); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof HashType); return $stmt; diff --git a/src/dba/models/HashlistFactory.php b/src/dba/models/HashlistFactory.php index 2e74d5dd0..c8da33324 100644 --- a/src/dba/models/HashlistFactory.php +++ b/src/dba/models/HashlistFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Hashlist { } /** - * @param Hashlist $model - * @param-out Hashlist $model + * @param ?Hashlist $model + * @param-out ?Hashlist $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Hashlist); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Hashlist); return $stmt; } /** - * @param Hashlist $model - * @param-out Hashlist $model + * @param ?Hashlist $model + * @param-out ?Hashlist $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Hashlist); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Hashlist); return $stmt; diff --git a/src/dba/models/HashlistHashlistFactory.php b/src/dba/models/HashlistHashlistFactory.php index f028e77fe..542a65452 100644 --- a/src/dba/models/HashlistHashlistFactory.php +++ b/src/dba/models/HashlistHashlistFactory.php @@ -88,29 +88,27 @@ function get($pk): ?HashlistHashlist { } /** - * @param HashlistHashlist $model - * @param-out HashlistHashlist $model + * @param ?HashlistHashlist $model + * @param-out ?HashlistHashlist $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof HashlistHashlist); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof HashlistHashlist); return $stmt; } /** - * @param HashlistHashlist $model - * @param-out HashlistHashlist $model + * @param ?HashlistHashlist $model + * @param-out ?HashlistHashlist $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof HashlistHashlist); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof HashlistHashlist); return $stmt; diff --git a/src/dba/models/HealthCheckAgentFactory.php b/src/dba/models/HealthCheckAgentFactory.php index 0cffc8e14..d9751f55e 100644 --- a/src/dba/models/HealthCheckAgentFactory.php +++ b/src/dba/models/HealthCheckAgentFactory.php @@ -89,29 +89,27 @@ function get($pk): ?HealthCheckAgent { } /** - * @param HealthCheckAgent $model - * @param-out HealthCheckAgent $model + * @param ?HealthCheckAgent $model + * @param-out ?HealthCheckAgent $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof HealthCheckAgent); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof HealthCheckAgent); return $stmt; } /** - * @param HealthCheckAgent $model - * @param-out HealthCheckAgent $model + * @param ?HealthCheckAgent $model + * @param-out ?HealthCheckAgent $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof HealthCheckAgent); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof HealthCheckAgent); return $stmt; diff --git a/src/dba/models/HealthCheckFactory.php b/src/dba/models/HealthCheckFactory.php index c273555f9..051d58760 100644 --- a/src/dba/models/HealthCheckFactory.php +++ b/src/dba/models/HealthCheckFactory.php @@ -88,29 +88,27 @@ function get($pk): ?HealthCheck { } /** - * @param HealthCheck $model - * @param-out HealthCheck $model + * @param ?HealthCheck $model + * @param-out ?HealthCheck $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof HealthCheck); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof HealthCheck); return $stmt; } /** - * @param HealthCheck $model - * @param-out HealthCheck $model + * @param ?HealthCheck $model + * @param-out ?HealthCheck $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof HealthCheck); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof HealthCheck); return $stmt; diff --git a/src/dba/models/JwtApiKeyFactory.php b/src/dba/models/JwtApiKeyFactory.php index 7de4613d9..e431b02c9 100644 --- a/src/dba/models/JwtApiKeyFactory.php +++ b/src/dba/models/JwtApiKeyFactory.php @@ -88,29 +88,27 @@ function get($pk): ?JwtApiKey { } /** - * @param JwtApiKey $model - * @param-out JwtApiKey $model + * @param ?JwtApiKey $model + * @param-out ?JwtApiKey $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof JwtApiKey); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof JwtApiKey); return $stmt; } /** - * @param JwtApiKey $model - * @param-out JwtApiKey $model + * @param ?JwtApiKey $model + * @param-out ?JwtApiKey $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof JwtApiKey); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof JwtApiKey); return $stmt; diff --git a/src/dba/models/LogEntryFactory.php b/src/dba/models/LogEntryFactory.php index 098b5e4f3..cadc89dc9 100644 --- a/src/dba/models/LogEntryFactory.php +++ b/src/dba/models/LogEntryFactory.php @@ -88,29 +88,27 @@ function get($pk): ?LogEntry { } /** - * @param LogEntry $model - * @param-out LogEntry $model + * @param ?LogEntry $model + * @param-out ?LogEntry $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof LogEntry); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof LogEntry); return $stmt; } /** - * @param LogEntry $model - * @param-out LogEntry $model + * @param ?LogEntry $model + * @param-out ?LogEntry $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof LogEntry); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof LogEntry); return $stmt; diff --git a/src/dba/models/NotificationSettingFactory.php b/src/dba/models/NotificationSettingFactory.php index d0a224422..2e9c6e191 100644 --- a/src/dba/models/NotificationSettingFactory.php +++ b/src/dba/models/NotificationSettingFactory.php @@ -88,29 +88,27 @@ function get($pk): ?NotificationSetting { } /** - * @param NotificationSetting $model - * @param-out NotificationSetting $model + * @param ?NotificationSetting $model + * @param-out ?NotificationSetting $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof NotificationSetting); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof NotificationSetting); return $stmt; } /** - * @param NotificationSetting $model - * @param-out NotificationSetting $model + * @param ?NotificationSetting $model + * @param-out ?NotificationSetting $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof NotificationSetting); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof NotificationSetting); return $stmt; diff --git a/src/dba/models/PreprocessorFactory.php b/src/dba/models/PreprocessorFactory.php index 08a6a54f4..076ee08df 100644 --- a/src/dba/models/PreprocessorFactory.php +++ b/src/dba/models/PreprocessorFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Preprocessor { } /** - * @param Preprocessor $model - * @param-out Preprocessor $model + * @param ?Preprocessor $model + * @param-out ?Preprocessor $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Preprocessor); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Preprocessor); return $stmt; } /** - * @param Preprocessor $model - * @param-out Preprocessor $model + * @param ?Preprocessor $model + * @param-out ?Preprocessor $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Preprocessor); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Preprocessor); return $stmt; diff --git a/src/dba/models/PretaskFactory.php b/src/dba/models/PretaskFactory.php index 03ad4ad74..1410a3937 100644 --- a/src/dba/models/PretaskFactory.php +++ b/src/dba/models/PretaskFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Pretask { } /** - * @param Pretask $model - * @param-out Pretask $model + * @param ?Pretask $model + * @param-out ?Pretask $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Pretask); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Pretask); return $stmt; } /** - * @param Pretask $model - * @param-out Pretask $model + * @param ?Pretask $model + * @param-out ?Pretask $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Pretask); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Pretask); return $stmt; diff --git a/src/dba/models/RegVoucherFactory.php b/src/dba/models/RegVoucherFactory.php index a00ad6ba6..92ee823e8 100644 --- a/src/dba/models/RegVoucherFactory.php +++ b/src/dba/models/RegVoucherFactory.php @@ -88,29 +88,27 @@ function get($pk): ?RegVoucher { } /** - * @param RegVoucher $model - * @param-out RegVoucher $model + * @param ?RegVoucher $model + * @param-out ?RegVoucher $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof RegVoucher); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof RegVoucher); return $stmt; } /** - * @param RegVoucher $model - * @param-out RegVoucher $model + * @param ?RegVoucher $model + * @param-out ?RegVoucher $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof RegVoucher); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof RegVoucher); return $stmt; diff --git a/src/dba/models/RightGroupFactory.php b/src/dba/models/RightGroupFactory.php index 4096deb81..bcc008f04 100644 --- a/src/dba/models/RightGroupFactory.php +++ b/src/dba/models/RightGroupFactory.php @@ -88,29 +88,27 @@ function get($pk): ?RightGroup { } /** - * @param RightGroup $model - * @param-out RightGroup $model + * @param ?RightGroup $model + * @param-out ?RightGroup $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof RightGroup); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof RightGroup); return $stmt; } /** - * @param RightGroup $model - * @param-out RightGroup $model + * @param ?RightGroup $model + * @param-out ?RightGroup $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof RightGroup); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof RightGroup); return $stmt; diff --git a/src/dba/models/SessionFactory.php b/src/dba/models/SessionFactory.php index 8d5279c07..e633fcc52 100644 --- a/src/dba/models/SessionFactory.php +++ b/src/dba/models/SessionFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Session { } /** - * @param Session $model - * @param-out Session $model + * @param ?Session $model + * @param-out ?Session $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Session); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Session); return $stmt; } /** - * @param Session $model - * @param-out Session $model + * @param ?Session $model + * @param-out ?Session $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Session); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Session); return $stmt; diff --git a/src/dba/models/SpeedFactory.php b/src/dba/models/SpeedFactory.php index b59628e77..4cd6520eb 100644 --- a/src/dba/models/SpeedFactory.php +++ b/src/dba/models/SpeedFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Speed { } /** - * @param Speed $model - * @param-out Speed $model + * @param ?Speed $model + * @param-out ?Speed $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Speed); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Speed); return $stmt; } /** - * @param Speed $model - * @param-out Speed $model + * @param ?Speed $model + * @param-out ?Speed $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Speed); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Speed); return $stmt; diff --git a/src/dba/models/StoredValueFactory.php b/src/dba/models/StoredValueFactory.php index 1ad8d8836..49706603e 100644 --- a/src/dba/models/StoredValueFactory.php +++ b/src/dba/models/StoredValueFactory.php @@ -88,29 +88,27 @@ function get($pk): ?StoredValue { } /** - * @param StoredValue $model - * @param-out StoredValue $model + * @param ?StoredValue $model + * @param-out ?StoredValue $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof StoredValue); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof StoredValue); return $stmt; } /** - * @param StoredValue $model - * @param-out StoredValue $model + * @param ?StoredValue $model + * @param-out ?StoredValue $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof StoredValue); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof StoredValue); return $stmt; diff --git a/src/dba/models/SupertaskFactory.php b/src/dba/models/SupertaskFactory.php index 8f151ba0f..efaca1043 100644 --- a/src/dba/models/SupertaskFactory.php +++ b/src/dba/models/SupertaskFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Supertask { } /** - * @param Supertask $model - * @param-out Supertask $model + * @param ?Supertask $model + * @param-out ?Supertask $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Supertask); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Supertask); return $stmt; } /** - * @param Supertask $model - * @param-out Supertask $model + * @param ?Supertask $model + * @param-out ?Supertask $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Supertask); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Supertask); return $stmt; diff --git a/src/dba/models/SupertaskPretaskFactory.php b/src/dba/models/SupertaskPretaskFactory.php index 6e4c7cc54..0b64aca65 100644 --- a/src/dba/models/SupertaskPretaskFactory.php +++ b/src/dba/models/SupertaskPretaskFactory.php @@ -88,29 +88,27 @@ function get($pk): ?SupertaskPretask { } /** - * @param SupertaskPretask $model - * @param-out SupertaskPretask $model + * @param ?SupertaskPretask $model + * @param-out ?SupertaskPretask $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof SupertaskPretask); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof SupertaskPretask); return $stmt; } /** - * @param SupertaskPretask $model - * @param-out SupertaskPretask $model + * @param ?SupertaskPretask $model + * @param-out ?SupertaskPretask $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof SupertaskPretask); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof SupertaskPretask); return $stmt; diff --git a/src/dba/models/TaskDebugOutputFactory.php b/src/dba/models/TaskDebugOutputFactory.php index 2159cb0d3..bd9524d8d 100644 --- a/src/dba/models/TaskDebugOutputFactory.php +++ b/src/dba/models/TaskDebugOutputFactory.php @@ -88,29 +88,27 @@ function get($pk): ?TaskDebugOutput { } /** - * @param TaskDebugOutput $model - * @param-out TaskDebugOutput $model + * @param ?TaskDebugOutput $model + * @param-out ?TaskDebugOutput $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof TaskDebugOutput); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof TaskDebugOutput); return $stmt; } /** - * @param TaskDebugOutput $model - * @param-out TaskDebugOutput $model + * @param ?TaskDebugOutput $model + * @param-out ?TaskDebugOutput $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof TaskDebugOutput); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof TaskDebugOutput); return $stmt; diff --git a/src/dba/models/TaskFactory.php b/src/dba/models/TaskFactory.php index 139475710..93f7eb0ff 100644 --- a/src/dba/models/TaskFactory.php +++ b/src/dba/models/TaskFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Task { } /** - * @param Task $model - * @param-out Task $model + * @param ?Task $model + * @param-out ?Task $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Task); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Task); return $stmt; } /** - * @param Task $model - * @param-out Task $model + * @param ?Task $model + * @param-out ?Task $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Task); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Task); return $stmt; diff --git a/src/dba/models/TaskWrapperDisplayFactory.php b/src/dba/models/TaskWrapperDisplayFactory.php index b612130d4..1809a080e 100644 --- a/src/dba/models/TaskWrapperDisplayFactory.php +++ b/src/dba/models/TaskWrapperDisplayFactory.php @@ -88,29 +88,27 @@ function get($pk): ?TaskWrapperDisplay { } /** - * @param TaskWrapperDisplay $model - * @param-out TaskWrapperDisplay $model + * @param ?TaskWrapperDisplay $model + * @param-out ?TaskWrapperDisplay $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof TaskWrapperDisplay); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof TaskWrapperDisplay); return $stmt; } /** - * @param TaskWrapperDisplay $model - * @param-out TaskWrapperDisplay $model + * @param ?TaskWrapperDisplay $model + * @param-out ?TaskWrapperDisplay $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof TaskWrapperDisplay); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof TaskWrapperDisplay); return $stmt; diff --git a/src/dba/models/TaskWrapperFactory.php b/src/dba/models/TaskWrapperFactory.php index 99e228121..3eb6e7dd8 100644 --- a/src/dba/models/TaskWrapperFactory.php +++ b/src/dba/models/TaskWrapperFactory.php @@ -88,29 +88,27 @@ function get($pk): ?TaskWrapper { } /** - * @param TaskWrapper $model - * @param-out TaskWrapper $model + * @param ?TaskWrapper $model + * @param-out ?TaskWrapper $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof TaskWrapper); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof TaskWrapper); return $stmt; } /** - * @param TaskWrapper $model - * @param-out TaskWrapper $model + * @param ?TaskWrapper $model + * @param-out ?TaskWrapper $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof TaskWrapper); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof TaskWrapper); return $stmt; diff --git a/src/dba/models/UserFactory.php b/src/dba/models/UserFactory.php index 30bd849a7..2c41033d3 100644 --- a/src/dba/models/UserFactory.php +++ b/src/dba/models/UserFactory.php @@ -88,29 +88,27 @@ function get($pk): ?User { } /** - * @param User $model - * @param-out User $model + * @param ?User $model + * @param-out ?User $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof User); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof User); return $stmt; } /** - * @param User $model - * @param-out User $model + * @param ?User $model + * @param-out ?User $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof User); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof User); return $stmt; diff --git a/src/dba/models/ZapFactory.php b/src/dba/models/ZapFactory.php index 529790a66..f7860e14f 100644 --- a/src/dba/models/ZapFactory.php +++ b/src/dba/models/ZapFactory.php @@ -88,29 +88,27 @@ function get($pk): ?Zap { } /** - * @param Zap $model - * @param-out Zap $model + * @param ?Zap $model + * @param-out ?Zap $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof Zap); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof Zap); return $stmt; } /** - * @param Zap $model - * @param-out Zap $model + * @param ?Zap $model + * @param-out ?Zap $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof Zap); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof Zap); return $stmt; diff --git a/src/dba/models/_sqlx_migrationsFactory.php b/src/dba/models/_sqlx_migrationsFactory.php index ddc8b61e2..b7f330aad 100644 --- a/src/dba/models/_sqlx_migrationsFactory.php +++ b/src/dba/models/_sqlx_migrationsFactory.php @@ -93,29 +93,27 @@ function get($pk): ?_sqlx_migrations { } /** - * @param _sqlx_migrations $model - * @param-out _sqlx_migrations $model + * @param ?_sqlx_migrations $model + * @param-out ?_sqlx_migrations $model * @param array $arr - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function mset(AbstractModel &$model, array $arr): PDOStatement { - assert($model instanceof _sqlx_migrations); + public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = parent::mset($model, $arr); assert($model instanceof _sqlx_migrations); return $stmt; } /** - * @param _sqlx_migrations $model - * @param-out _sqlx_migrations $model + * @param ?_sqlx_migrations $model + * @param-out ?_sqlx_migrations $model * @param string $key key of the column to update * @param $value - * @return PDOStatement + * @return ?PDOStatement * @throws Exception */ - function set(AbstractModel &$model, string $key, $value): PDOStatement { - assert($model instanceof _sqlx_migrations); + public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { $stmt = parent::set($model, $key, $value); assert($model instanceof _sqlx_migrations); return $stmt; From d42a5400ae5eb9fba49088df2d5522d0a055dd83 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 09:59:25 +0200 Subject: [PATCH 08/19] without wrapper --- .../models/AbstractModelFactory.template.txt | 27 ------------------- src/dba/models/AccessGroupAgentFactory.php | 27 ------------------- src/dba/models/AccessGroupFactory.php | 27 ------------------- src/dba/models/AccessGroupUserFactory.php | 27 ------------------- src/dba/models/AgentBinaryFactory.php | 27 ------------------- src/dba/models/AgentErrorFactory.php | 27 ------------------- src/dba/models/AgentFactory.php | 27 ------------------- src/dba/models/AgentStatFactory.php | 27 ------------------- src/dba/models/AgentZapFactory.php | 27 ------------------- src/dba/models/ApiGroupFactory.php | 27 ------------------- src/dba/models/ApiKeyFactory.php | 27 ------------------- src/dba/models/AssignmentFactory.php | 27 ------------------- src/dba/models/ChunkFactory.php | 27 ------------------- src/dba/models/ConfigFactory.php | 27 ------------------- src/dba/models/ConfigSectionFactory.php | 27 ------------------- src/dba/models/CrackerBinaryFactory.php | 27 ------------------- src/dba/models/CrackerBinaryTypeFactory.php | 27 ------------------- src/dba/models/FileDeleteFactory.php | 27 ------------------- src/dba/models/FileDownloadFactory.php | 27 ------------------- src/dba/models/FileFactory.php | 27 ------------------- src/dba/models/FilePretaskFactory.php | 27 ------------------- src/dba/models/FileTaskFactory.php | 27 ------------------- src/dba/models/HashBinaryFactory.php | 27 ------------------- src/dba/models/HashFactory.php | 27 ------------------- src/dba/models/HashTypeFactory.php | 27 ------------------- src/dba/models/HashlistFactory.php | 27 ------------------- src/dba/models/HashlistHashlistFactory.php | 27 ------------------- src/dba/models/HealthCheckAgentFactory.php | 27 ------------------- src/dba/models/HealthCheckFactory.php | 27 ------------------- src/dba/models/JwtApiKeyFactory.php | 27 ------------------- src/dba/models/LogEntryFactory.php | 27 ------------------- src/dba/models/NotificationSettingFactory.php | 27 ------------------- src/dba/models/PreprocessorFactory.php | 27 ------------------- src/dba/models/PretaskFactory.php | 27 ------------------- src/dba/models/RegVoucherFactory.php | 27 ------------------- src/dba/models/RightGroupFactory.php | 27 ------------------- src/dba/models/SessionFactory.php | 27 ------------------- src/dba/models/SpeedFactory.php | 27 ------------------- src/dba/models/StoredValueFactory.php | 27 ------------------- src/dba/models/SupertaskFactory.php | 27 ------------------- src/dba/models/SupertaskPretaskFactory.php | 27 ------------------- src/dba/models/TaskDebugOutputFactory.php | 27 ------------------- src/dba/models/TaskFactory.php | 27 ------------------- src/dba/models/TaskWrapperDisplayFactory.php | 27 ------------------- src/dba/models/TaskWrapperFactory.php | 27 ------------------- src/dba/models/UserFactory.php | 27 ------------------- src/dba/models/ZapFactory.php | 27 ------------------- src/dba/models/_sqlx_migrationsFactory.php | 27 ------------------- 48 files changed, 1296 deletions(-) diff --git a/src/dba/models/AbstractModelFactory.template.txt b/src/dba/models/AbstractModelFactory.template.txt index 62f1988fe..72f2f2d6e 100644 --- a/src/dba/models/AbstractModelFactory.template.txt +++ b/src/dba/models/AbstractModelFactory.template.txt @@ -86,33 +86,6 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { function get($pk): ?__MODEL_NAME__ { return Util::cast(parent::get($pk), __MODEL_NAME__::class); } - - /** - * @param ?__MODEL_NAME__ $model - * @param-out ?__MODEL_NAME__ $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof __MODEL_NAME__); - return $stmt; - } - - /** - * @param ?__MODEL_NAME__ $model - * @param-out ?__MODEL_NAME__ $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof __MODEL_NAME__); - return $stmt; - } /** * @param __MODEL_NAME__ $model diff --git a/src/dba/models/AccessGroupAgentFactory.php b/src/dba/models/AccessGroupAgentFactory.php index 87010ce5c..2703a0170 100644 --- a/src/dba/models/AccessGroupAgentFactory.php +++ b/src/dba/models/AccessGroupAgentFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): AccessGroupAgent|array|nu function get($pk): ?AccessGroupAgent { return Util::cast(parent::get($pk), AccessGroupAgent::class); } - - /** - * @param ?AccessGroupAgent $model - * @param-out ?AccessGroupAgent $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof AccessGroupAgent); - return $stmt; - } - - /** - * @param ?AccessGroupAgent $model - * @param-out ?AccessGroupAgent $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof AccessGroupAgent); - return $stmt; - } /** * @param AccessGroupAgent $model diff --git a/src/dba/models/AccessGroupFactory.php b/src/dba/models/AccessGroupFactory.php index d71206914..f496735d1 100644 --- a/src/dba/models/AccessGroupFactory.php +++ b/src/dba/models/AccessGroupFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): AccessGroup|array|null { function get($pk): ?AccessGroup { return Util::cast(parent::get($pk), AccessGroup::class); } - - /** - * @param ?AccessGroup $model - * @param-out ?AccessGroup $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof AccessGroup); - return $stmt; - } - - /** - * @param ?AccessGroup $model - * @param-out ?AccessGroup $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof AccessGroup); - return $stmt; - } /** * @param AccessGroup $model diff --git a/src/dba/models/AccessGroupUserFactory.php b/src/dba/models/AccessGroupUserFactory.php index d313c9df1..439252994 100644 --- a/src/dba/models/AccessGroupUserFactory.php +++ b/src/dba/models/AccessGroupUserFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): AccessGroupUser|array|nul function get($pk): ?AccessGroupUser { return Util::cast(parent::get($pk), AccessGroupUser::class); } - - /** - * @param ?AccessGroupUser $model - * @param-out ?AccessGroupUser $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof AccessGroupUser); - return $stmt; - } - - /** - * @param ?AccessGroupUser $model - * @param-out ?AccessGroupUser $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof AccessGroupUser); - return $stmt; - } /** * @param AccessGroupUser $model diff --git a/src/dba/models/AgentBinaryFactory.php b/src/dba/models/AgentBinaryFactory.php index 0090181dd..aecc508b3 100644 --- a/src/dba/models/AgentBinaryFactory.php +++ b/src/dba/models/AgentBinaryFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): AgentBinary|array|null { function get($pk): ?AgentBinary { return Util::cast(parent::get($pk), AgentBinary::class); } - - /** - * @param ?AgentBinary $model - * @param-out ?AgentBinary $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof AgentBinary); - return $stmt; - } - - /** - * @param ?AgentBinary $model - * @param-out ?AgentBinary $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof AgentBinary); - return $stmt; - } /** * @param AgentBinary $model diff --git a/src/dba/models/AgentErrorFactory.php b/src/dba/models/AgentErrorFactory.php index 97f9258e9..4433b3730 100644 --- a/src/dba/models/AgentErrorFactory.php +++ b/src/dba/models/AgentErrorFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): AgentError|array|null { function get($pk): ?AgentError { return Util::cast(parent::get($pk), AgentError::class); } - - /** - * @param ?AgentError $model - * @param-out ?AgentError $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof AgentError); - return $stmt; - } - - /** - * @param ?AgentError $model - * @param-out ?AgentError $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof AgentError); - return $stmt; - } /** * @param AgentError $model diff --git a/src/dba/models/AgentFactory.php b/src/dba/models/AgentFactory.php index fc2285be5..7dd344310 100644 --- a/src/dba/models/AgentFactory.php +++ b/src/dba/models/AgentFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Agent|array|null { function get($pk): ?Agent { return Util::cast(parent::get($pk), Agent::class); } - - /** - * @param ?Agent $model - * @param-out ?Agent $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Agent); - return $stmt; - } - - /** - * @param ?Agent $model - * @param-out ?Agent $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Agent); - return $stmt; - } /** * @param Agent $model diff --git a/src/dba/models/AgentStatFactory.php b/src/dba/models/AgentStatFactory.php index 9b7cad562..51c0be8f4 100644 --- a/src/dba/models/AgentStatFactory.php +++ b/src/dba/models/AgentStatFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): AgentStat|array|null { function get($pk): ?AgentStat { return Util::cast(parent::get($pk), AgentStat::class); } - - /** - * @param ?AgentStat $model - * @param-out ?AgentStat $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof AgentStat); - return $stmt; - } - - /** - * @param ?AgentStat $model - * @param-out ?AgentStat $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof AgentStat); - return $stmt; - } /** * @param AgentStat $model diff --git a/src/dba/models/AgentZapFactory.php b/src/dba/models/AgentZapFactory.php index f25a1b1d6..9f1fe9368 100644 --- a/src/dba/models/AgentZapFactory.php +++ b/src/dba/models/AgentZapFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): AgentZap|array|null { function get($pk): ?AgentZap { return Util::cast(parent::get($pk), AgentZap::class); } - - /** - * @param ?AgentZap $model - * @param-out ?AgentZap $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof AgentZap); - return $stmt; - } - - /** - * @param ?AgentZap $model - * @param-out ?AgentZap $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof AgentZap); - return $stmt; - } /** * @param AgentZap $model diff --git a/src/dba/models/ApiGroupFactory.php b/src/dba/models/ApiGroupFactory.php index 9904e5864..ee8bfdc5f 100644 --- a/src/dba/models/ApiGroupFactory.php +++ b/src/dba/models/ApiGroupFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): ApiGroup|array|null { function get($pk): ?ApiGroup { return Util::cast(parent::get($pk), ApiGroup::class); } - - /** - * @param ?ApiGroup $model - * @param-out ?ApiGroup $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof ApiGroup); - return $stmt; - } - - /** - * @param ?ApiGroup $model - * @param-out ?ApiGroup $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof ApiGroup); - return $stmt; - } /** * @param ApiGroup $model diff --git a/src/dba/models/ApiKeyFactory.php b/src/dba/models/ApiKeyFactory.php index 885d8c0e1..7b9daf1a5 100644 --- a/src/dba/models/ApiKeyFactory.php +++ b/src/dba/models/ApiKeyFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): ApiKey|array|null { function get($pk): ?ApiKey { return Util::cast(parent::get($pk), ApiKey::class); } - - /** - * @param ?ApiKey $model - * @param-out ?ApiKey $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof ApiKey); - return $stmt; - } - - /** - * @param ?ApiKey $model - * @param-out ?ApiKey $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof ApiKey); - return $stmt; - } /** * @param ApiKey $model diff --git a/src/dba/models/AssignmentFactory.php b/src/dba/models/AssignmentFactory.php index 1bb7cfe0c..71f9c54f1 100644 --- a/src/dba/models/AssignmentFactory.php +++ b/src/dba/models/AssignmentFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Assignment|array|null { function get($pk): ?Assignment { return Util::cast(parent::get($pk), Assignment::class); } - - /** - * @param ?Assignment $model - * @param-out ?Assignment $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Assignment); - return $stmt; - } - - /** - * @param ?Assignment $model - * @param-out ?Assignment $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Assignment); - return $stmt; - } /** * @param Assignment $model diff --git a/src/dba/models/ChunkFactory.php b/src/dba/models/ChunkFactory.php index 0fa7b11a3..3349c5811 100644 --- a/src/dba/models/ChunkFactory.php +++ b/src/dba/models/ChunkFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Chunk|array|null { function get($pk): ?Chunk { return Util::cast(parent::get($pk), Chunk::class); } - - /** - * @param ?Chunk $model - * @param-out ?Chunk $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Chunk); - return $stmt; - } - - /** - * @param ?Chunk $model - * @param-out ?Chunk $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Chunk); - return $stmt; - } /** * @param Chunk $model diff --git a/src/dba/models/ConfigFactory.php b/src/dba/models/ConfigFactory.php index f7cb9fb45..3b06d61d1 100644 --- a/src/dba/models/ConfigFactory.php +++ b/src/dba/models/ConfigFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Config|array|null { function get($pk): ?Config { return Util::cast(parent::get($pk), Config::class); } - - /** - * @param ?Config $model - * @param-out ?Config $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Config); - return $stmt; - } - - /** - * @param ?Config $model - * @param-out ?Config $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Config); - return $stmt; - } /** * @param Config $model diff --git a/src/dba/models/ConfigSectionFactory.php b/src/dba/models/ConfigSectionFactory.php index 4279a8d84..683a3778d 100644 --- a/src/dba/models/ConfigSectionFactory.php +++ b/src/dba/models/ConfigSectionFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): ConfigSection|array|null function get($pk): ?ConfigSection { return Util::cast(parent::get($pk), ConfigSection::class); } - - /** - * @param ?ConfigSection $model - * @param-out ?ConfigSection $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof ConfigSection); - return $stmt; - } - - /** - * @param ?ConfigSection $model - * @param-out ?ConfigSection $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof ConfigSection); - return $stmt; - } /** * @param ConfigSection $model diff --git a/src/dba/models/CrackerBinaryFactory.php b/src/dba/models/CrackerBinaryFactory.php index 03fb90ef8..1158e2ef4 100644 --- a/src/dba/models/CrackerBinaryFactory.php +++ b/src/dba/models/CrackerBinaryFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): CrackerBinary|array|null function get($pk): ?CrackerBinary { return Util::cast(parent::get($pk), CrackerBinary::class); } - - /** - * @param ?CrackerBinary $model - * @param-out ?CrackerBinary $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof CrackerBinary); - return $stmt; - } - - /** - * @param ?CrackerBinary $model - * @param-out ?CrackerBinary $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof CrackerBinary); - return $stmt; - } /** * @param CrackerBinary $model diff --git a/src/dba/models/CrackerBinaryTypeFactory.php b/src/dba/models/CrackerBinaryTypeFactory.php index d8a932cb8..9b8544b40 100644 --- a/src/dba/models/CrackerBinaryTypeFactory.php +++ b/src/dba/models/CrackerBinaryTypeFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): CrackerBinaryType|array|n function get($pk): ?CrackerBinaryType { return Util::cast(parent::get($pk), CrackerBinaryType::class); } - - /** - * @param ?CrackerBinaryType $model - * @param-out ?CrackerBinaryType $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof CrackerBinaryType); - return $stmt; - } - - /** - * @param ?CrackerBinaryType $model - * @param-out ?CrackerBinaryType $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof CrackerBinaryType); - return $stmt; - } /** * @param CrackerBinaryType $model diff --git a/src/dba/models/FileDeleteFactory.php b/src/dba/models/FileDeleteFactory.php index 36c3ca140..188b145e1 100644 --- a/src/dba/models/FileDeleteFactory.php +++ b/src/dba/models/FileDeleteFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): FileDelete|array|null { function get($pk): ?FileDelete { return Util::cast(parent::get($pk), FileDelete::class); } - - /** - * @param ?FileDelete $model - * @param-out ?FileDelete $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof FileDelete); - return $stmt; - } - - /** - * @param ?FileDelete $model - * @param-out ?FileDelete $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof FileDelete); - return $stmt; - } /** * @param FileDelete $model diff --git a/src/dba/models/FileDownloadFactory.php b/src/dba/models/FileDownloadFactory.php index 27f2afe2a..47ce0c027 100644 --- a/src/dba/models/FileDownloadFactory.php +++ b/src/dba/models/FileDownloadFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): FileDownload|array|null { function get($pk): ?FileDownload { return Util::cast(parent::get($pk), FileDownload::class); } - - /** - * @param ?FileDownload $model - * @param-out ?FileDownload $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof FileDownload); - return $stmt; - } - - /** - * @param ?FileDownload $model - * @param-out ?FileDownload $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof FileDownload); - return $stmt; - } /** * @param FileDownload $model diff --git a/src/dba/models/FileFactory.php b/src/dba/models/FileFactory.php index c8bcaf2d4..237ee7bd3 100644 --- a/src/dba/models/FileFactory.php +++ b/src/dba/models/FileFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): File|array|null { function get($pk): ?File { return Util::cast(parent::get($pk), File::class); } - - /** - * @param ?File $model - * @param-out ?File $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof File); - return $stmt; - } - - /** - * @param ?File $model - * @param-out ?File $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof File); - return $stmt; - } /** * @param File $model diff --git a/src/dba/models/FilePretaskFactory.php b/src/dba/models/FilePretaskFactory.php index 6534421aa..ebbe68a99 100644 --- a/src/dba/models/FilePretaskFactory.php +++ b/src/dba/models/FilePretaskFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): FilePretask|array|null { function get($pk): ?FilePretask { return Util::cast(parent::get($pk), FilePretask::class); } - - /** - * @param ?FilePretask $model - * @param-out ?FilePretask $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof FilePretask); - return $stmt; - } - - /** - * @param ?FilePretask $model - * @param-out ?FilePretask $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof FilePretask); - return $stmt; - } /** * @param FilePretask $model diff --git a/src/dba/models/FileTaskFactory.php b/src/dba/models/FileTaskFactory.php index 18269a7ca..c6763f017 100644 --- a/src/dba/models/FileTaskFactory.php +++ b/src/dba/models/FileTaskFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): FileTask|array|null { function get($pk): ?FileTask { return Util::cast(parent::get($pk), FileTask::class); } - - /** - * @param ?FileTask $model - * @param-out ?FileTask $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof FileTask); - return $stmt; - } - - /** - * @param ?FileTask $model - * @param-out ?FileTask $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof FileTask); - return $stmt; - } /** * @param FileTask $model diff --git a/src/dba/models/HashBinaryFactory.php b/src/dba/models/HashBinaryFactory.php index 62b62975a..d2e6a5a56 100644 --- a/src/dba/models/HashBinaryFactory.php +++ b/src/dba/models/HashBinaryFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): HashBinary|array|null { function get($pk): ?HashBinary { return Util::cast(parent::get($pk), HashBinary::class); } - - /** - * @param ?HashBinary $model - * @param-out ?HashBinary $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof HashBinary); - return $stmt; - } - - /** - * @param ?HashBinary $model - * @param-out ?HashBinary $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof HashBinary); - return $stmt; - } /** * @param HashBinary $model diff --git a/src/dba/models/HashFactory.php b/src/dba/models/HashFactory.php index 515a71f2a..e53990205 100644 --- a/src/dba/models/HashFactory.php +++ b/src/dba/models/HashFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Hash|array|null { function get($pk): ?Hash { return Util::cast(parent::get($pk), Hash::class); } - - /** - * @param ?Hash $model - * @param-out ?Hash $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Hash); - return $stmt; - } - - /** - * @param ?Hash $model - * @param-out ?Hash $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Hash); - return $stmt; - } /** * @param Hash $model diff --git a/src/dba/models/HashTypeFactory.php b/src/dba/models/HashTypeFactory.php index d6676ce95..1048e747c 100644 --- a/src/dba/models/HashTypeFactory.php +++ b/src/dba/models/HashTypeFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): HashType|array|null { function get($pk): ?HashType { return Util::cast(parent::get($pk), HashType::class); } - - /** - * @param ?HashType $model - * @param-out ?HashType $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof HashType); - return $stmt; - } - - /** - * @param ?HashType $model - * @param-out ?HashType $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof HashType); - return $stmt; - } /** * @param HashType $model diff --git a/src/dba/models/HashlistFactory.php b/src/dba/models/HashlistFactory.php index c8da33324..8965f4883 100644 --- a/src/dba/models/HashlistFactory.php +++ b/src/dba/models/HashlistFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Hashlist|array|null { function get($pk): ?Hashlist { return Util::cast(parent::get($pk), Hashlist::class); } - - /** - * @param ?Hashlist $model - * @param-out ?Hashlist $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Hashlist); - return $stmt; - } - - /** - * @param ?Hashlist $model - * @param-out ?Hashlist $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Hashlist); - return $stmt; - } /** * @param Hashlist $model diff --git a/src/dba/models/HashlistHashlistFactory.php b/src/dba/models/HashlistHashlistFactory.php index 542a65452..e97bc0770 100644 --- a/src/dba/models/HashlistHashlistFactory.php +++ b/src/dba/models/HashlistHashlistFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): HashlistHashlist|array|nu function get($pk): ?HashlistHashlist { return Util::cast(parent::get($pk), HashlistHashlist::class); } - - /** - * @param ?HashlistHashlist $model - * @param-out ?HashlistHashlist $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof HashlistHashlist); - return $stmt; - } - - /** - * @param ?HashlistHashlist $model - * @param-out ?HashlistHashlist $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof HashlistHashlist); - return $stmt; - } /** * @param HashlistHashlist $model diff --git a/src/dba/models/HealthCheckAgentFactory.php b/src/dba/models/HealthCheckAgentFactory.php index d9751f55e..bbab64eea 100644 --- a/src/dba/models/HealthCheckAgentFactory.php +++ b/src/dba/models/HealthCheckAgentFactory.php @@ -87,33 +87,6 @@ function filter(array $options, bool $single = false): HealthCheckAgent|array|nu function get($pk): ?HealthCheckAgent { return Util::cast(parent::get($pk), HealthCheckAgent::class); } - - /** - * @param ?HealthCheckAgent $model - * @param-out ?HealthCheckAgent $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof HealthCheckAgent); - return $stmt; - } - - /** - * @param ?HealthCheckAgent $model - * @param-out ?HealthCheckAgent $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof HealthCheckAgent); - return $stmt; - } /** * @param HealthCheckAgent $model diff --git a/src/dba/models/HealthCheckFactory.php b/src/dba/models/HealthCheckFactory.php index 051d58760..102a4dea9 100644 --- a/src/dba/models/HealthCheckFactory.php +++ b/src/dba/models/HealthCheckFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): HealthCheck|array|null { function get($pk): ?HealthCheck { return Util::cast(parent::get($pk), HealthCheck::class); } - - /** - * @param ?HealthCheck $model - * @param-out ?HealthCheck $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof HealthCheck); - return $stmt; - } - - /** - * @param ?HealthCheck $model - * @param-out ?HealthCheck $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof HealthCheck); - return $stmt; - } /** * @param HealthCheck $model diff --git a/src/dba/models/JwtApiKeyFactory.php b/src/dba/models/JwtApiKeyFactory.php index e431b02c9..1023e376e 100644 --- a/src/dba/models/JwtApiKeyFactory.php +++ b/src/dba/models/JwtApiKeyFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): JwtApiKey|array|null { function get($pk): ?JwtApiKey { return Util::cast(parent::get($pk), JwtApiKey::class); } - - /** - * @param ?JwtApiKey $model - * @param-out ?JwtApiKey $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof JwtApiKey); - return $stmt; - } - - /** - * @param ?JwtApiKey $model - * @param-out ?JwtApiKey $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof JwtApiKey); - return $stmt; - } /** * @param JwtApiKey $model diff --git a/src/dba/models/LogEntryFactory.php b/src/dba/models/LogEntryFactory.php index cadc89dc9..2a420b9b3 100644 --- a/src/dba/models/LogEntryFactory.php +++ b/src/dba/models/LogEntryFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): LogEntry|array|null { function get($pk): ?LogEntry { return Util::cast(parent::get($pk), LogEntry::class); } - - /** - * @param ?LogEntry $model - * @param-out ?LogEntry $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof LogEntry); - return $stmt; - } - - /** - * @param ?LogEntry $model - * @param-out ?LogEntry $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof LogEntry); - return $stmt; - } /** * @param LogEntry $model diff --git a/src/dba/models/NotificationSettingFactory.php b/src/dba/models/NotificationSettingFactory.php index 2e9c6e191..1522f6153 100644 --- a/src/dba/models/NotificationSettingFactory.php +++ b/src/dba/models/NotificationSettingFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): NotificationSetting|array function get($pk): ?NotificationSetting { return Util::cast(parent::get($pk), NotificationSetting::class); } - - /** - * @param ?NotificationSetting $model - * @param-out ?NotificationSetting $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof NotificationSetting); - return $stmt; - } - - /** - * @param ?NotificationSetting $model - * @param-out ?NotificationSetting $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof NotificationSetting); - return $stmt; - } /** * @param NotificationSetting $model diff --git a/src/dba/models/PreprocessorFactory.php b/src/dba/models/PreprocessorFactory.php index 076ee08df..6b2ba64cb 100644 --- a/src/dba/models/PreprocessorFactory.php +++ b/src/dba/models/PreprocessorFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Preprocessor|array|null { function get($pk): ?Preprocessor { return Util::cast(parent::get($pk), Preprocessor::class); } - - /** - * @param ?Preprocessor $model - * @param-out ?Preprocessor $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Preprocessor); - return $stmt; - } - - /** - * @param ?Preprocessor $model - * @param-out ?Preprocessor $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Preprocessor); - return $stmt; - } /** * @param Preprocessor $model diff --git a/src/dba/models/PretaskFactory.php b/src/dba/models/PretaskFactory.php index 1410a3937..6640e6e9b 100644 --- a/src/dba/models/PretaskFactory.php +++ b/src/dba/models/PretaskFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Pretask|array|null { function get($pk): ?Pretask { return Util::cast(parent::get($pk), Pretask::class); } - - /** - * @param ?Pretask $model - * @param-out ?Pretask $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Pretask); - return $stmt; - } - - /** - * @param ?Pretask $model - * @param-out ?Pretask $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Pretask); - return $stmt; - } /** * @param Pretask $model diff --git a/src/dba/models/RegVoucherFactory.php b/src/dba/models/RegVoucherFactory.php index 92ee823e8..b2e2dc931 100644 --- a/src/dba/models/RegVoucherFactory.php +++ b/src/dba/models/RegVoucherFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): RegVoucher|array|null { function get($pk): ?RegVoucher { return Util::cast(parent::get($pk), RegVoucher::class); } - - /** - * @param ?RegVoucher $model - * @param-out ?RegVoucher $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof RegVoucher); - return $stmt; - } - - /** - * @param ?RegVoucher $model - * @param-out ?RegVoucher $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof RegVoucher); - return $stmt; - } /** * @param RegVoucher $model diff --git a/src/dba/models/RightGroupFactory.php b/src/dba/models/RightGroupFactory.php index bcc008f04..d2a1d70cd 100644 --- a/src/dba/models/RightGroupFactory.php +++ b/src/dba/models/RightGroupFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): RightGroup|array|null { function get($pk): ?RightGroup { return Util::cast(parent::get($pk), RightGroup::class); } - - /** - * @param ?RightGroup $model - * @param-out ?RightGroup $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof RightGroup); - return $stmt; - } - - /** - * @param ?RightGroup $model - * @param-out ?RightGroup $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof RightGroup); - return $stmt; - } /** * @param RightGroup $model diff --git a/src/dba/models/SessionFactory.php b/src/dba/models/SessionFactory.php index e633fcc52..4e3b0ec98 100644 --- a/src/dba/models/SessionFactory.php +++ b/src/dba/models/SessionFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Session|array|null { function get($pk): ?Session { return Util::cast(parent::get($pk), Session::class); } - - /** - * @param ?Session $model - * @param-out ?Session $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Session); - return $stmt; - } - - /** - * @param ?Session $model - * @param-out ?Session $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Session); - return $stmt; - } /** * @param Session $model diff --git a/src/dba/models/SpeedFactory.php b/src/dba/models/SpeedFactory.php index 4cd6520eb..c7e043b66 100644 --- a/src/dba/models/SpeedFactory.php +++ b/src/dba/models/SpeedFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Speed|array|null { function get($pk): ?Speed { return Util::cast(parent::get($pk), Speed::class); } - - /** - * @param ?Speed $model - * @param-out ?Speed $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Speed); - return $stmt; - } - - /** - * @param ?Speed $model - * @param-out ?Speed $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Speed); - return $stmt; - } /** * @param Speed $model diff --git a/src/dba/models/StoredValueFactory.php b/src/dba/models/StoredValueFactory.php index 49706603e..ef47b5048 100644 --- a/src/dba/models/StoredValueFactory.php +++ b/src/dba/models/StoredValueFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): StoredValue|array|null { function get($pk): ?StoredValue { return Util::cast(parent::get($pk), StoredValue::class); } - - /** - * @param ?StoredValue $model - * @param-out ?StoredValue $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof StoredValue); - return $stmt; - } - - /** - * @param ?StoredValue $model - * @param-out ?StoredValue $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof StoredValue); - return $stmt; - } /** * @param StoredValue $model diff --git a/src/dba/models/SupertaskFactory.php b/src/dba/models/SupertaskFactory.php index efaca1043..0a6cd1ba2 100644 --- a/src/dba/models/SupertaskFactory.php +++ b/src/dba/models/SupertaskFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Supertask|array|null { function get($pk): ?Supertask { return Util::cast(parent::get($pk), Supertask::class); } - - /** - * @param ?Supertask $model - * @param-out ?Supertask $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Supertask); - return $stmt; - } - - /** - * @param ?Supertask $model - * @param-out ?Supertask $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Supertask); - return $stmt; - } /** * @param Supertask $model diff --git a/src/dba/models/SupertaskPretaskFactory.php b/src/dba/models/SupertaskPretaskFactory.php index 0b64aca65..2387de0fb 100644 --- a/src/dba/models/SupertaskPretaskFactory.php +++ b/src/dba/models/SupertaskPretaskFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): SupertaskPretask|array|nu function get($pk): ?SupertaskPretask { return Util::cast(parent::get($pk), SupertaskPretask::class); } - - /** - * @param ?SupertaskPretask $model - * @param-out ?SupertaskPretask $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof SupertaskPretask); - return $stmt; - } - - /** - * @param ?SupertaskPretask $model - * @param-out ?SupertaskPretask $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof SupertaskPretask); - return $stmt; - } /** * @param SupertaskPretask $model diff --git a/src/dba/models/TaskDebugOutputFactory.php b/src/dba/models/TaskDebugOutputFactory.php index bd9524d8d..d9f74c867 100644 --- a/src/dba/models/TaskDebugOutputFactory.php +++ b/src/dba/models/TaskDebugOutputFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): TaskDebugOutput|array|nul function get($pk): ?TaskDebugOutput { return Util::cast(parent::get($pk), TaskDebugOutput::class); } - - /** - * @param ?TaskDebugOutput $model - * @param-out ?TaskDebugOutput $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof TaskDebugOutput); - return $stmt; - } - - /** - * @param ?TaskDebugOutput $model - * @param-out ?TaskDebugOutput $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof TaskDebugOutput); - return $stmt; - } /** * @param TaskDebugOutput $model diff --git a/src/dba/models/TaskFactory.php b/src/dba/models/TaskFactory.php index 93f7eb0ff..01f9809b8 100644 --- a/src/dba/models/TaskFactory.php +++ b/src/dba/models/TaskFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Task|array|null { function get($pk): ?Task { return Util::cast(parent::get($pk), Task::class); } - - /** - * @param ?Task $model - * @param-out ?Task $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Task); - return $stmt; - } - - /** - * @param ?Task $model - * @param-out ?Task $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Task); - return $stmt; - } /** * @param Task $model diff --git a/src/dba/models/TaskWrapperDisplayFactory.php b/src/dba/models/TaskWrapperDisplayFactory.php index 1809a080e..e6dc5cb61 100644 --- a/src/dba/models/TaskWrapperDisplayFactory.php +++ b/src/dba/models/TaskWrapperDisplayFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): TaskWrapperDisplay|array| function get($pk): ?TaskWrapperDisplay { return Util::cast(parent::get($pk), TaskWrapperDisplay::class); } - - /** - * @param ?TaskWrapperDisplay $model - * @param-out ?TaskWrapperDisplay $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof TaskWrapperDisplay); - return $stmt; - } - - /** - * @param ?TaskWrapperDisplay $model - * @param-out ?TaskWrapperDisplay $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof TaskWrapperDisplay); - return $stmt; - } /** * @param TaskWrapperDisplay $model diff --git a/src/dba/models/TaskWrapperFactory.php b/src/dba/models/TaskWrapperFactory.php index 3eb6e7dd8..3e6c68521 100644 --- a/src/dba/models/TaskWrapperFactory.php +++ b/src/dba/models/TaskWrapperFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): TaskWrapper|array|null { function get($pk): ?TaskWrapper { return Util::cast(parent::get($pk), TaskWrapper::class); } - - /** - * @param ?TaskWrapper $model - * @param-out ?TaskWrapper $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof TaskWrapper); - return $stmt; - } - - /** - * @param ?TaskWrapper $model - * @param-out ?TaskWrapper $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof TaskWrapper); - return $stmt; - } /** * @param TaskWrapper $model diff --git a/src/dba/models/UserFactory.php b/src/dba/models/UserFactory.php index 2c41033d3..cc634c416 100644 --- a/src/dba/models/UserFactory.php +++ b/src/dba/models/UserFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): User|array|null { function get($pk): ?User { return Util::cast(parent::get($pk), User::class); } - - /** - * @param ?User $model - * @param-out ?User $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof User); - return $stmt; - } - - /** - * @param ?User $model - * @param-out ?User $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof User); - return $stmt; - } /** * @param User $model diff --git a/src/dba/models/ZapFactory.php b/src/dba/models/ZapFactory.php index f7860e14f..0f16c6171 100644 --- a/src/dba/models/ZapFactory.php +++ b/src/dba/models/ZapFactory.php @@ -86,33 +86,6 @@ function filter(array $options, bool $single = false): Zap|array|null { function get($pk): ?Zap { return Util::cast(parent::get($pk), Zap::class); } - - /** - * @param ?Zap $model - * @param-out ?Zap $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof Zap); - return $stmt; - } - - /** - * @param ?Zap $model - * @param-out ?Zap $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof Zap); - return $stmt; - } /** * @param Zap $model diff --git a/src/dba/models/_sqlx_migrationsFactory.php b/src/dba/models/_sqlx_migrationsFactory.php index b7f330aad..18445551e 100644 --- a/src/dba/models/_sqlx_migrationsFactory.php +++ b/src/dba/models/_sqlx_migrationsFactory.php @@ -91,33 +91,6 @@ function filter(array $options, bool $single = false): _sqlx_migrations|array|nu function get($pk): ?_sqlx_migrations { return Util::cast(parent::get($pk), _sqlx_migrations::class); } - - /** - * @param ?_sqlx_migrations $model - * @param-out ?_sqlx_migrations $model - * @param array $arr - * @return ?PDOStatement - * @throws Exception - */ - public function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - $stmt = parent::mset($model, $arr); - assert($model instanceof _sqlx_migrations); - return $stmt; - } - - /** - * @param ?_sqlx_migrations $model - * @param-out ?_sqlx_migrations $model - * @param string $key key of the column to update - * @param $value - * @return ?PDOStatement - * @throws Exception - */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - $stmt = parent::set($model, $key, $value); - assert($model instanceof _sqlx_migrations); - return $stmt; - } /** * @param _sqlx_migrations $model From 9ef2d48751ada9d1d1d745d3af6c2daadde08e8c Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 10:08:46 +0200 Subject: [PATCH 09/19] test if mset wrapper is accepted --- src/dba/AbstractModelFactory.php | 17 ++++++----------- .../models/AbstractModelFactory.template.txt | 10 ++++++++++ src/dba/models/AccessGroupAgentFactory.php | 12 +++++++++++- src/dba/models/AccessGroupFactory.php | 10 ++++++++++ src/dba/models/AccessGroupUserFactory.php | 10 ++++++++++ src/dba/models/AgentBinaryFactory.php | 10 ++++++++++ src/dba/models/AgentErrorFactory.php | 10 ++++++++++ src/dba/models/AgentFactory.php | 10 ++++++++++ src/dba/models/AgentStatFactory.php | 10 ++++++++++ src/dba/models/AgentZapFactory.php | 10 ++++++++++ src/dba/models/ApiGroupFactory.php | 10 ++++++++++ src/dba/models/ApiKeyFactory.php | 10 ++++++++++ src/dba/models/AssignmentFactory.php | 10 ++++++++++ src/dba/models/ChunkFactory.php | 10 ++++++++++ src/dba/models/ConfigFactory.php | 10 ++++++++++ src/dba/models/ConfigSectionFactory.php | 10 ++++++++++ src/dba/models/CrackerBinaryFactory.php | 10 ++++++++++ src/dba/models/CrackerBinaryTypeFactory.php | 10 ++++++++++ src/dba/models/FileDeleteFactory.php | 10 ++++++++++ src/dba/models/FileDownloadFactory.php | 10 ++++++++++ src/dba/models/FileFactory.php | 10 ++++++++++ src/dba/models/FilePretaskFactory.php | 10 ++++++++++ src/dba/models/FileTaskFactory.php | 10 ++++++++++ src/dba/models/HashBinaryFactory.php | 10 ++++++++++ src/dba/models/HashFactory.php | 10 ++++++++++ src/dba/models/HashTypeFactory.php | 10 ++++++++++ src/dba/models/HashlistFactory.php | 10 ++++++++++ src/dba/models/HashlistHashlistFactory.php | 10 ++++++++++ src/dba/models/HealthCheckAgentFactory.php | 10 ++++++++++ src/dba/models/HealthCheckFactory.php | 10 ++++++++++ src/dba/models/JwtApiKeyFactory.php | 10 ++++++++++ src/dba/models/LogEntryFactory.php | 10 ++++++++++ src/dba/models/NotificationSettingFactory.php | 10 ++++++++++ src/dba/models/PreprocessorFactory.php | 10 ++++++++++ src/dba/models/PretaskFactory.php | 10 ++++++++++ src/dba/models/RegVoucherFactory.php | 10 ++++++++++ src/dba/models/RightGroupFactory.php | 10 ++++++++++ src/dba/models/SessionFactory.php | 10 ++++++++++ src/dba/models/SpeedFactory.php | 10 ++++++++++ src/dba/models/StoredValueFactory.php | 10 ++++++++++ src/dba/models/SupertaskFactory.php | 10 ++++++++++ src/dba/models/SupertaskPretaskFactory.php | 10 ++++++++++ src/dba/models/TaskDebugOutputFactory.php | 10 ++++++++++ src/dba/models/TaskFactory.php | 10 ++++++++++ src/dba/models/TaskWrapperDisplayFactory.php | 10 ++++++++++ src/dba/models/TaskWrapperFactory.php | 10 ++++++++++ src/dba/models/UserFactory.php | 10 ++++++++++ src/dba/models/ZapFactory.php | 10 ++++++++++ src/dba/models/_sqlx_migrationsFactory.php | 10 ++++++++++ 49 files changed, 487 insertions(+), 12 deletions(-) diff --git a/src/dba/AbstractModelFactory.php b/src/dba/AbstractModelFactory.php index 9c0de7616..266f4e215 100755 --- a/src/dba/AbstractModelFactory.php +++ b/src/dba/AbstractModelFactory.php @@ -291,16 +291,12 @@ public function update(AbstractModel $model): PDOStatement { * Atomically sets the given keys of this model to the given values without setting all other values (like ->update() does) * * Returns the return of PDO::execute() or null if nothing was executed - * @param ?AbstractModel $model AbstractModel primary key of model + * @param AbstractModel $model AbstractModel primary key of model * @param array $arr key-value associations for update - * @return ?PDOStatement + * @return AbstractModel updated model * @throws Exception */ - protected function mset(?AbstractModel &$model, array $arr): ?PDOStatement { - if ($model === null) { - return null; - } - + public function mset(AbstractModel $model, array $arr): AbstractModel { $query = "UPDATE " . $this->getMappedModelTable() . " SET "; $elements = []; $values = []; @@ -316,10 +312,9 @@ protected function mset(?AbstractModel &$model, array $arr): ?PDOStatement { $stmt = $this->getDB()->prepare($query); $stmt->execute($values); - $refreshed = $this->get($model->getPrimaryKeyValue()); - assert($refreshed instanceof AbstractModel); - $model = $refreshed; - return $stmt; + $model = $this->get($model->getPrimaryKeyValue()); + assert($model !== null); // assert as on this update we should not get null back (unless race-condition) + return $model; } /** diff --git a/src/dba/models/AbstractModelFactory.template.txt b/src/dba/models/AbstractModelFactory.template.txt index 72f2f2d6e..65c4a8d30 100644 --- a/src/dba/models/AbstractModelFactory.template.txt +++ b/src/dba/models/AbstractModelFactory.template.txt @@ -95,4 +95,14 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { function save($model): __MODEL_NAME__ { return Util::cast(parent::save($model), __MODEL_NAME__::class); } + + /** + * @param __MODEL_NAME__ $model + * @param array $arr key-value associations for update + * @return __MODEL_NAME__ + * @throws Exception + */ + function mset($model, array $arr): __MODEL_NAME__ { + return Util::cast(parent::mset($model, $arr), __MODEL_NAME__::class); + } } diff --git a/src/dba/models/AccessGroupAgentFactory.php b/src/dba/models/AccessGroupAgentFactory.php index 2703a0170..319406bd3 100644 --- a/src/dba/models/AccessGroupAgentFactory.php +++ b/src/dba/models/AccessGroupAgentFactory.php @@ -16,7 +16,7 @@ function getModelName(): string { function getModelTable(): string { return "AccessGroupAgent"; } - + function isMapping(): bool { return False; } @@ -95,4 +95,14 @@ function get($pk): ?AccessGroupAgent { function save($model): AccessGroupAgent { return Util::cast(parent::save($model), AccessGroupAgent::class); } + + /** + * @param AccessGroupAgent $model + * @param array $arr key-value associations for update + * @return AccessGroupAgent + * @throws Exception + */ + function mset($model, array $arr): AccessGroupAgent { + return Util::cast(parent::mset($model, $arr), AccessGroupAgent::class); + } } diff --git a/src/dba/models/AccessGroupFactory.php b/src/dba/models/AccessGroupFactory.php index f496735d1..23ba78718 100644 --- a/src/dba/models/AccessGroupFactory.php +++ b/src/dba/models/AccessGroupFactory.php @@ -95,4 +95,14 @@ function get($pk): ?AccessGroup { function save($model): AccessGroup { return Util::cast(parent::save($model), AccessGroup::class); } + + /** + * @param AccessGroup $model + * @param array $arr key-value associations for update + * @return AccessGroup + * @throws Exception + */ + function mset($model, array $arr): AccessGroup { + return Util::cast(parent::mset($model, $arr), AccessGroup::class); + } } diff --git a/src/dba/models/AccessGroupUserFactory.php b/src/dba/models/AccessGroupUserFactory.php index 439252994..2dd8c15f9 100644 --- a/src/dba/models/AccessGroupUserFactory.php +++ b/src/dba/models/AccessGroupUserFactory.php @@ -95,4 +95,14 @@ function get($pk): ?AccessGroupUser { function save($model): AccessGroupUser { return Util::cast(parent::save($model), AccessGroupUser::class); } + + /** + * @param AccessGroupUser $model + * @param array $arr key-value associations for update + * @return AccessGroupUser + * @throws Exception + */ + function mset($model, array $arr): AccessGroupUser { + return Util::cast(parent::mset($model, $arr), AccessGroupUser::class); + } } diff --git a/src/dba/models/AgentBinaryFactory.php b/src/dba/models/AgentBinaryFactory.php index aecc508b3..a8f978723 100644 --- a/src/dba/models/AgentBinaryFactory.php +++ b/src/dba/models/AgentBinaryFactory.php @@ -95,4 +95,14 @@ function get($pk): ?AgentBinary { function save($model): AgentBinary { return Util::cast(parent::save($model), AgentBinary::class); } + + /** + * @param AgentBinary $model + * @param array $arr key-value associations for update + * @return AgentBinary + * @throws Exception + */ + function mset($model, array $arr): AgentBinary { + return Util::cast(parent::mset($model, $arr), AgentBinary::class); + } } diff --git a/src/dba/models/AgentErrorFactory.php b/src/dba/models/AgentErrorFactory.php index 4433b3730..ac76e3622 100644 --- a/src/dba/models/AgentErrorFactory.php +++ b/src/dba/models/AgentErrorFactory.php @@ -95,4 +95,14 @@ function get($pk): ?AgentError { function save($model): AgentError { return Util::cast(parent::save($model), AgentError::class); } + + /** + * @param AgentError $model + * @param array $arr key-value associations for update + * @return AgentError + * @throws Exception + */ + function mset($model, array $arr): AgentError { + return Util::cast(parent::mset($model, $arr), AgentError::class); + } } diff --git a/src/dba/models/AgentFactory.php b/src/dba/models/AgentFactory.php index 7dd344310..2a1faef9b 100644 --- a/src/dba/models/AgentFactory.php +++ b/src/dba/models/AgentFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Agent { function save($model): Agent { return Util::cast(parent::save($model), Agent::class); } + + /** + * @param Agent $model + * @param array $arr key-value associations for update + * @return Agent + * @throws Exception + */ + function mset($model, array $arr): Agent { + return Util::cast(parent::mset($model, $arr), Agent::class); + } } diff --git a/src/dba/models/AgentStatFactory.php b/src/dba/models/AgentStatFactory.php index 51c0be8f4..de6481edd 100644 --- a/src/dba/models/AgentStatFactory.php +++ b/src/dba/models/AgentStatFactory.php @@ -95,4 +95,14 @@ function get($pk): ?AgentStat { function save($model): AgentStat { return Util::cast(parent::save($model), AgentStat::class); } + + /** + * @param AgentStat $model + * @param array $arr key-value associations for update + * @return AgentStat + * @throws Exception + */ + function mset($model, array $arr): AgentStat { + return Util::cast(parent::mset($model, $arr), AgentStat::class); + } } diff --git a/src/dba/models/AgentZapFactory.php b/src/dba/models/AgentZapFactory.php index 9f1fe9368..4b80a00aa 100644 --- a/src/dba/models/AgentZapFactory.php +++ b/src/dba/models/AgentZapFactory.php @@ -95,4 +95,14 @@ function get($pk): ?AgentZap { function save($model): AgentZap { return Util::cast(parent::save($model), AgentZap::class); } + + /** + * @param AgentZap $model + * @param array $arr key-value associations for update + * @return AgentZap + * @throws Exception + */ + function mset($model, array $arr): AgentZap { + return Util::cast(parent::mset($model, $arr), AgentZap::class); + } } diff --git a/src/dba/models/ApiGroupFactory.php b/src/dba/models/ApiGroupFactory.php index ee8bfdc5f..622f2949f 100644 --- a/src/dba/models/ApiGroupFactory.php +++ b/src/dba/models/ApiGroupFactory.php @@ -95,4 +95,14 @@ function get($pk): ?ApiGroup { function save($model): ApiGroup { return Util::cast(parent::save($model), ApiGroup::class); } + + /** + * @param ApiGroup $model + * @param array $arr key-value associations for update + * @return ApiGroup + * @throws Exception + */ + function mset($model, array $arr): ApiGroup { + return Util::cast(parent::mset($model, $arr), ApiGroup::class); + } } diff --git a/src/dba/models/ApiKeyFactory.php b/src/dba/models/ApiKeyFactory.php index 7b9daf1a5..ca3e6e731 100644 --- a/src/dba/models/ApiKeyFactory.php +++ b/src/dba/models/ApiKeyFactory.php @@ -95,4 +95,14 @@ function get($pk): ?ApiKey { function save($model): ApiKey { return Util::cast(parent::save($model), ApiKey::class); } + + /** + * @param ApiKey $model + * @param array $arr key-value associations for update + * @return ApiKey + * @throws Exception + */ + function mset($model, array $arr): ApiKey { + return Util::cast(parent::mset($model, $arr), ApiKey::class); + } } diff --git a/src/dba/models/AssignmentFactory.php b/src/dba/models/AssignmentFactory.php index 71f9c54f1..072ea9208 100644 --- a/src/dba/models/AssignmentFactory.php +++ b/src/dba/models/AssignmentFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Assignment { function save($model): Assignment { return Util::cast(parent::save($model), Assignment::class); } + + /** + * @param Assignment $model + * @param array $arr key-value associations for update + * @return Assignment + * @throws Exception + */ + function mset($model, array $arr): Assignment { + return Util::cast(parent::mset($model, $arr), Assignment::class); + } } diff --git a/src/dba/models/ChunkFactory.php b/src/dba/models/ChunkFactory.php index 3349c5811..f600fee1c 100644 --- a/src/dba/models/ChunkFactory.php +++ b/src/dba/models/ChunkFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Chunk { function save($model): Chunk { return Util::cast(parent::save($model), Chunk::class); } + + /** + * @param Chunk $model + * @param array $arr key-value associations for update + * @return Chunk + * @throws Exception + */ + function mset($model, array $arr): Chunk { + return Util::cast(parent::mset($model, $arr), Chunk::class); + } } diff --git a/src/dba/models/ConfigFactory.php b/src/dba/models/ConfigFactory.php index 3b06d61d1..b3f54f18e 100644 --- a/src/dba/models/ConfigFactory.php +++ b/src/dba/models/ConfigFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Config { function save($model): Config { return Util::cast(parent::save($model), Config::class); } + + /** + * @param Config $model + * @param array $arr key-value associations for update + * @return Config + * @throws Exception + */ + function mset($model, array $arr): Config { + return Util::cast(parent::mset($model, $arr), Config::class); + } } diff --git a/src/dba/models/ConfigSectionFactory.php b/src/dba/models/ConfigSectionFactory.php index 683a3778d..7d3910262 100644 --- a/src/dba/models/ConfigSectionFactory.php +++ b/src/dba/models/ConfigSectionFactory.php @@ -95,4 +95,14 @@ function get($pk): ?ConfigSection { function save($model): ConfigSection { return Util::cast(parent::save($model), ConfigSection::class); } + + /** + * @param ConfigSection $model + * @param array $arr key-value associations for update + * @return ConfigSection + * @throws Exception + */ + function mset($model, array $arr): ConfigSection { + return Util::cast(parent::mset($model, $arr), ConfigSection::class); + } } diff --git a/src/dba/models/CrackerBinaryFactory.php b/src/dba/models/CrackerBinaryFactory.php index 1158e2ef4..326b78184 100644 --- a/src/dba/models/CrackerBinaryFactory.php +++ b/src/dba/models/CrackerBinaryFactory.php @@ -95,4 +95,14 @@ function get($pk): ?CrackerBinary { function save($model): CrackerBinary { return Util::cast(parent::save($model), CrackerBinary::class); } + + /** + * @param CrackerBinary $model + * @param array $arr key-value associations for update + * @return CrackerBinary + * @throws Exception + */ + function mset($model, array $arr): CrackerBinary { + return Util::cast(parent::mset($model, $arr), CrackerBinary::class); + } } diff --git a/src/dba/models/CrackerBinaryTypeFactory.php b/src/dba/models/CrackerBinaryTypeFactory.php index 9b8544b40..f9a6f3da9 100644 --- a/src/dba/models/CrackerBinaryTypeFactory.php +++ b/src/dba/models/CrackerBinaryTypeFactory.php @@ -95,4 +95,14 @@ function get($pk): ?CrackerBinaryType { function save($model): CrackerBinaryType { return Util::cast(parent::save($model), CrackerBinaryType::class); } + + /** + * @param CrackerBinaryType $model + * @param array $arr key-value associations for update + * @return CrackerBinaryType + * @throws Exception + */ + function mset($model, array $arr): CrackerBinaryType { + return Util::cast(parent::mset($model, $arr), CrackerBinaryType::class); + } } diff --git a/src/dba/models/FileDeleteFactory.php b/src/dba/models/FileDeleteFactory.php index 188b145e1..4fb08d2b5 100644 --- a/src/dba/models/FileDeleteFactory.php +++ b/src/dba/models/FileDeleteFactory.php @@ -95,4 +95,14 @@ function get($pk): ?FileDelete { function save($model): FileDelete { return Util::cast(parent::save($model), FileDelete::class); } + + /** + * @param FileDelete $model + * @param array $arr key-value associations for update + * @return FileDelete + * @throws Exception + */ + function mset($model, array $arr): FileDelete { + return Util::cast(parent::mset($model, $arr), FileDelete::class); + } } diff --git a/src/dba/models/FileDownloadFactory.php b/src/dba/models/FileDownloadFactory.php index 47ce0c027..238ae8b5e 100644 --- a/src/dba/models/FileDownloadFactory.php +++ b/src/dba/models/FileDownloadFactory.php @@ -95,4 +95,14 @@ function get($pk): ?FileDownload { function save($model): FileDownload { return Util::cast(parent::save($model), FileDownload::class); } + + /** + * @param FileDownload $model + * @param array $arr key-value associations for update + * @return FileDownload + * @throws Exception + */ + function mset($model, array $arr): FileDownload { + return Util::cast(parent::mset($model, $arr), FileDownload::class); + } } diff --git a/src/dba/models/FileFactory.php b/src/dba/models/FileFactory.php index 237ee7bd3..e4812638f 100644 --- a/src/dba/models/FileFactory.php +++ b/src/dba/models/FileFactory.php @@ -95,4 +95,14 @@ function get($pk): ?File { function save($model): File { return Util::cast(parent::save($model), File::class); } + + /** + * @param File $model + * @param array $arr key-value associations for update + * @return File + * @throws Exception + */ + function mset($model, array $arr): File { + return Util::cast(parent::mset($model, $arr), File::class); + } } diff --git a/src/dba/models/FilePretaskFactory.php b/src/dba/models/FilePretaskFactory.php index ebbe68a99..a244e18e1 100644 --- a/src/dba/models/FilePretaskFactory.php +++ b/src/dba/models/FilePretaskFactory.php @@ -95,4 +95,14 @@ function get($pk): ?FilePretask { function save($model): FilePretask { return Util::cast(parent::save($model), FilePretask::class); } + + /** + * @param FilePretask $model + * @param array $arr key-value associations for update + * @return FilePretask + * @throws Exception + */ + function mset($model, array $arr): FilePretask { + return Util::cast(parent::mset($model, $arr), FilePretask::class); + } } diff --git a/src/dba/models/FileTaskFactory.php b/src/dba/models/FileTaskFactory.php index c6763f017..390acc2dd 100644 --- a/src/dba/models/FileTaskFactory.php +++ b/src/dba/models/FileTaskFactory.php @@ -95,4 +95,14 @@ function get($pk): ?FileTask { function save($model): FileTask { return Util::cast(parent::save($model), FileTask::class); } + + /** + * @param FileTask $model + * @param array $arr key-value associations for update + * @return FileTask + * @throws Exception + */ + function mset($model, array $arr): FileTask { + return Util::cast(parent::mset($model, $arr), FileTask::class); + } } diff --git a/src/dba/models/HashBinaryFactory.php b/src/dba/models/HashBinaryFactory.php index d2e6a5a56..534f3ff39 100644 --- a/src/dba/models/HashBinaryFactory.php +++ b/src/dba/models/HashBinaryFactory.php @@ -95,4 +95,14 @@ function get($pk): ?HashBinary { function save($model): HashBinary { return Util::cast(parent::save($model), HashBinary::class); } + + /** + * @param HashBinary $model + * @param array $arr key-value associations for update + * @return HashBinary + * @throws Exception + */ + function mset($model, array $arr): HashBinary { + return Util::cast(parent::mset($model, $arr), HashBinary::class); + } } diff --git a/src/dba/models/HashFactory.php b/src/dba/models/HashFactory.php index e53990205..560d84a11 100644 --- a/src/dba/models/HashFactory.php +++ b/src/dba/models/HashFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Hash { function save($model): Hash { return Util::cast(parent::save($model), Hash::class); } + + /** + * @param Hash $model + * @param array $arr key-value associations for update + * @return Hash + * @throws Exception + */ + function mset($model, array $arr): Hash { + return Util::cast(parent::mset($model, $arr), Hash::class); + } } diff --git a/src/dba/models/HashTypeFactory.php b/src/dba/models/HashTypeFactory.php index 1048e747c..c5951ca46 100644 --- a/src/dba/models/HashTypeFactory.php +++ b/src/dba/models/HashTypeFactory.php @@ -95,4 +95,14 @@ function get($pk): ?HashType { function save($model): HashType { return Util::cast(parent::save($model), HashType::class); } + + /** + * @param HashType $model + * @param array $arr key-value associations for update + * @return HashType + * @throws Exception + */ + function mset($model, array $arr): HashType { + return Util::cast(parent::mset($model, $arr), HashType::class); + } } diff --git a/src/dba/models/HashlistFactory.php b/src/dba/models/HashlistFactory.php index 8965f4883..ac997ecc1 100644 --- a/src/dba/models/HashlistFactory.php +++ b/src/dba/models/HashlistFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Hashlist { function save($model): Hashlist { return Util::cast(parent::save($model), Hashlist::class); } + + /** + * @param Hashlist $model + * @param array $arr key-value associations for update + * @return Hashlist + * @throws Exception + */ + function mset($model, array $arr): Hashlist { + return Util::cast(parent::mset($model, $arr), Hashlist::class); + } } diff --git a/src/dba/models/HashlistHashlistFactory.php b/src/dba/models/HashlistHashlistFactory.php index e97bc0770..872a4a879 100644 --- a/src/dba/models/HashlistHashlistFactory.php +++ b/src/dba/models/HashlistHashlistFactory.php @@ -95,4 +95,14 @@ function get($pk): ?HashlistHashlist { function save($model): HashlistHashlist { return Util::cast(parent::save($model), HashlistHashlist::class); } + + /** + * @param HashlistHashlist $model + * @param array $arr key-value associations for update + * @return HashlistHashlist + * @throws Exception + */ + function mset($model, array $arr): HashlistHashlist { + return Util::cast(parent::mset($model, $arr), HashlistHashlist::class); + } } diff --git a/src/dba/models/HealthCheckAgentFactory.php b/src/dba/models/HealthCheckAgentFactory.php index bbab64eea..e4873175a 100644 --- a/src/dba/models/HealthCheckAgentFactory.php +++ b/src/dba/models/HealthCheckAgentFactory.php @@ -96,4 +96,14 @@ function get($pk): ?HealthCheckAgent { function save($model): HealthCheckAgent { return Util::cast(parent::save($model), HealthCheckAgent::class); } + + /** + * @param HealthCheckAgent $model + * @param array $arr key-value associations for update + * @return HealthCheckAgent + * @throws Exception + */ + function mset($model, array $arr): HealthCheckAgent { + return Util::cast(parent::mset($model, $arr), HealthCheckAgent::class); + } } diff --git a/src/dba/models/HealthCheckFactory.php b/src/dba/models/HealthCheckFactory.php index 102a4dea9..b3e912e6b 100644 --- a/src/dba/models/HealthCheckFactory.php +++ b/src/dba/models/HealthCheckFactory.php @@ -95,4 +95,14 @@ function get($pk): ?HealthCheck { function save($model): HealthCheck { return Util::cast(parent::save($model), HealthCheck::class); } + + /** + * @param HealthCheck $model + * @param array $arr key-value associations for update + * @return HealthCheck + * @throws Exception + */ + function mset($model, array $arr): HealthCheck { + return Util::cast(parent::mset($model, $arr), HealthCheck::class); + } } diff --git a/src/dba/models/JwtApiKeyFactory.php b/src/dba/models/JwtApiKeyFactory.php index 1023e376e..0f2c3ebcd 100644 --- a/src/dba/models/JwtApiKeyFactory.php +++ b/src/dba/models/JwtApiKeyFactory.php @@ -95,4 +95,14 @@ function get($pk): ?JwtApiKey { function save($model): JwtApiKey { return Util::cast(parent::save($model), JwtApiKey::class); } + + /** + * @param JwtApiKey $model + * @param array $arr key-value associations for update + * @return JwtApiKey + * @throws Exception + */ + function mset($model, array $arr): JwtApiKey { + return Util::cast(parent::mset($model, $arr), JwtApiKey::class); + } } diff --git a/src/dba/models/LogEntryFactory.php b/src/dba/models/LogEntryFactory.php index 2a420b9b3..76a17224a 100644 --- a/src/dba/models/LogEntryFactory.php +++ b/src/dba/models/LogEntryFactory.php @@ -95,4 +95,14 @@ function get($pk): ?LogEntry { function save($model): LogEntry { return Util::cast(parent::save($model), LogEntry::class); } + + /** + * @param LogEntry $model + * @param array $arr key-value associations for update + * @return LogEntry + * @throws Exception + */ + function mset($model, array $arr): LogEntry { + return Util::cast(parent::mset($model, $arr), LogEntry::class); + } } diff --git a/src/dba/models/NotificationSettingFactory.php b/src/dba/models/NotificationSettingFactory.php index 1522f6153..be5c2dd96 100644 --- a/src/dba/models/NotificationSettingFactory.php +++ b/src/dba/models/NotificationSettingFactory.php @@ -95,4 +95,14 @@ function get($pk): ?NotificationSetting { function save($model): NotificationSetting { return Util::cast(parent::save($model), NotificationSetting::class); } + + /** + * @param NotificationSetting $model + * @param array $arr key-value associations for update + * @return NotificationSetting + * @throws Exception + */ + function mset($model, array $arr): NotificationSetting { + return Util::cast(parent::mset($model, $arr), NotificationSetting::class); + } } diff --git a/src/dba/models/PreprocessorFactory.php b/src/dba/models/PreprocessorFactory.php index 6b2ba64cb..b64de2e0b 100644 --- a/src/dba/models/PreprocessorFactory.php +++ b/src/dba/models/PreprocessorFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Preprocessor { function save($model): Preprocessor { return Util::cast(parent::save($model), Preprocessor::class); } + + /** + * @param Preprocessor $model + * @param array $arr key-value associations for update + * @return Preprocessor + * @throws Exception + */ + function mset($model, array $arr): Preprocessor { + return Util::cast(parent::mset($model, $arr), Preprocessor::class); + } } diff --git a/src/dba/models/PretaskFactory.php b/src/dba/models/PretaskFactory.php index 6640e6e9b..3999d153a 100644 --- a/src/dba/models/PretaskFactory.php +++ b/src/dba/models/PretaskFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Pretask { function save($model): Pretask { return Util::cast(parent::save($model), Pretask::class); } + + /** + * @param Pretask $model + * @param array $arr key-value associations for update + * @return Pretask + * @throws Exception + */ + function mset($model, array $arr): Pretask { + return Util::cast(parent::mset($model, $arr), Pretask::class); + } } diff --git a/src/dba/models/RegVoucherFactory.php b/src/dba/models/RegVoucherFactory.php index b2e2dc931..42082740c 100644 --- a/src/dba/models/RegVoucherFactory.php +++ b/src/dba/models/RegVoucherFactory.php @@ -95,4 +95,14 @@ function get($pk): ?RegVoucher { function save($model): RegVoucher { return Util::cast(parent::save($model), RegVoucher::class); } + + /** + * @param RegVoucher $model + * @param array $arr key-value associations for update + * @return RegVoucher + * @throws Exception + */ + function mset($model, array $arr): RegVoucher { + return Util::cast(parent::mset($model, $arr), RegVoucher::class); + } } diff --git a/src/dba/models/RightGroupFactory.php b/src/dba/models/RightGroupFactory.php index d2a1d70cd..32f95715e 100644 --- a/src/dba/models/RightGroupFactory.php +++ b/src/dba/models/RightGroupFactory.php @@ -95,4 +95,14 @@ function get($pk): ?RightGroup { function save($model): RightGroup { return Util::cast(parent::save($model), RightGroup::class); } + + /** + * @param RightGroup $model + * @param array $arr key-value associations for update + * @return RightGroup + * @throws Exception + */ + function mset($model, array $arr): RightGroup { + return Util::cast(parent::mset($model, $arr), RightGroup::class); + } } diff --git a/src/dba/models/SessionFactory.php b/src/dba/models/SessionFactory.php index 4e3b0ec98..2a17fd628 100644 --- a/src/dba/models/SessionFactory.php +++ b/src/dba/models/SessionFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Session { function save($model): Session { return Util::cast(parent::save($model), Session::class); } + + /** + * @param Session $model + * @param array $arr key-value associations for update + * @return Session + * @throws Exception + */ + function mset($model, array $arr): Session { + return Util::cast(parent::mset($model, $arr), Session::class); + } } diff --git a/src/dba/models/SpeedFactory.php b/src/dba/models/SpeedFactory.php index c7e043b66..4d80d3397 100644 --- a/src/dba/models/SpeedFactory.php +++ b/src/dba/models/SpeedFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Speed { function save($model): Speed { return Util::cast(parent::save($model), Speed::class); } + + /** + * @param Speed $model + * @param array $arr key-value associations for update + * @return Speed + * @throws Exception + */ + function mset($model, array $arr): Speed { + return Util::cast(parent::mset($model, $arr), Speed::class); + } } diff --git a/src/dba/models/StoredValueFactory.php b/src/dba/models/StoredValueFactory.php index ef47b5048..28d896425 100644 --- a/src/dba/models/StoredValueFactory.php +++ b/src/dba/models/StoredValueFactory.php @@ -95,4 +95,14 @@ function get($pk): ?StoredValue { function save($model): StoredValue { return Util::cast(parent::save($model), StoredValue::class); } + + /** + * @param StoredValue $model + * @param array $arr key-value associations for update + * @return StoredValue + * @throws Exception + */ + function mset($model, array $arr): StoredValue { + return Util::cast(parent::mset($model, $arr), StoredValue::class); + } } diff --git a/src/dba/models/SupertaskFactory.php b/src/dba/models/SupertaskFactory.php index 0a6cd1ba2..972276f0a 100644 --- a/src/dba/models/SupertaskFactory.php +++ b/src/dba/models/SupertaskFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Supertask { function save($model): Supertask { return Util::cast(parent::save($model), Supertask::class); } + + /** + * @param Supertask $model + * @param array $arr key-value associations for update + * @return Supertask + * @throws Exception + */ + function mset($model, array $arr): Supertask { + return Util::cast(parent::mset($model, $arr), Supertask::class); + } } diff --git a/src/dba/models/SupertaskPretaskFactory.php b/src/dba/models/SupertaskPretaskFactory.php index 2387de0fb..9d7c9320e 100644 --- a/src/dba/models/SupertaskPretaskFactory.php +++ b/src/dba/models/SupertaskPretaskFactory.php @@ -95,4 +95,14 @@ function get($pk): ?SupertaskPretask { function save($model): SupertaskPretask { return Util::cast(parent::save($model), SupertaskPretask::class); } + + /** + * @param SupertaskPretask $model + * @param array $arr key-value associations for update + * @return SupertaskPretask + * @throws Exception + */ + function mset($model, array $arr): SupertaskPretask { + return Util::cast(parent::mset($model, $arr), SupertaskPretask::class); + } } diff --git a/src/dba/models/TaskDebugOutputFactory.php b/src/dba/models/TaskDebugOutputFactory.php index d9f74c867..f9b2f377d 100644 --- a/src/dba/models/TaskDebugOutputFactory.php +++ b/src/dba/models/TaskDebugOutputFactory.php @@ -95,4 +95,14 @@ function get($pk): ?TaskDebugOutput { function save($model): TaskDebugOutput { return Util::cast(parent::save($model), TaskDebugOutput::class); } + + /** + * @param TaskDebugOutput $model + * @param array $arr key-value associations for update + * @return TaskDebugOutput + * @throws Exception + */ + function mset($model, array $arr): TaskDebugOutput { + return Util::cast(parent::mset($model, $arr), TaskDebugOutput::class); + } } diff --git a/src/dba/models/TaskFactory.php b/src/dba/models/TaskFactory.php index 01f9809b8..3a21f06d5 100644 --- a/src/dba/models/TaskFactory.php +++ b/src/dba/models/TaskFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Task { function save($model): Task { return Util::cast(parent::save($model), Task::class); } + + /** + * @param Task $model + * @param array $arr key-value associations for update + * @return Task + * @throws Exception + */ + function mset($model, array $arr): Task { + return Util::cast(parent::mset($model, $arr), Task::class); + } } diff --git a/src/dba/models/TaskWrapperDisplayFactory.php b/src/dba/models/TaskWrapperDisplayFactory.php index e6dc5cb61..ae5d8ee9c 100644 --- a/src/dba/models/TaskWrapperDisplayFactory.php +++ b/src/dba/models/TaskWrapperDisplayFactory.php @@ -95,4 +95,14 @@ function get($pk): ?TaskWrapperDisplay { function save($model): TaskWrapperDisplay { return Util::cast(parent::save($model), TaskWrapperDisplay::class); } + + /** + * @param TaskWrapperDisplay $model + * @param array $arr key-value associations for update + * @return TaskWrapperDisplay + * @throws Exception + */ + function mset($model, array $arr): TaskWrapperDisplay { + return Util::cast(parent::mset($model, $arr), TaskWrapperDisplay::class); + } } diff --git a/src/dba/models/TaskWrapperFactory.php b/src/dba/models/TaskWrapperFactory.php index 3e6c68521..1144551b8 100644 --- a/src/dba/models/TaskWrapperFactory.php +++ b/src/dba/models/TaskWrapperFactory.php @@ -95,4 +95,14 @@ function get($pk): ?TaskWrapper { function save($model): TaskWrapper { return Util::cast(parent::save($model), TaskWrapper::class); } + + /** + * @param TaskWrapper $model + * @param array $arr key-value associations for update + * @return TaskWrapper + * @throws Exception + */ + function mset($model, array $arr): TaskWrapper { + return Util::cast(parent::mset($model, $arr), TaskWrapper::class); + } } diff --git a/src/dba/models/UserFactory.php b/src/dba/models/UserFactory.php index cc634c416..6d8ee3298 100644 --- a/src/dba/models/UserFactory.php +++ b/src/dba/models/UserFactory.php @@ -95,4 +95,14 @@ function get($pk): ?User { function save($model): User { return Util::cast(parent::save($model), User::class); } + + /** + * @param User $model + * @param array $arr key-value associations for update + * @return User + * @throws Exception + */ + function mset($model, array $arr): User { + return Util::cast(parent::mset($model, $arr), User::class); + } } diff --git a/src/dba/models/ZapFactory.php b/src/dba/models/ZapFactory.php index 0f16c6171..e2e80ce33 100644 --- a/src/dba/models/ZapFactory.php +++ b/src/dba/models/ZapFactory.php @@ -95,4 +95,14 @@ function get($pk): ?Zap { function save($model): Zap { return Util::cast(parent::save($model), Zap::class); } + + /** + * @param Zap $model + * @param array $arr key-value associations for update + * @return Zap + * @throws Exception + */ + function mset($model, array $arr): Zap { + return Util::cast(parent::mset($model, $arr), Zap::class); + } } diff --git a/src/dba/models/_sqlx_migrationsFactory.php b/src/dba/models/_sqlx_migrationsFactory.php index 18445551e..9e5541c68 100644 --- a/src/dba/models/_sqlx_migrationsFactory.php +++ b/src/dba/models/_sqlx_migrationsFactory.php @@ -100,4 +100,14 @@ function get($pk): ?_sqlx_migrations { function save($model): _sqlx_migrations { return Util::cast(parent::save($model), _sqlx_migrations::class); } + + /** + * @param _sqlx_migrations $model + * @param array $arr key-value associations for update + * @return _sqlx_migrations + * @throws Exception + */ + function mset($model, array $arr): _sqlx_migrations { + return Util::cast(parent::mset($model, $arr), _sqlx_migrations::class); + } } From f3eef9fbf8459142f135c60d6179360decaf7fc8 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 10:15:41 +0200 Subject: [PATCH 10/19] same for set now --- src/dba/AbstractModelFactory.php | 17 ++++++----------- .../models/AbstractModelFactory.template.txt | 11 +++++++++++ src/dba/models/AccessGroupAgentFactory.php | 15 +++++++++++++-- src/dba/models/AccessGroupFactory.php | 11 +++++++++++ src/dba/models/AccessGroupUserFactory.php | 11 +++++++++++ src/dba/models/AgentBinaryFactory.php | 11 +++++++++++ src/dba/models/AgentErrorFactory.php | 11 +++++++++++ src/dba/models/AgentFactory.php | 11 +++++++++++ src/dba/models/AgentStatFactory.php | 11 +++++++++++ src/dba/models/AgentZapFactory.php | 11 +++++++++++ src/dba/models/ApiGroupFactory.php | 11 +++++++++++ src/dba/models/ApiKeyFactory.php | 11 +++++++++++ src/dba/models/AssignmentFactory.php | 11 +++++++++++ src/dba/models/ChunkFactory.php | 11 +++++++++++ src/dba/models/ConfigFactory.php | 11 +++++++++++ src/dba/models/ConfigSectionFactory.php | 11 +++++++++++ src/dba/models/CrackerBinaryFactory.php | 11 +++++++++++ src/dba/models/CrackerBinaryTypeFactory.php | 11 +++++++++++ src/dba/models/FileDeleteFactory.php | 11 +++++++++++ src/dba/models/FileDownloadFactory.php | 11 +++++++++++ src/dba/models/FileFactory.php | 11 +++++++++++ src/dba/models/FilePretaskFactory.php | 11 +++++++++++ src/dba/models/FileTaskFactory.php | 11 +++++++++++ src/dba/models/HashBinaryFactory.php | 11 +++++++++++ src/dba/models/HashFactory.php | 11 +++++++++++ src/dba/models/HashTypeFactory.php | 11 +++++++++++ src/dba/models/HashlistFactory.php | 11 +++++++++++ src/dba/models/HashlistHashlistFactory.php | 11 +++++++++++ src/dba/models/HealthCheckAgentFactory.php | 11 +++++++++++ src/dba/models/HealthCheckFactory.php | 11 +++++++++++ src/dba/models/JwtApiKeyFactory.php | 11 +++++++++++ src/dba/models/LogEntryFactory.php | 11 +++++++++++ src/dba/models/NotificationSettingFactory.php | 11 +++++++++++ src/dba/models/PreprocessorFactory.php | 11 +++++++++++ src/dba/models/PretaskFactory.php | 11 +++++++++++ src/dba/models/RegVoucherFactory.php | 11 +++++++++++ src/dba/models/RightGroupFactory.php | 11 +++++++++++ src/dba/models/SessionFactory.php | 11 +++++++++++ src/dba/models/SpeedFactory.php | 11 +++++++++++ src/dba/models/StoredValueFactory.php | 11 +++++++++++ src/dba/models/SupertaskFactory.php | 11 +++++++++++ src/dba/models/SupertaskPretaskFactory.php | 11 +++++++++++ src/dba/models/TaskDebugOutputFactory.php | 11 +++++++++++ src/dba/models/TaskFactory.php | 11 +++++++++++ src/dba/models/TaskWrapperDisplayFactory.php | 11 +++++++++++ src/dba/models/TaskWrapperFactory.php | 11 +++++++++++ src/dba/models/UserFactory.php | 11 +++++++++++ src/dba/models/ZapFactory.php | 11 +++++++++++ src/dba/models/_sqlx_migrationsFactory.php | 11 +++++++++++ 49 files changed, 536 insertions(+), 13 deletions(-) diff --git a/src/dba/AbstractModelFactory.php b/src/dba/AbstractModelFactory.php index 266f4e215..0fe2319cd 100755 --- a/src/dba/AbstractModelFactory.php +++ b/src/dba/AbstractModelFactory.php @@ -321,17 +321,13 @@ public function mset(AbstractModel $model, array $arr): AbstractModel { * Atomically sets the given key of this model to the given value without altering other values * * Returns the return of PDO::execute() - * @param ?AbstractModel $model primary key of model + * @param AbstractModel $model primary key of model * @param string $key key of the column to update * @param $value - * @return ?PDOStatement + * @return AbstractModel * @throws Exception */ - public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement { - if ($model === null) { - return null; - } - + public function set(AbstractModel $model, string $key, $value): AbstractModel { $query = "UPDATE " . $this->getMappedModelTable() . " SET " . self::getMappedModelKey($model, $key) . "=" . self::binaryPlaceholder($model, $key); $values = []; @@ -342,10 +338,9 @@ public function set(?AbstractModel &$model, string $key, $value): ?PDOStatement $stmt = $this->getDB()->prepare($query); $stmt->execute($values); - $refreshed = $this->get($model->getPrimaryKeyValue()); - assert($refreshed instanceof AbstractModel); - $model = $refreshed; - return $stmt; + $model = $this->get($model->getPrimaryKeyValue()); + assert($model !== null); // assert as on this update we should not get null back (unless race-condition) + return $model; } /** diff --git a/src/dba/models/AbstractModelFactory.template.txt b/src/dba/models/AbstractModelFactory.template.txt index 65c4a8d30..341956132 100644 --- a/src/dba/models/AbstractModelFactory.template.txt +++ b/src/dba/models/AbstractModelFactory.template.txt @@ -105,4 +105,15 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { function mset($model, array $arr): __MODEL_NAME__ { return Util::cast(parent::mset($model, $arr), __MODEL_NAME__::class); } + + /** + * @param __MODEL_NAME__ $model + * @param string $key key of the column to update + * @param $value + * @return __MODEL_NAME__ + * @throws Exception + */ + function set($model, string $key, $value): __MODEL_NAME__ { + return Util::cast(parent::set($model, $key, $value), __MODEL_NAME__::class); + } } diff --git a/src/dba/models/AccessGroupAgentFactory.php b/src/dba/models/AccessGroupAgentFactory.php index 319406bd3..3322d64d4 100644 --- a/src/dba/models/AccessGroupAgentFactory.php +++ b/src/dba/models/AccessGroupAgentFactory.php @@ -16,7 +16,7 @@ function getModelName(): string { function getModelTable(): string { return "AccessGroupAgent"; } - + function isMapping(): bool { return False; } @@ -95,7 +95,7 @@ function get($pk): ?AccessGroupAgent { function save($model): AccessGroupAgent { return Util::cast(parent::save($model), AccessGroupAgent::class); } - + /** * @param AccessGroupAgent $model * @param array $arr key-value associations for update @@ -105,4 +105,15 @@ function save($model): AccessGroupAgent { function mset($model, array $arr): AccessGroupAgent { return Util::cast(parent::mset($model, $arr), AccessGroupAgent::class); } + + /** + * @param AccessGroupAgent $model + * @param string $key key of the column to update + * @param $value + * @return AccessGroupAgent + * @throws Exception + */ + function set($model, string $key, $value): AccessGroupAgent { + return Util::cast(parent::set($model, $key, $value), AccessGroupAgent::class); + } } diff --git a/src/dba/models/AccessGroupFactory.php b/src/dba/models/AccessGroupFactory.php index 23ba78718..6d1ae8693 100644 --- a/src/dba/models/AccessGroupFactory.php +++ b/src/dba/models/AccessGroupFactory.php @@ -105,4 +105,15 @@ function save($model): AccessGroup { function mset($model, array $arr): AccessGroup { return Util::cast(parent::mset($model, $arr), AccessGroup::class); } + + /** + * @param AccessGroup $model + * @param string $key key of the column to update + * @param $value + * @return AccessGroup + * @throws Exception + */ + function set($model, string $key, $value): AccessGroup { + return Util::cast(parent::set($model, $key, $value), AccessGroup::class); + } } diff --git a/src/dba/models/AccessGroupUserFactory.php b/src/dba/models/AccessGroupUserFactory.php index 2dd8c15f9..2a761ff52 100644 --- a/src/dba/models/AccessGroupUserFactory.php +++ b/src/dba/models/AccessGroupUserFactory.php @@ -105,4 +105,15 @@ function save($model): AccessGroupUser { function mset($model, array $arr): AccessGroupUser { return Util::cast(parent::mset($model, $arr), AccessGroupUser::class); } + + /** + * @param AccessGroupUser $model + * @param string $key key of the column to update + * @param $value + * @return AccessGroupUser + * @throws Exception + */ + function set($model, string $key, $value): AccessGroupUser { + return Util::cast(parent::set($model, $key, $value), AccessGroupUser::class); + } } diff --git a/src/dba/models/AgentBinaryFactory.php b/src/dba/models/AgentBinaryFactory.php index a8f978723..6dab048a8 100644 --- a/src/dba/models/AgentBinaryFactory.php +++ b/src/dba/models/AgentBinaryFactory.php @@ -105,4 +105,15 @@ function save($model): AgentBinary { function mset($model, array $arr): AgentBinary { return Util::cast(parent::mset($model, $arr), AgentBinary::class); } + + /** + * @param AgentBinary $model + * @param string $key key of the column to update + * @param $value + * @return AgentBinary + * @throws Exception + */ + function set($model, string $key, $value): AgentBinary { + return Util::cast(parent::set($model, $key, $value), AgentBinary::class); + } } diff --git a/src/dba/models/AgentErrorFactory.php b/src/dba/models/AgentErrorFactory.php index ac76e3622..c9c04f9ed 100644 --- a/src/dba/models/AgentErrorFactory.php +++ b/src/dba/models/AgentErrorFactory.php @@ -105,4 +105,15 @@ function save($model): AgentError { function mset($model, array $arr): AgentError { return Util::cast(parent::mset($model, $arr), AgentError::class); } + + /** + * @param AgentError $model + * @param string $key key of the column to update + * @param $value + * @return AgentError + * @throws Exception + */ + function set($model, string $key, $value): AgentError { + return Util::cast(parent::set($model, $key, $value), AgentError::class); + } } diff --git a/src/dba/models/AgentFactory.php b/src/dba/models/AgentFactory.php index 2a1faef9b..e989094ba 100644 --- a/src/dba/models/AgentFactory.php +++ b/src/dba/models/AgentFactory.php @@ -105,4 +105,15 @@ function save($model): Agent { function mset($model, array $arr): Agent { return Util::cast(parent::mset($model, $arr), Agent::class); } + + /** + * @param Agent $model + * @param string $key key of the column to update + * @param $value + * @return Agent + * @throws Exception + */ + function set($model, string $key, $value): Agent { + return Util::cast(parent::set($model, $key, $value), Agent::class); + } } diff --git a/src/dba/models/AgentStatFactory.php b/src/dba/models/AgentStatFactory.php index de6481edd..5f9c523fc 100644 --- a/src/dba/models/AgentStatFactory.php +++ b/src/dba/models/AgentStatFactory.php @@ -105,4 +105,15 @@ function save($model): AgentStat { function mset($model, array $arr): AgentStat { return Util::cast(parent::mset($model, $arr), AgentStat::class); } + + /** + * @param AgentStat $model + * @param string $key key of the column to update + * @param $value + * @return AgentStat + * @throws Exception + */ + function set($model, string $key, $value): AgentStat { + return Util::cast(parent::set($model, $key, $value), AgentStat::class); + } } diff --git a/src/dba/models/AgentZapFactory.php b/src/dba/models/AgentZapFactory.php index 4b80a00aa..eed62fc95 100644 --- a/src/dba/models/AgentZapFactory.php +++ b/src/dba/models/AgentZapFactory.php @@ -105,4 +105,15 @@ function save($model): AgentZap { function mset($model, array $arr): AgentZap { return Util::cast(parent::mset($model, $arr), AgentZap::class); } + + /** + * @param AgentZap $model + * @param string $key key of the column to update + * @param $value + * @return AgentZap + * @throws Exception + */ + function set($model, string $key, $value): AgentZap { + return Util::cast(parent::set($model, $key, $value), AgentZap::class); + } } diff --git a/src/dba/models/ApiGroupFactory.php b/src/dba/models/ApiGroupFactory.php index 622f2949f..d74658067 100644 --- a/src/dba/models/ApiGroupFactory.php +++ b/src/dba/models/ApiGroupFactory.php @@ -105,4 +105,15 @@ function save($model): ApiGroup { function mset($model, array $arr): ApiGroup { return Util::cast(parent::mset($model, $arr), ApiGroup::class); } + + /** + * @param ApiGroup $model + * @param string $key key of the column to update + * @param $value + * @return ApiGroup + * @throws Exception + */ + function set($model, string $key, $value): ApiGroup { + return Util::cast(parent::set($model, $key, $value), ApiGroup::class); + } } diff --git a/src/dba/models/ApiKeyFactory.php b/src/dba/models/ApiKeyFactory.php index ca3e6e731..42ab0f80e 100644 --- a/src/dba/models/ApiKeyFactory.php +++ b/src/dba/models/ApiKeyFactory.php @@ -105,4 +105,15 @@ function save($model): ApiKey { function mset($model, array $arr): ApiKey { return Util::cast(parent::mset($model, $arr), ApiKey::class); } + + /** + * @param ApiKey $model + * @param string $key key of the column to update + * @param $value + * @return ApiKey + * @throws Exception + */ + function set($model, string $key, $value): ApiKey { + return Util::cast(parent::set($model, $key, $value), ApiKey::class); + } } diff --git a/src/dba/models/AssignmentFactory.php b/src/dba/models/AssignmentFactory.php index 072ea9208..9dc6ba936 100644 --- a/src/dba/models/AssignmentFactory.php +++ b/src/dba/models/AssignmentFactory.php @@ -105,4 +105,15 @@ function save($model): Assignment { function mset($model, array $arr): Assignment { return Util::cast(parent::mset($model, $arr), Assignment::class); } + + /** + * @param Assignment $model + * @param string $key key of the column to update + * @param $value + * @return Assignment + * @throws Exception + */ + function set($model, string $key, $value): Assignment { + return Util::cast(parent::set($model, $key, $value), Assignment::class); + } } diff --git a/src/dba/models/ChunkFactory.php b/src/dba/models/ChunkFactory.php index f600fee1c..0a2f9e5d6 100644 --- a/src/dba/models/ChunkFactory.php +++ b/src/dba/models/ChunkFactory.php @@ -105,4 +105,15 @@ function save($model): Chunk { function mset($model, array $arr): Chunk { return Util::cast(parent::mset($model, $arr), Chunk::class); } + + /** + * @param Chunk $model + * @param string $key key of the column to update + * @param $value + * @return Chunk + * @throws Exception + */ + function set($model, string $key, $value): Chunk { + return Util::cast(parent::set($model, $key, $value), Chunk::class); + } } diff --git a/src/dba/models/ConfigFactory.php b/src/dba/models/ConfigFactory.php index b3f54f18e..bf570395f 100644 --- a/src/dba/models/ConfigFactory.php +++ b/src/dba/models/ConfigFactory.php @@ -105,4 +105,15 @@ function save($model): Config { function mset($model, array $arr): Config { return Util::cast(parent::mset($model, $arr), Config::class); } + + /** + * @param Config $model + * @param string $key key of the column to update + * @param $value + * @return Config + * @throws Exception + */ + function set($model, string $key, $value): Config { + return Util::cast(parent::set($model, $key, $value), Config::class); + } } diff --git a/src/dba/models/ConfigSectionFactory.php b/src/dba/models/ConfigSectionFactory.php index 7d3910262..0311d7f90 100644 --- a/src/dba/models/ConfigSectionFactory.php +++ b/src/dba/models/ConfigSectionFactory.php @@ -105,4 +105,15 @@ function save($model): ConfigSection { function mset($model, array $arr): ConfigSection { return Util::cast(parent::mset($model, $arr), ConfigSection::class); } + + /** + * @param ConfigSection $model + * @param string $key key of the column to update + * @param $value + * @return ConfigSection + * @throws Exception + */ + function set($model, string $key, $value): ConfigSection { + return Util::cast(parent::set($model, $key, $value), ConfigSection::class); + } } diff --git a/src/dba/models/CrackerBinaryFactory.php b/src/dba/models/CrackerBinaryFactory.php index 326b78184..3d903e81d 100644 --- a/src/dba/models/CrackerBinaryFactory.php +++ b/src/dba/models/CrackerBinaryFactory.php @@ -105,4 +105,15 @@ function save($model): CrackerBinary { function mset($model, array $arr): CrackerBinary { return Util::cast(parent::mset($model, $arr), CrackerBinary::class); } + + /** + * @param CrackerBinary $model + * @param string $key key of the column to update + * @param $value + * @return CrackerBinary + * @throws Exception + */ + function set($model, string $key, $value): CrackerBinary { + return Util::cast(parent::set($model, $key, $value), CrackerBinary::class); + } } diff --git a/src/dba/models/CrackerBinaryTypeFactory.php b/src/dba/models/CrackerBinaryTypeFactory.php index f9a6f3da9..4fa64fe10 100644 --- a/src/dba/models/CrackerBinaryTypeFactory.php +++ b/src/dba/models/CrackerBinaryTypeFactory.php @@ -105,4 +105,15 @@ function save($model): CrackerBinaryType { function mset($model, array $arr): CrackerBinaryType { return Util::cast(parent::mset($model, $arr), CrackerBinaryType::class); } + + /** + * @param CrackerBinaryType $model + * @param string $key key of the column to update + * @param $value + * @return CrackerBinaryType + * @throws Exception + */ + function set($model, string $key, $value): CrackerBinaryType { + return Util::cast(parent::set($model, $key, $value), CrackerBinaryType::class); + } } diff --git a/src/dba/models/FileDeleteFactory.php b/src/dba/models/FileDeleteFactory.php index 4fb08d2b5..ccbd36804 100644 --- a/src/dba/models/FileDeleteFactory.php +++ b/src/dba/models/FileDeleteFactory.php @@ -105,4 +105,15 @@ function save($model): FileDelete { function mset($model, array $arr): FileDelete { return Util::cast(parent::mset($model, $arr), FileDelete::class); } + + /** + * @param FileDelete $model + * @param string $key key of the column to update + * @param $value + * @return FileDelete + * @throws Exception + */ + function set($model, string $key, $value): FileDelete { + return Util::cast(parent::set($model, $key, $value), FileDelete::class); + } } diff --git a/src/dba/models/FileDownloadFactory.php b/src/dba/models/FileDownloadFactory.php index 238ae8b5e..1579754d6 100644 --- a/src/dba/models/FileDownloadFactory.php +++ b/src/dba/models/FileDownloadFactory.php @@ -105,4 +105,15 @@ function save($model): FileDownload { function mset($model, array $arr): FileDownload { return Util::cast(parent::mset($model, $arr), FileDownload::class); } + + /** + * @param FileDownload $model + * @param string $key key of the column to update + * @param $value + * @return FileDownload + * @throws Exception + */ + function set($model, string $key, $value): FileDownload { + return Util::cast(parent::set($model, $key, $value), FileDownload::class); + } } diff --git a/src/dba/models/FileFactory.php b/src/dba/models/FileFactory.php index e4812638f..341220545 100644 --- a/src/dba/models/FileFactory.php +++ b/src/dba/models/FileFactory.php @@ -105,4 +105,15 @@ function save($model): File { function mset($model, array $arr): File { return Util::cast(parent::mset($model, $arr), File::class); } + + /** + * @param File $model + * @param string $key key of the column to update + * @param $value + * @return File + * @throws Exception + */ + function set($model, string $key, $value): File { + return Util::cast(parent::set($model, $key, $value), File::class); + } } diff --git a/src/dba/models/FilePretaskFactory.php b/src/dba/models/FilePretaskFactory.php index a244e18e1..9cc53a793 100644 --- a/src/dba/models/FilePretaskFactory.php +++ b/src/dba/models/FilePretaskFactory.php @@ -105,4 +105,15 @@ function save($model): FilePretask { function mset($model, array $arr): FilePretask { return Util::cast(parent::mset($model, $arr), FilePretask::class); } + + /** + * @param FilePretask $model + * @param string $key key of the column to update + * @param $value + * @return FilePretask + * @throws Exception + */ + function set($model, string $key, $value): FilePretask { + return Util::cast(parent::set($model, $key, $value), FilePretask::class); + } } diff --git a/src/dba/models/FileTaskFactory.php b/src/dba/models/FileTaskFactory.php index 390acc2dd..2577a2ecf 100644 --- a/src/dba/models/FileTaskFactory.php +++ b/src/dba/models/FileTaskFactory.php @@ -105,4 +105,15 @@ function save($model): FileTask { function mset($model, array $arr): FileTask { return Util::cast(parent::mset($model, $arr), FileTask::class); } + + /** + * @param FileTask $model + * @param string $key key of the column to update + * @param $value + * @return FileTask + * @throws Exception + */ + function set($model, string $key, $value): FileTask { + return Util::cast(parent::set($model, $key, $value), FileTask::class); + } } diff --git a/src/dba/models/HashBinaryFactory.php b/src/dba/models/HashBinaryFactory.php index 534f3ff39..2a3f213c5 100644 --- a/src/dba/models/HashBinaryFactory.php +++ b/src/dba/models/HashBinaryFactory.php @@ -105,4 +105,15 @@ function save($model): HashBinary { function mset($model, array $arr): HashBinary { return Util::cast(parent::mset($model, $arr), HashBinary::class); } + + /** + * @param HashBinary $model + * @param string $key key of the column to update + * @param $value + * @return HashBinary + * @throws Exception + */ + function set($model, string $key, $value): HashBinary { + return Util::cast(parent::set($model, $key, $value), HashBinary::class); + } } diff --git a/src/dba/models/HashFactory.php b/src/dba/models/HashFactory.php index 560d84a11..36801d87a 100644 --- a/src/dba/models/HashFactory.php +++ b/src/dba/models/HashFactory.php @@ -105,4 +105,15 @@ function save($model): Hash { function mset($model, array $arr): Hash { return Util::cast(parent::mset($model, $arr), Hash::class); } + + /** + * @param Hash $model + * @param string $key key of the column to update + * @param $value + * @return Hash + * @throws Exception + */ + function set($model, string $key, $value): Hash { + return Util::cast(parent::set($model, $key, $value), Hash::class); + } } diff --git a/src/dba/models/HashTypeFactory.php b/src/dba/models/HashTypeFactory.php index c5951ca46..a7699169b 100644 --- a/src/dba/models/HashTypeFactory.php +++ b/src/dba/models/HashTypeFactory.php @@ -105,4 +105,15 @@ function save($model): HashType { function mset($model, array $arr): HashType { return Util::cast(parent::mset($model, $arr), HashType::class); } + + /** + * @param HashType $model + * @param string $key key of the column to update + * @param $value + * @return HashType + * @throws Exception + */ + function set($model, string $key, $value): HashType { + return Util::cast(parent::set($model, $key, $value), HashType::class); + } } diff --git a/src/dba/models/HashlistFactory.php b/src/dba/models/HashlistFactory.php index ac997ecc1..62f77de11 100644 --- a/src/dba/models/HashlistFactory.php +++ b/src/dba/models/HashlistFactory.php @@ -105,4 +105,15 @@ function save($model): Hashlist { function mset($model, array $arr): Hashlist { return Util::cast(parent::mset($model, $arr), Hashlist::class); } + + /** + * @param Hashlist $model + * @param string $key key of the column to update + * @param $value + * @return Hashlist + * @throws Exception + */ + function set($model, string $key, $value): Hashlist { + return Util::cast(parent::set($model, $key, $value), Hashlist::class); + } } diff --git a/src/dba/models/HashlistHashlistFactory.php b/src/dba/models/HashlistHashlistFactory.php index 872a4a879..6d9f8deb5 100644 --- a/src/dba/models/HashlistHashlistFactory.php +++ b/src/dba/models/HashlistHashlistFactory.php @@ -105,4 +105,15 @@ function save($model): HashlistHashlist { function mset($model, array $arr): HashlistHashlist { return Util::cast(parent::mset($model, $arr), HashlistHashlist::class); } + + /** + * @param HashlistHashlist $model + * @param string $key key of the column to update + * @param $value + * @return HashlistHashlist + * @throws Exception + */ + function set($model, string $key, $value): HashlistHashlist { + return Util::cast(parent::set($model, $key, $value), HashlistHashlist::class); + } } diff --git a/src/dba/models/HealthCheckAgentFactory.php b/src/dba/models/HealthCheckAgentFactory.php index e4873175a..bfe402c73 100644 --- a/src/dba/models/HealthCheckAgentFactory.php +++ b/src/dba/models/HealthCheckAgentFactory.php @@ -106,4 +106,15 @@ function save($model): HealthCheckAgent { function mset($model, array $arr): HealthCheckAgent { return Util::cast(parent::mset($model, $arr), HealthCheckAgent::class); } + + /** + * @param HealthCheckAgent $model + * @param string $key key of the column to update + * @param $value + * @return HealthCheckAgent + * @throws Exception + */ + function set($model, string $key, $value): HealthCheckAgent { + return Util::cast(parent::set($model, $key, $value), HealthCheckAgent::class); + } } diff --git a/src/dba/models/HealthCheckFactory.php b/src/dba/models/HealthCheckFactory.php index b3e912e6b..c97ae9548 100644 --- a/src/dba/models/HealthCheckFactory.php +++ b/src/dba/models/HealthCheckFactory.php @@ -105,4 +105,15 @@ function save($model): HealthCheck { function mset($model, array $arr): HealthCheck { return Util::cast(parent::mset($model, $arr), HealthCheck::class); } + + /** + * @param HealthCheck $model + * @param string $key key of the column to update + * @param $value + * @return HealthCheck + * @throws Exception + */ + function set($model, string $key, $value): HealthCheck { + return Util::cast(parent::set($model, $key, $value), HealthCheck::class); + } } diff --git a/src/dba/models/JwtApiKeyFactory.php b/src/dba/models/JwtApiKeyFactory.php index 0f2c3ebcd..9de1b0460 100644 --- a/src/dba/models/JwtApiKeyFactory.php +++ b/src/dba/models/JwtApiKeyFactory.php @@ -105,4 +105,15 @@ function save($model): JwtApiKey { function mset($model, array $arr): JwtApiKey { return Util::cast(parent::mset($model, $arr), JwtApiKey::class); } + + /** + * @param JwtApiKey $model + * @param string $key key of the column to update + * @param $value + * @return JwtApiKey + * @throws Exception + */ + function set($model, string $key, $value): JwtApiKey { + return Util::cast(parent::set($model, $key, $value), JwtApiKey::class); + } } diff --git a/src/dba/models/LogEntryFactory.php b/src/dba/models/LogEntryFactory.php index 76a17224a..e7ebfe21e 100644 --- a/src/dba/models/LogEntryFactory.php +++ b/src/dba/models/LogEntryFactory.php @@ -105,4 +105,15 @@ function save($model): LogEntry { function mset($model, array $arr): LogEntry { return Util::cast(parent::mset($model, $arr), LogEntry::class); } + + /** + * @param LogEntry $model + * @param string $key key of the column to update + * @param $value + * @return LogEntry + * @throws Exception + */ + function set($model, string $key, $value): LogEntry { + return Util::cast(parent::set($model, $key, $value), LogEntry::class); + } } diff --git a/src/dba/models/NotificationSettingFactory.php b/src/dba/models/NotificationSettingFactory.php index be5c2dd96..d09b9e77b 100644 --- a/src/dba/models/NotificationSettingFactory.php +++ b/src/dba/models/NotificationSettingFactory.php @@ -105,4 +105,15 @@ function save($model): NotificationSetting { function mset($model, array $arr): NotificationSetting { return Util::cast(parent::mset($model, $arr), NotificationSetting::class); } + + /** + * @param NotificationSetting $model + * @param string $key key of the column to update + * @param $value + * @return NotificationSetting + * @throws Exception + */ + function set($model, string $key, $value): NotificationSetting { + return Util::cast(parent::set($model, $key, $value), NotificationSetting::class); + } } diff --git a/src/dba/models/PreprocessorFactory.php b/src/dba/models/PreprocessorFactory.php index b64de2e0b..78dbb2214 100644 --- a/src/dba/models/PreprocessorFactory.php +++ b/src/dba/models/PreprocessorFactory.php @@ -105,4 +105,15 @@ function save($model): Preprocessor { function mset($model, array $arr): Preprocessor { return Util::cast(parent::mset($model, $arr), Preprocessor::class); } + + /** + * @param Preprocessor $model + * @param string $key key of the column to update + * @param $value + * @return Preprocessor + * @throws Exception + */ + function set($model, string $key, $value): Preprocessor { + return Util::cast(parent::set($model, $key, $value), Preprocessor::class); + } } diff --git a/src/dba/models/PretaskFactory.php b/src/dba/models/PretaskFactory.php index 3999d153a..8c9c919f1 100644 --- a/src/dba/models/PretaskFactory.php +++ b/src/dba/models/PretaskFactory.php @@ -105,4 +105,15 @@ function save($model): Pretask { function mset($model, array $arr): Pretask { return Util::cast(parent::mset($model, $arr), Pretask::class); } + + /** + * @param Pretask $model + * @param string $key key of the column to update + * @param $value + * @return Pretask + * @throws Exception + */ + function set($model, string $key, $value): Pretask { + return Util::cast(parent::set($model, $key, $value), Pretask::class); + } } diff --git a/src/dba/models/RegVoucherFactory.php b/src/dba/models/RegVoucherFactory.php index 42082740c..4b3d5b092 100644 --- a/src/dba/models/RegVoucherFactory.php +++ b/src/dba/models/RegVoucherFactory.php @@ -105,4 +105,15 @@ function save($model): RegVoucher { function mset($model, array $arr): RegVoucher { return Util::cast(parent::mset($model, $arr), RegVoucher::class); } + + /** + * @param RegVoucher $model + * @param string $key key of the column to update + * @param $value + * @return RegVoucher + * @throws Exception + */ + function set($model, string $key, $value): RegVoucher { + return Util::cast(parent::set($model, $key, $value), RegVoucher::class); + } } diff --git a/src/dba/models/RightGroupFactory.php b/src/dba/models/RightGroupFactory.php index 32f95715e..cecf969b7 100644 --- a/src/dba/models/RightGroupFactory.php +++ b/src/dba/models/RightGroupFactory.php @@ -105,4 +105,15 @@ function save($model): RightGroup { function mset($model, array $arr): RightGroup { return Util::cast(parent::mset($model, $arr), RightGroup::class); } + + /** + * @param RightGroup $model + * @param string $key key of the column to update + * @param $value + * @return RightGroup + * @throws Exception + */ + function set($model, string $key, $value): RightGroup { + return Util::cast(parent::set($model, $key, $value), RightGroup::class); + } } diff --git a/src/dba/models/SessionFactory.php b/src/dba/models/SessionFactory.php index 2a17fd628..8c94942de 100644 --- a/src/dba/models/SessionFactory.php +++ b/src/dba/models/SessionFactory.php @@ -105,4 +105,15 @@ function save($model): Session { function mset($model, array $arr): Session { return Util::cast(parent::mset($model, $arr), Session::class); } + + /** + * @param Session $model + * @param string $key key of the column to update + * @param $value + * @return Session + * @throws Exception + */ + function set($model, string $key, $value): Session { + return Util::cast(parent::set($model, $key, $value), Session::class); + } } diff --git a/src/dba/models/SpeedFactory.php b/src/dba/models/SpeedFactory.php index 4d80d3397..b87010382 100644 --- a/src/dba/models/SpeedFactory.php +++ b/src/dba/models/SpeedFactory.php @@ -105,4 +105,15 @@ function save($model): Speed { function mset($model, array $arr): Speed { return Util::cast(parent::mset($model, $arr), Speed::class); } + + /** + * @param Speed $model + * @param string $key key of the column to update + * @param $value + * @return Speed + * @throws Exception + */ + function set($model, string $key, $value): Speed { + return Util::cast(parent::set($model, $key, $value), Speed::class); + } } diff --git a/src/dba/models/StoredValueFactory.php b/src/dba/models/StoredValueFactory.php index 28d896425..ee131ffe3 100644 --- a/src/dba/models/StoredValueFactory.php +++ b/src/dba/models/StoredValueFactory.php @@ -105,4 +105,15 @@ function save($model): StoredValue { function mset($model, array $arr): StoredValue { return Util::cast(parent::mset($model, $arr), StoredValue::class); } + + /** + * @param StoredValue $model + * @param string $key key of the column to update + * @param $value + * @return StoredValue + * @throws Exception + */ + function set($model, string $key, $value): StoredValue { + return Util::cast(parent::set($model, $key, $value), StoredValue::class); + } } diff --git a/src/dba/models/SupertaskFactory.php b/src/dba/models/SupertaskFactory.php index 972276f0a..d309f3f59 100644 --- a/src/dba/models/SupertaskFactory.php +++ b/src/dba/models/SupertaskFactory.php @@ -105,4 +105,15 @@ function save($model): Supertask { function mset($model, array $arr): Supertask { return Util::cast(parent::mset($model, $arr), Supertask::class); } + + /** + * @param Supertask $model + * @param string $key key of the column to update + * @param $value + * @return Supertask + * @throws Exception + */ + function set($model, string $key, $value): Supertask { + return Util::cast(parent::set($model, $key, $value), Supertask::class); + } } diff --git a/src/dba/models/SupertaskPretaskFactory.php b/src/dba/models/SupertaskPretaskFactory.php index 9d7c9320e..4e2c64534 100644 --- a/src/dba/models/SupertaskPretaskFactory.php +++ b/src/dba/models/SupertaskPretaskFactory.php @@ -105,4 +105,15 @@ function save($model): SupertaskPretask { function mset($model, array $arr): SupertaskPretask { return Util::cast(parent::mset($model, $arr), SupertaskPretask::class); } + + /** + * @param SupertaskPretask $model + * @param string $key key of the column to update + * @param $value + * @return SupertaskPretask + * @throws Exception + */ + function set($model, string $key, $value): SupertaskPretask { + return Util::cast(parent::set($model, $key, $value), SupertaskPretask::class); + } } diff --git a/src/dba/models/TaskDebugOutputFactory.php b/src/dba/models/TaskDebugOutputFactory.php index f9b2f377d..944e0db88 100644 --- a/src/dba/models/TaskDebugOutputFactory.php +++ b/src/dba/models/TaskDebugOutputFactory.php @@ -105,4 +105,15 @@ function save($model): TaskDebugOutput { function mset($model, array $arr): TaskDebugOutput { return Util::cast(parent::mset($model, $arr), TaskDebugOutput::class); } + + /** + * @param TaskDebugOutput $model + * @param string $key key of the column to update + * @param $value + * @return TaskDebugOutput + * @throws Exception + */ + function set($model, string $key, $value): TaskDebugOutput { + return Util::cast(parent::set($model, $key, $value), TaskDebugOutput::class); + } } diff --git a/src/dba/models/TaskFactory.php b/src/dba/models/TaskFactory.php index 3a21f06d5..fc1e24ba6 100644 --- a/src/dba/models/TaskFactory.php +++ b/src/dba/models/TaskFactory.php @@ -105,4 +105,15 @@ function save($model): Task { function mset($model, array $arr): Task { return Util::cast(parent::mset($model, $arr), Task::class); } + + /** + * @param Task $model + * @param string $key key of the column to update + * @param $value + * @return Task + * @throws Exception + */ + function set($model, string $key, $value): Task { + return Util::cast(parent::set($model, $key, $value), Task::class); + } } diff --git a/src/dba/models/TaskWrapperDisplayFactory.php b/src/dba/models/TaskWrapperDisplayFactory.php index ae5d8ee9c..30f8082f8 100644 --- a/src/dba/models/TaskWrapperDisplayFactory.php +++ b/src/dba/models/TaskWrapperDisplayFactory.php @@ -105,4 +105,15 @@ function save($model): TaskWrapperDisplay { function mset($model, array $arr): TaskWrapperDisplay { return Util::cast(parent::mset($model, $arr), TaskWrapperDisplay::class); } + + /** + * @param TaskWrapperDisplay $model + * @param string $key key of the column to update + * @param $value + * @return TaskWrapperDisplay + * @throws Exception + */ + function set($model, string $key, $value): TaskWrapperDisplay { + return Util::cast(parent::set($model, $key, $value), TaskWrapperDisplay::class); + } } diff --git a/src/dba/models/TaskWrapperFactory.php b/src/dba/models/TaskWrapperFactory.php index 1144551b8..7c08b655c 100644 --- a/src/dba/models/TaskWrapperFactory.php +++ b/src/dba/models/TaskWrapperFactory.php @@ -105,4 +105,15 @@ function save($model): TaskWrapper { function mset($model, array $arr): TaskWrapper { return Util::cast(parent::mset($model, $arr), TaskWrapper::class); } + + /** + * @param TaskWrapper $model + * @param string $key key of the column to update + * @param $value + * @return TaskWrapper + * @throws Exception + */ + function set($model, string $key, $value): TaskWrapper { + return Util::cast(parent::set($model, $key, $value), TaskWrapper::class); + } } diff --git a/src/dba/models/UserFactory.php b/src/dba/models/UserFactory.php index 6d8ee3298..d91d104bd 100644 --- a/src/dba/models/UserFactory.php +++ b/src/dba/models/UserFactory.php @@ -105,4 +105,15 @@ function save($model): User { function mset($model, array $arr): User { return Util::cast(parent::mset($model, $arr), User::class); } + + /** + * @param User $model + * @param string $key key of the column to update + * @param $value + * @return User + * @throws Exception + */ + function set($model, string $key, $value): User { + return Util::cast(parent::set($model, $key, $value), User::class); + } } diff --git a/src/dba/models/ZapFactory.php b/src/dba/models/ZapFactory.php index e2e80ce33..ae1f8b486 100644 --- a/src/dba/models/ZapFactory.php +++ b/src/dba/models/ZapFactory.php @@ -105,4 +105,15 @@ function save($model): Zap { function mset($model, array $arr): Zap { return Util::cast(parent::mset($model, $arr), Zap::class); } + + /** + * @param Zap $model + * @param string $key key of the column to update + * @param $value + * @return Zap + * @throws Exception + */ + function set($model, string $key, $value): Zap { + return Util::cast(parent::set($model, $key, $value), Zap::class); + } } diff --git a/src/dba/models/_sqlx_migrationsFactory.php b/src/dba/models/_sqlx_migrationsFactory.php index 9e5541c68..f5858cfa7 100644 --- a/src/dba/models/_sqlx_migrationsFactory.php +++ b/src/dba/models/_sqlx_migrationsFactory.php @@ -110,4 +110,15 @@ function save($model): _sqlx_migrations { function mset($model, array $arr): _sqlx_migrations { return Util::cast(parent::mset($model, $arr), _sqlx_migrations::class); } + + /** + * @param _sqlx_migrations $model + * @param string $key key of the column to update + * @param $value + * @return _sqlx_migrations + * @throws Exception + */ + function set($model, string $key, $value): _sqlx_migrations { + return Util::cast(parent::set($model, $key, $value), _sqlx_migrations::class); + } } From 37b2fc7570f08724b61d0b06571f380c8fd73805 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 11:25:28 +0200 Subject: [PATCH 11/19] adjusted all places where the return object may be used from mset/set to avoid any potential issues --- ci/phpunit/dba/AbstractModelFactoryTest.php | 34 +++++++++++++++++++++ src/inc/Login.php | 4 +-- src/inc/api/APIBasic.php | 2 +- src/inc/api/APIClientError.php | 2 +- src/inc/api/APILogin.php | 2 +- src/inc/api/APISendBenchmark.php | 6 ++-- src/inc/api/APISendKeyspace.php | 4 +-- src/inc/api/APISendProgress.php | 28 ++++++++--------- src/inc/api/APIUpdateClientInformation.php | 4 +-- src/inc/utils/AccessControlUtils.php | 6 ++-- src/inc/utils/AccountUtils.php | 4 +-- src/inc/utils/AgentBinaryUtils.php | 14 ++++----- src/inc/utils/AgentUtils.php | 9 ++---- src/inc/utils/ApiUtils.php | 2 +- src/inc/utils/ChunkUtils.php | 11 +++---- src/inc/utils/ConfigUtils.php | 4 +-- src/inc/utils/CrackerUtils.php | 2 +- src/inc/utils/FileUtils.php | 2 +- src/inc/utils/HashlistUtils.php | 10 +++--- src/inc/utils/TaskUtils.php | 2 +- 20 files changed, 91 insertions(+), 61 deletions(-) diff --git a/ci/phpunit/dba/AbstractModelFactoryTest.php b/ci/phpunit/dba/AbstractModelFactoryTest.php index 132edc28f..e3cd70899 100644 --- a/ci/phpunit/dba/AbstractModelFactoryTest.php +++ b/ci/phpunit/dba/AbstractModelFactoryTest.php @@ -216,6 +216,7 @@ public function testUpdateModelSuccessMultipleChanges(): void { */ public function testMsetSuccess(): void { $hashType = $this->createDatabaseObject(Factory::getHashTypeFactory(), new HashType(null, 'placeholder', 0, 0)); + $this->assertInstanceOf(HashType::class, $hashType); Factory::getHashTypeFactory()->mset($hashType, [HashType::IS_SALTED => 1, HashType::IS_SLOW_HASH => 1]); $hashTypeUpdated = Factory::getHashTypeFactory()->get($hashType->getId()); $this->assertEquals(1, $hashTypeUpdated->getIsSalted()); @@ -259,6 +260,7 @@ public function testMsetSuccessTwoObjects(): void { */ public function testSetSuccess(): void { $hashType = $this->createDatabaseObject(Factory::getHashTypeFactory(), new HashType(null, 'placeholder', 0, 0)); + $this->assertTrue($hashType instanceof HashType); Factory::getHashTypeFactory()->set($hashType, HashType::IS_SALTED, 1); $hashTypeUpdated = Factory::getHashTypeFactory()->get($hashType->getId()); $this->assertEquals(1, $hashTypeUpdated->getIsSalted()); @@ -294,6 +296,38 @@ public function testSetSuccessTwoObjects(): void { $this->assertEquals('something else', $hashTypeUpdated->getDescription()); } + /** + * Tests that set() replaces the by-ref model with a new instance of the correct concrete type + * + * @return void + * @throws Exception + */ + public function testSetRefreshesModel(): void { + $hashType = $this->createDatabaseObject(Factory::getHashTypeFactory(), new HashType(null, 'placeholder', 0, 0)); + $this->assertInstanceOf(HashType::class, $hashType); + $originalObject = $hashType; + Factory::getHashTypeFactory()->set($hashType, HashType::IS_SALTED, 1); + $this->assertNotSame($originalObject, $hashType); + $this->assertEquals(1, $hashType->getIsSalted()); + $this->assertEquals(0, $hashType->getIsSlowHash()); + } + + /** + * Tests that mset() replaces the by-ref model with a new instance of the correct concrete type + * + * @return void + * @throws Exception + */ + public function testMsetRefreshesModel(): void { + $hashType = $this->createDatabaseObject(Factory::getHashTypeFactory(), new HashType(null, 'placeholder', 0, 0)); + $this->assertInstanceOf(HashType::class, $hashType); + $originalObject = $hashType; + Factory::getHashTypeFactory()->mset($hashType, [HashType::IS_SALTED => 1, HashType::IS_SLOW_HASH => 1]); + $this->assertNotSame($originalObject, $hashType); + $this->assertEquals(1, $hashType->getIsSalted()); + $this->assertEquals(1, $hashType->getIsSlowHash()); + } + /** * Tests if values with inc() are set properly * diff --git a/src/inc/Login.php b/src/inc/Login.php index fe84d2a49..48e7f791d 100755 --- a/src/inc/Login.php +++ b/src/inc/Login.php @@ -68,7 +68,7 @@ private function __construct() { } $this->valid = true; $this->session = $session; - Factory::getSessionFactory()->set($session, Session::LAST_ACTION_DATE, time()); + $session = Factory::getSessionFactory()->set($session, Session::LAST_ACTION_DATE, time()); setcookie("session", $session->getSessionKey(), time() + $this->user->getSessionLifetime(), "", "", false, true); } } @@ -194,7 +194,7 @@ public function login(string $username, string $password, $otp = NULL): bool { } $sessionKey = Encryption::sessionHash($session->getId(), $startTime, $user->getEmail()); Factory::getSessionFactory()->set($session, Session::SESSION_KEY, $sessionKey); - Factory::getUserFactory()->set($this->user, User::LAST_LOGIN_DATE, time()); + $this->user = Factory::getUserFactory()->set($this->user, User::LAST_LOGIN_DATE, time()); $this->valid = true; Util::createLogEntry(DLogEntryIssuer::USER, $user->getId(), DLogEntry::INFO, "Successful login!"); diff --git a/src/inc/api/APIBasic.php b/src/inc/api/APIBasic.php index bc258b327..8595f5c27 100644 --- a/src/inc/api/APIBasic.php +++ b/src/inc/api/APIBasic.php @@ -32,7 +32,7 @@ protected function sendResponse($RESPONSE): void { * @throws Exception */ protected function updateAgent($action): void { - Factory::getAgentFactory()->mset($this->agent, [Agent::LAST_IP => Util::getIP(), Agent::LAST_ACT => $action, Agent::LAST_TIME => time()]); + $this->agent = Factory::getAgentFactory()->mset($this->agent, [Agent::LAST_IP => Util::getIP(), Agent::LAST_ACT => $action, Agent::LAST_TIME => time()]); } public function sendErrorResponse($action, $msg): void { diff --git a/src/inc/api/APIClientError.php b/src/inc/api/APIClientError.php index 9caede8a9..44bd2eee9 100644 --- a/src/inc/api/APIClientError.php +++ b/src/inc/api/APIClientError.php @@ -74,7 +74,7 @@ public function execute(array $QUERY = array()) { if ($this->agent->getIgnoreErrors() == DAgentIgnoreErrors::NO) { //deactivate agent - Factory::getAgentFactory()->set($this->agent, Agent::IS_ACTIVE, 0); + $this->agent = Factory::getAgentFactory()->set($this->agent, Agent::IS_ACTIVE, 0); } $this->updateAgent(PActions::CLIENT_ERROR); diff --git a/src/inc/api/APILogin.php b/src/inc/api/APILogin.php index 8afb5fa73..7ef1f4f7e 100644 --- a/src/inc/api/APILogin.php +++ b/src/inc/api/APILogin.php @@ -20,7 +20,7 @@ public function execute(array $QUERY = array()) { $this->sendErrorResponse(PActions::LOGIN, "Invalid login query!"); } $this->checkToken(PActions::LOGIN, $QUERY); - Factory::getAgentFactory()->set($this->agent, Agent::CLIENT_SIGNATURE, htmlentities($QUERY[PQueryLogin::CLIENT_SIGNATURE], ENT_QUOTES, "UTF-8")); + $this->agent = Factory::getAgentFactory()->set($this->agent, Agent::CLIENT_SIGNATURE, htmlentities($QUERY[PQueryLogin::CLIENT_SIGNATURE], ENT_QUOTES, "UTF-8")); $this->updateAgent(PActions::LOGIN); DServerLog::log(DServerLog::DEBUG, "Agent logged in", [$this->agent]); diff --git a/src/inc/api/APISendBenchmark.php b/src/inc/api/APISendBenchmark.php index 57ded9645..ddd4b45ab 100644 --- a/src/inc/api/APISendBenchmark.php +++ b/src/inc/api/APISendBenchmark.php @@ -44,14 +44,14 @@ public function execute(array $QUERY = array()) { case PValuesBenchmarkType::SPEED_TEST: $split = explode(":", $benchmark); if (sizeof($split) != 2 || !is_numeric($split[0]) || !is_numeric($split[1]) || $split[0] <= 0 || $split[1] <= 0) { - Factory::getAgentFactory()->set($this->agent, Agent::IS_ACTIVE, 0); + $this->agent = Factory::getAgentFactory()->set($this->agent, Agent::IS_ACTIVE, 0); DServerLog::log(DServerLog::ERROR, "Invalid speed test benchmark result!", [$this->agent, $benchmark]); $this->sendErrorResponse(PActions::SEND_BENCHMARK, "Invalid benchmark result!"); } break; case PValuesBenchmarkType::RUN_TIME: if (!is_numeric($benchmark) || $benchmark <= 0) { - Factory::getAgentFactory()->set($this->agent, Agent::IS_ACTIVE, 0); + $this->agent = Factory::getAgentFactory()->set($this->agent, Agent::IS_ACTIVE, 0); DServerLog::log(DServerLog::ERROR, "Invalid benchmark results for runtime benchmark", [$this->agent, $task, $benchmark]); $this->sendErrorResponse(PActions::SEND_BENCHMARK, "Invalid benchmark result!"); } @@ -60,7 +60,7 @@ public function execute(array $QUERY = array()) { DServerLog::log(DServerLog::TRACE, "Saving normalized runtime benchmark", [$this->agent, $task, $benchmark]); break; default: - Factory::getAgentFactory()->set($this->agent, Agent::IS_ACTIVE, 0); + $this->agent = Factory::getAgentFactory()->set($this->agent, Agent::IS_ACTIVE, 0); $this->sendErrorResponse(PActions::SEND_BENCHMARK, "Invalid benchmark type!"); } diff --git a/src/inc/api/APISendKeyspace.php b/src/inc/api/APISendKeyspace.php index 6b7ea7220..82a6aa060 100644 --- a/src/inc/api/APISendKeyspace.php +++ b/src/inc/api/APISendKeyspace.php @@ -53,7 +53,7 @@ public function execute(array $QUERY = array()) { $this->sendErrorResponse(PActions::SEND_KEYSPACE, "Server parsed a negative keyspace, it's very likely that the number was too big to be handled by the server system!"); } - Factory::getTaskFactory()->set($task, Task::KEYSPACE, $keyspace); + $task = Factory::getTaskFactory()->set($task, Task::KEYSPACE, $keyspace); DServerLog::log(DServerLog::TRACE, "Keyspace saved", [$this->agent, $task]); } @@ -61,7 +61,7 @@ public function execute(array $QUERY = array()) { if ($task->getSkipKeyspace() > $task->getKeyspace() && $task->getKeyspace() != DPrince::PRINCE_KEYSPACE) { // skip is too high DServerLog::log(DServerLog::ERROR, "Task skip value is too high, putting task inactive!", [$this->agent, $task]); - Factory::getTaskFactory()->set($task, Task::PRIORITY, 0); + $task = Factory::getTaskFactory()->set($task, Task::PRIORITY, 0); $qF = new QueryFilter(Assignment::TASK_ID, $task->getId(), "="); Factory::getAssignmentFactory()->massDeletion([Factory::FILTER => $qF]); Util::createLogEntry(DLogEntryIssuer::API, $this->agent->getToken(), DLogEntry::ERROR, "Task with ID " . $task->getId() . " has set a skip value which is too high for its keyspace!"); diff --git a/src/inc/api/APISendProgress.php b/src/inc/api/APISendProgress.php index e469cd86e..fa26e2514 100644 --- a/src/inc/api/APISendProgress.php +++ b/src/inc/api/APISendProgress.php @@ -67,7 +67,7 @@ public function execute(array $QUERY = array()) { $this->sendErrorResponse(PActions::SEND_PROGRESS, "You are not assigned to this chunk"); } else if ($this->agent->getIsActive() == 0) { - Factory::getChunkFactory()->set($chunk, Chunk::SPEED, 0); + $chunk = Factory::getChunkFactory()->set($chunk, Chunk::SPEED, 0); $this->sendErrorResponse(PActions::SEND_PROGRESS, "Agent is marked inactive!"); } @@ -183,7 +183,7 @@ public function execute(array $QUERY = array()) { DServerLog::log(DServerLog::TRACE, "Chunk was aborted, we need to stop afterwards", [$this->agent]); $aborting = true; } - Factory::getChunkFactory()->mset($chunk, [ + $chunk = Factory::getChunkFactory()->mset($chunk, [ Chunk::PROGRESS => $relativeProgress, Chunk::CHECKPOINT => $keyspaceProgress, Chunk::SOLVE_TIME => time(), @@ -425,7 +425,7 @@ public function execute(array $QUERY = array()) { if ($chunk->getState() == DHashcatStatus::STATUS_ABORTED_RUNTIME) { // the chunk was manually interrupted - Factory::getChunkFactory()->set($chunk, Chunk::STATE, DHashcatStatus::ABORTED); + $chunk = Factory::getChunkFactory()->set($chunk, Chunk::STATE, DHashcatStatus::ABORTED); DServerLog::log(DServerLog::TRACE, "Chunk was manually interrupted", [$this->agent]); $this->sendErrorResponse(PActions::SEND_PROGRESS, "Chunk was manually interrupted."); } @@ -447,16 +447,16 @@ public function execute(array $QUERY = array()) { if ($taskdone) { // task is fully dispatched and this last chunk is done, deprioritize it - Factory::getTaskFactory()->set($task, Task::PRIORITY, 0); + $task = Factory::getTaskFactory()->set($task, Task::PRIORITY, 0); if ($taskWrapper->getTaskType() == DTaskTypes::SUPERTASK) { // check if the task wrapper is a supertask and is completed if (Util::checkTaskWrapperCompleted($taskWrapper)) { - Factory::getTaskWrapperFactory()->set($taskWrapper, TaskWrapper::PRIORITY, 0); + $taskWrapper = Factory::getTaskWrapperFactory()->set($taskWrapper, TaskWrapper::PRIORITY, 0); } } else { - Factory::getTaskWrapperFactory()->set($taskWrapper, TaskWrapper::PRIORITY, 0); + $taskWrapper = Factory::getTaskWrapperFactory()->set($taskWrapper, TaskWrapper::PRIORITY, 0); } DServerLog::log(DServerLog::TRACE, "As task is done, finished it and updated taskWrapper", [$this->agent, $task, $taskWrapper]); @@ -474,7 +474,7 @@ public function execute(array $QUERY = array()) { } if ($aborting) { - Factory::getChunkFactory()->mset($chunk, [Chunk::SPEED => 0, Chunk::STATE => DHashcatStatus::ABORTED]); + $chunk = Factory::getChunkFactory()->mset($chunk, [Chunk::SPEED => 0, Chunk::STATE => DHashcatStatus::ABORTED]); DServerLog::log(DServerLog::TRACE, "From earlier setting, chunk needed to be aborted.", [$this->agent, $chunk]); $this->sendErrorResponse(PActions::SEND_PROGRESS, "Chunk was aborted!"); } @@ -482,13 +482,13 @@ public function execute(array $QUERY = array()) { switch ($state) { case DHashcatStatus::EXHAUSTED: // the chunk has finished (exhausted) - Factory::getChunkFactory()->mset($chunk, [Chunk::SPEED => 0, Chunk::PROGRESS => 10000, Chunk::CHECKPOINT => $chunk->getSkip() + $chunk->getLength()]); + $chunk = Factory::getChunkFactory()->mset($chunk, [Chunk::SPEED => 0, Chunk::PROGRESS => 10000, Chunk::CHECKPOINT => $chunk->getSkip() + $chunk->getLength()]); DServerLog::log(DServerLog::TRACE, "Chunk is exhausted (cracker status)", [$this->agent, $chunk]); break; case DHashcatStatus::CRACKED: // the chunk has finished (cracked whole hashList) // de-prioritize all tasks and un-assign all agents - Factory::getChunkFactory()->mset($chunk, [Chunk::CHECKPOINT => $chunk->getSkip() + $chunk->getLength(), Chunk::PROGRESS => 10000, Chunk::SPEED => 0]); + $chunk = Factory::getChunkFactory()->mset($chunk, [Chunk::CHECKPOINT => $chunk->getSkip() + $chunk->getLength(), Chunk::PROGRESS => 10000, Chunk::SPEED => 0]); DServerLog::log(DServerLog::TRACE, "Last hash was cracked (cracker status)", [$this->agent, $chunk]); TaskUtils::depriorizeAllTasks($hashlists); @@ -501,7 +501,7 @@ public function execute(array $QUERY = array()) { case DHashcatStatus::ABORTED: case DHashcatStatus::QUIT: // the chunk was aborted or quit - Factory::getChunkFactory()->set($chunk, Chunk::SPEED, 0); + $chunk = Factory::getChunkFactory()->set($chunk, Chunk::SPEED, 0); $this->sendErrorResponse(PActions::SEND_PROGRESS, "Chunk was aborted!"); break; case DHashcatStatus::RUNNING: @@ -515,13 +515,13 @@ public function execute(array $QUERY = array()) { NotificationHandler::checkNotifications(DNotificationType::HASHLIST_ALL_CRACKED, $payload); DServerLog::log(DServerLog::TRACE, "Agent still is running, but all hashes got cracked (all agents together), stop it", [$this->agent]); - Factory::getChunkFactory()->mset($chunk, [Chunk::CHECKPOINT => $chunk->getSkip() + $chunk->getLength(), Chunk::PROGRESS => 10000, Chunk::SPEED => 0]); + $chunk = Factory::getChunkFactory()->mset($chunk, [Chunk::CHECKPOINT => $chunk->getSkip() + $chunk->getLength(), Chunk::PROGRESS => 10000, Chunk::SPEED => 0]); TaskUtils::depriorizeAllTasks($hashlists); $qF = new QueryFilter(Assignment::TASK_ID, $task->getId(), "="); Factory::getAssignmentFactory()->massDeletion([Factory::FILTER => $qF]); - Factory::getTaskFactory()->set($task, Task::PRIORITY, 0); + $task = Factory::getTaskFactory()->set($task, Task::PRIORITY, 0); DServerLog::log(DServerLog::TRACE, "Depriorized all tasks and updated", [$this->agent, $task, $chunk, $totalHashlist]); //stop agent @@ -534,7 +534,7 @@ public function execute(array $QUERY = array()) { ) ); } - Factory::getChunkFactory()->set($chunk, Chunk::SPEED, $speed); + $chunk = Factory::getChunkFactory()->set($chunk, Chunk::SPEED, $speed); // save speed in history if ($speed > 0) { @@ -559,7 +559,7 @@ public function execute(array $QUERY = array()) { } $toZap[] = $zap->getHash(); } - Factory::getAgentFactory()->set($this->agent, Agent::LAST_TIME, time()); + $this->agent = Factory::getAgentFactory()->set($this->agent, Agent::LAST_TIME, time()); if ($agentZap->getLastZapId() > 0) { Factory::getAgentZapFactory()->update($agentZap); } diff --git a/src/inc/api/APIUpdateClientInformation.php b/src/inc/api/APIUpdateClientInformation.php index 0dad9e096..55328e4ef 100644 --- a/src/inc/api/APIUpdateClientInformation.php +++ b/src/inc/api/APIUpdateClientInformation.php @@ -34,9 +34,9 @@ public function execute(array $QUERY = array()) { // save agent details if (strlen($this->agent->getUid()) == 0 && $this->agent->getCpuOnly() == 0) { // we only update this variable on the first time, otherwise we would overwrite manual changes - Factory::getAgentFactory()->set($this->agent, Agent::CPU_ONLY, $cpuOnly); + $this->agent = Factory::getAgentFactory()->set($this->agent, Agent::CPU_ONLY, $cpuOnly); } - Factory::getAgentFactory()->mset($this->agent, [ + $this->agent = Factory::getAgentFactory()->mset($this->agent, [ Agent::DEVICES => htmlentities(implode("\n", $devices), ENT_QUOTES, "UTF-8"), Agent::UID => $uid, Agent::OS => $os diff --git a/src/inc/utils/AccessControlUtils.php b/src/inc/utils/AccessControlUtils.php index 0af5f35f3..386cd51bb 100644 --- a/src/inc/utils/AccessControlUtils.php +++ b/src/inc/utils/AccessControlUtils.php @@ -68,17 +68,17 @@ public static function updateGroupPermissions(int $groupId, array $perm): bool { $constant = $constant[0]; } if ($split[0] == $constant) { - $newArr[$constant] = ($split[1] == "1") ? true : false; + $newArr[$constant] = $split[1] == "1"; } } } - Factory::getRightGroupFactory()->set($group, RightGroup::PERMISSIONS, json_encode($newArr)); + $group = Factory::getRightGroupFactory()->set($group, RightGroup::PERMISSIONS, json_encode($newArr)); $acl = AccessControl::getInstance(null, $group->getId()); $arr = $newArr; $changes = false; foreach ($newArr as $constant => $set) { - if ($set == true) { + if ($set) { continue; } else if ($acl->givenByDependency($constant)) { diff --git a/src/inc/utils/AccountUtils.php b/src/inc/utils/AccountUtils.php index 6ddc8ac42..77158f834 100644 --- a/src/inc/utils/AccountUtils.php +++ b/src/inc/utils/AccountUtils.php @@ -109,7 +109,7 @@ public static function setEmail(string $email, User $user): void { throw new HTException("Invalid email address!"); } - Factory::getUserFactory()->set($user, User::EMAIL, $email); + $user = Factory::getUserFactory()->set($user, User::EMAIL, $email); Util::createLogEntry(DLogEntryIssuer::USER, $user->getId(), DLogEntry::INFO, "User changed email!"); } @@ -151,7 +151,7 @@ public static function changePassword(string $oldPassword, string $newPassword, $newSalt = Util::randomString(20); $newHash = Encryption::passwordHash($newPassword, $newSalt); - Factory::getUserFactory()->mset($user, [User::PASSWORD_HASH => $newHash, User::PASSWORD_SALT => $newSalt, USer::IS_COMPUTED_PASSWORD => 0]); + $user = Factory::getUserFactory()->mset($user, [User::PASSWORD_HASH => $newHash, User::PASSWORD_SALT => $newSalt, USer::IS_COMPUTED_PASSWORD => 0]); Util::createLogEntry(DLogEntryIssuer::USER, $user->getId(), DLogEntry::INFO, "User changed password!"); } diff --git a/src/inc/utils/AgentBinaryUtils.php b/src/inc/utils/AgentBinaryUtils.php index 1c9631e56..d0f06c1fb 100644 --- a/src/inc/utils/AgentBinaryUtils.php +++ b/src/inc/utils/AgentBinaryUtils.php @@ -70,9 +70,9 @@ public static function editBinary($binaryId, $type, $os, $filename, $version, $u } if ($updateTrack != $agentBinary->getUpdateTrack()) { - Factory::getAgentBinaryFactory()->set($agentBinary, AgentBinary::UPDATE_AVAILABLE, ''); + $agentBinary = Factory::getAgentBinaryFactory()->set($agentBinary, AgentBinary::UPDATE_AVAILABLE, ''); } - Factory::getAgentBinaryFactory()->mset($agentBinary, [ + $agentBinary = Factory::getAgentBinaryFactory()->mset($agentBinary, [ AgentBinary::BINARY_TYPE => $type, AgentBinary::OPERATING_SYSTEMS => $os, AgentBinary::FILENAME => $filename, @@ -87,14 +87,14 @@ public static function editBinary($binaryId, $type, $os, $filename, $version, $u public static function editUpdateTracker($binaryId, $updateTracker, $user) { $binary = AgentBinaryUtils::getBinary($binaryId); if ($updateTracker != $binary->getUpdateTrack()) { - Factory::getAgentBinaryFactory()->mset($binary, [ + $binary = Factory::getAgentBinaryFactory()->mset($binary, [ AgentBinary::UPDATE_AVAILABLE => '', AgentBinary::UPDATE_TRACK => $updateTracker ] ); } else { - Factory::getAgentBinaryFactory()->set($binary, AgentBinary::UPDATE_TRACK, $updateTracker); + $binary = Factory::getAgentBinaryFactory()->set($binary, AgentBinary::UPDATE_TRACK, $updateTracker); } Util::createLogEntry(DLogEntryIssuer::USER, $user->getId(), DLogEntry::INFO, "Binary " . $binary->getFilename() . " was updated!"); } @@ -104,7 +104,7 @@ public static function editName($binaryId, $filename, $user) { throw new HTException("Provided filename does not exist!"); } $agentBinary = AgentBinaryUtils::getBinary($binaryId); - Factory::getAgentBinaryFactory()->set($agentBinary, AgentBinary::FILENAME, $filename); + $agentBinary = Factory::getAgentBinaryFactory()->set($agentBinary, AgentBinary::FILENAME, $filename); Util::createLogEntry(DLogEntryIssuer::USER, $user->getId(), DLogEntry::INFO, "Binary " . $agentBinary->getFilename() . " was updated!"); } @@ -117,7 +117,7 @@ public static function editType($binaryId, $type, $user) { if ($result != null) { throw new HTException("You cannot have two binaries with the same type!"); } - Factory::getAgentBinaryFactory()->set($agentBinary, AgentBinary::BINARY_TYPE, $type); + $agentBinary = Factory::getAgentBinaryFactory()->set($agentBinary, AgentBinary::BINARY_TYPE, $type); Util::createLogEntry(DLogEntryIssuer::USER, $user->getId(), DLogEntry::INFO, "Binary " . $agentBinary->getFilename() . " was updated!"); } @@ -179,7 +179,7 @@ public static function executeUpgrade($binaryId) { } // update version number of agent and reset flag - Factory::getAgentBinaryFactory()->mset($agentBinary, [AgentBinary::VERSION => $agentBinary->getUpdateAvailable(), AgentBinary::UPDATE_AVAILABLE => '']); + $agentBinary = Factory::getAgentBinaryFactory()->mset($agentBinary, [AgentBinary::VERSION => $agentBinary->getUpdateAvailable(), AgentBinary::UPDATE_AVAILABLE => '']); } /** diff --git a/src/inc/utils/AgentUtils.php b/src/inc/utils/AgentUtils.php index d407ae12b..dec5269b3 100644 --- a/src/inc/utils/AgentUtils.php +++ b/src/inc/utils/AgentUtils.php @@ -431,10 +431,7 @@ public static function assign(int $agentId, int $taskId, User $user): ?Assignmen Factory::getAssignmentFactory()->delete($assignments[$i]); } $assignment = $assignments[0]; - Factory::getAssignmentFactory()->mset($assignment, [Assignment::TASK_ID => $task->getId(), Assignment::BENCHMARK => $benchmark]); - $assignment->setTaskId($task->getId()); - $assignment->setAgentId($agent->getId()); - $assignment->setBenchmark($benchmark); + $assignment = Factory::getAssignmentFactory()->mset($assignment, [Assignment::TASK_ID => $task->getId(), Assignment::BENCHMARK => $benchmark]); } else { $assignment = new Assignment(null, $task->getId(), $agent->getId(), $benchmark); @@ -500,7 +497,7 @@ public static function changeOwner($agentId, $ownerId, $user) { $agent = AgentUtils::getAgent($agentId, $user); if ($ownerId == 0) { $username = "NONE"; - Factory::getAgentFactory()->set($agent, Agent::USER_ID, null); + $agent = Factory::getAgentFactory()->set($agent, Agent::USER_ID, null); } else { if (is_numeric($ownerId)) { @@ -514,7 +511,7 @@ public static function changeOwner($agentId, $ownerId, $user) { throw new HTException("Invalid user selected!"); } $username = $user->getUsername(); - Factory::getAgentFactory()->set($agent, Agent::USER_ID, $owner->getId()); + $agent = Factory::getAgentFactory()->set($agent, Agent::USER_ID, $owner->getId()); } Util::createLogEntry(DLogEntryIssuer::USER, $user->getId(), DLogEntry::INFO, "Owner for agent " . $agent->getAgentName() . " was changed to " . $username); } diff --git a/src/inc/utils/ApiUtils.php b/src/inc/utils/ApiUtils.php index 10f69e04f..19e6cc047 100644 --- a/src/inc/utils/ApiUtils.php +++ b/src/inc/utils/ApiUtils.php @@ -71,7 +71,7 @@ public static function editKey($keyId, $userId, $groupId, $startValid, $endValid throw new HTException("Can't change key owner!"); } - Factory::getApiKeyFactory()->mset($key, [ + $key = Factory::getApiKeyFactory()->mset($key, [ ApiKey::USER_ID => $user->getId(), ApiKey::API_GROUP_ID => $group->getId(), ApiKey::START_VALID => strtotime($startValid), diff --git a/src/inc/utils/ChunkUtils.php b/src/inc/utils/ChunkUtils.php index f1eb893a6..8085a5d95 100644 --- a/src/inc/utils/ChunkUtils.php +++ b/src/inc/utils/ChunkUtils.php @@ -37,7 +37,7 @@ public static function handleExistingChunk($chunk, $task, $assignment) { if (($chunk->getCheckpoint() == $chunk->getSkip() || SConfig::getInstance()->getVal(DConfig::DISABLE_TRIMMING)) && $agentChunkSizeMax >= $chunk->getLength()) { //chunk has not started yet DServerLog::log(DServerLog::TRACE, "Chunk did not start yet and is small enough to give it to agent", [$task, $chunk, $assignment]); - Factory::getChunkFactory()->mset($chunk, [ + return Factory::getChunkFactory()->mset($chunk, [ Chunk::PROGRESS => $initialProgress, Chunk::DISPATCH_TIME => time(), Chunk::SOLVE_TIME => 0, @@ -46,14 +46,13 @@ public static function handleExistingChunk($chunk, $task, $assignment) { Chunk::SPEED => 0 ] ); - return $chunk; } else if ($chunk->getCheckpoint() == $chunk->getSkip() || SConfig::getInstance()->getVal(DConfig::DISABLE_TRIMMING)) { //split chunk into two parts DServerLog::log(DServerLog::TRACE, "Chunk has not started, but needs to be split", [$task, $chunk, $assignment]); $originalLength = $chunk->getLength(); $firstPart = $chunk; - Factory::getChunkFactory()->mset($firstPart, [ + $firstPart = Factory::getChunkFactory()->mset($firstPart, [ Chunk::LENGTH => $agentChunkSize, Chunk::AGENT_ID => $assignment->getAgentId(), Chunk::DISPATCH_TIME => time(), @@ -72,7 +71,7 @@ public static function handleExistingChunk($chunk, $task, $assignment) { DServerLog::log(DServerLog::TRACE, "Chunk was started and reached a checkpoint", [$task, $chunk, $assignment]); if ($chunk->getLength() + $chunk->getSkip() - $chunk->getCheckpoint() == 0) { // special case when remaining chunk length gets 0 - Factory::getChunkFactory()->mset($chunk, [ + $chunk = Factory::getChunkFactory()->mset($chunk, [ Chunk::PROGRESS => 10000, Chunk::STATE => DHashcatStatus::ABORTED_CHECKPOINT, Chunk::SPEED => 0 @@ -96,7 +95,7 @@ public static function handleExistingChunk($chunk, $task, $assignment) { 0 ); $newChunk = Factory::getChunkFactory()->save($newChunk); - Factory::getChunkFactory()->mset($chunk, [ + $chunk = Factory::getChunkFactory()->mset($chunk, [ Chunk::LENGTH => $chunk->getCheckpoint() - $chunk->getSkip(), Chunk::PROGRESS => 10000, Chunk::STATE => DHashcatStatus::ABORTED_CHECKPOINT, @@ -119,7 +118,7 @@ public static function createNewChunk($task, $assignment) { // if we have set a skip keyspace we set the the current progress to the skip which was set initially if ($task->getSkipKeyspace() > $task->getKeyspaceProgress()) { - Factory::getTaskFactory()->set($task, Task::KEYSPACE_PROGRESS, $task->getSkipKeyspace()); + $task = Factory::getTaskFactory()->set($task, Task::KEYSPACE_PROGRESS, $task->getSkipKeyspace()); } $remaining = $task->getKeyspace() - $task->getKeyspaceProgress(); diff --git a/src/inc/utils/ConfigUtils.php b/src/inc/utils/ConfigUtils.php index 002dc55da..3552159ab 100644 --- a/src/inc/utils/ConfigUtils.php +++ b/src/inc/utils/ConfigUtils.php @@ -193,7 +193,7 @@ public static function rebuildCache(): array { $total_cracked += $count; if ($count != $chunk->getCracked()) { $correctedChunks++; - Factory::getChunkFactory()->set($chunk, Chunk::CRACKED, $count); + $chunk = Factory::getChunkFactory()->set($chunk, Chunk::CRACKED, $count); } } if ($total_cracked != $taskWrapper->getCracked()) { @@ -218,7 +218,7 @@ public static function rebuildCache(): array { if ($count != $hashlist->getCracked()) { $correctedHashlists++; $counted = true; - Factory::getHashlistFactory()->set($hashlist, Hashlist::CRACKED, $count); + $hashlist = Factory::getHashlistFactory()->set($hashlist, Hashlist::CRACKED, $count); } $count = $hashFactory->countFilter([Factory::FILTER => $qF1]); if ($count != $hashlist->getHashCount()) { diff --git a/src/inc/utils/CrackerUtils.php b/src/inc/utils/CrackerUtils.php index 2ef945112..0b1fa3b46 100644 --- a/src/inc/utils/CrackerUtils.php +++ b/src/inc/utils/CrackerUtils.php @@ -125,7 +125,7 @@ public static function updateBinary($version, $name, $url, $binaryId) { if (strlen($version) == 0 || strlen($name) == 0 || strlen($url) == 0) { throw new HTException("Please provide all information!"); } - Factory::getCrackerBinaryFactory()->mset($binary, [ + $binary = Factory::getCrackerBinaryFactory()->mset($binary, [ CrackerBinary::BINARY_NAME => htmlentities($name, ENT_QUOTES, "UTF-8"), CrackerBinary::DOWNLOAD_URL => $url, CrackerBinary::VERSION => $version diff --git a/src/inc/utils/FileUtils.php b/src/inc/utils/FileUtils.php index 3d307e0e2..ddd7224a7 100644 --- a/src/inc/utils/FileUtils.php +++ b/src/inc/utils/FileUtils.php @@ -285,7 +285,7 @@ public static function saveChanges($fileId, $filename, $accessGroupId, $user) { if ($accessGroup == null) { throw new HTException("Invalid access group Id!"); } - Factory::getFileFactory()->set($file, File::ACCESS_GROUP_ID, $accessGroup->getId()); + $file = Factory::getFileFactory()->set($file, File::ACCESS_GROUP_ID, $accessGroup->getId()); } if ($file->getFilename() == $newName) { diff --git a/src/inc/utils/HashlistUtils.php b/src/inc/utils/HashlistUtils.php index 2a497d081..36c34bc83 100644 --- a/src/inc/utils/HashlistUtils.php +++ b/src/inc/utils/HashlistUtils.php @@ -463,7 +463,7 @@ public static function processZap($hashlistId, $separator, $source, $post, $file $crackedIn[$hashEntry->getHashlistId()]++; } - $hashFactory->mset($hashEntry, [Hash::PLAINTEXT => $plain, Hash::IS_CRACKED => 1, Hash::TIME_CRACKED => time()]); + $hashEntry = $hashFactory->mset($hashEntry, [Hash::PLAINTEXT => $plain, Hash::IS_CRACKED => 1, Hash::TIME_CRACKED => time()]); if ($hashlist->getFormat() == DHashlistFormat::PLAIN) { $zaps[] = new Zap(null, $hashEntry->getHash(), time(), null, $hashlist->getId()); @@ -514,7 +514,7 @@ public static function processZap($hashlistId, $separator, $source, $post, $file $crackedIn[$hashEntry->getHashlistId()]++; } - $hashFactory->mset($hashEntry, [Hash::PLAINTEXT => $plain, Hash::IS_CRACKED => 1, Hash::TIME_CRACKED => time()]); + $hashEntry = $hashFactory->mset($hashEntry, [Hash::PLAINTEXT => $plain, Hash::IS_CRACKED => 1, Hash::TIME_CRACKED => time()]); if ($hashlist->getFormat() == DHashlistFormat::PLAIN) { $zaps[] = new Zap(null, $hashEntry->getHash(), time(), null, $hashlist->getId()); @@ -931,7 +931,7 @@ public static function createHashlist($name, $isSalted, $isSecret, $isHexSalted, } fclose($file); unlink($tmpfile); - Factory::getHashlistFactory()->mset($hashlist, [Hashlist::HASH_COUNT => $added, Hashlist::CRACKED => $preFound]); + $hashlist = Factory::getHashlistFactory()->mset($hashlist, [Hashlist::HASH_COUNT => $added, Hashlist::CRACKED => $preFound]); Util::createLogEntry("User", $user->getId(), DLogEntry::INFO, "New Hashlist created: " . $hashlist->getHashlistName()); NotificationHandler::checkNotifications(DNotificationType::NEW_HASHLIST, new DataSet(array(DPayloadKeys::HASHLIST => $hashlist))); @@ -1002,7 +1002,7 @@ public static function createHashlist($name, $isSalted, $isSecret, $isHexSalted, fclose($file); unlink($tmpfile); - Factory::getHashlistFactory()->set($hashlist, Hashlist::HASH_COUNT, $added); + $hashlist = Factory::getHashlistFactory()->set($hashlist, Hashlist::HASH_COUNT, $added); Util::createLogEntry("User", $user->getId(), DLogEntry::INFO, "New Hashlist created: " . $hashlist->getHashlistName()); NotificationHandler::checkNotifications(DNotificationType::NEW_HASHLIST, new DataSet(array(DPayloadKeys::HASHLIST => $hashlist))); @@ -1015,7 +1015,7 @@ public static function createHashlist($name, $isSalted, $isSecret, $isHexSalted, } fclose($file); unlink($tmpfile); - Factory::getHashlistFactory()->set($hashlist, Hashlist::HASH_COUNT, 1); + $hashlist = Factory::getHashlistFactory()->set($hashlist, Hashlist::HASH_COUNT, 1); Util::createLogEntry("User", $user->getId(), DLogEntry::INFO, "New Hashlist created: " . $hashlist->getHashlistName()); NotificationHandler::checkNotifications(DNotificationType::NEW_HASHLIST, new DataSet(array(DPayloadKeys::HASHLIST => $hashlist))); diff --git a/src/inc/utils/TaskUtils.php b/src/inc/utils/TaskUtils.php index 9bb3a9643..73825de8b 100644 --- a/src/inc/utils/TaskUtils.php +++ b/src/inc/utils/TaskUtils.php @@ -1190,7 +1190,7 @@ public static function checkTask($task, $agent = null) { } if ($completed >= $task->getKeyspace()) { // task is completed, set priority to 0 - Factory::getTaskFactory()->set($task, Task::PRIORITY, 0); + $task = Factory::getTaskFactory()->set($task, Task::PRIORITY, 0); $taskWrapper = Factory::getTaskWrapperFactory()->get($task->getTaskWrapperId()); if ($taskWrapper->getTaskType() != DTaskTypes::SUPERTASK) { Factory::getTaskWrapperFactory()->set($taskWrapper, TaskWrapper::PRIORITY, 0); From 9415fe96d4a6e0eb38f5e7b0c92aa1029b94646d Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 11:35:01 +0200 Subject: [PATCH 12/19] fixed some warnings --- src/dba/AbstractModelFactory.php | 11 ++++------- src/inc/api/APISendProgress.php | 5 +++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/dba/AbstractModelFactory.php b/src/dba/AbstractModelFactory.php index 0fe2319cd..f74cdb881 100755 --- a/src/dba/AbstractModelFactory.php +++ b/src/dba/AbstractModelFactory.php @@ -226,10 +226,10 @@ private function getFilters(array $arr): array { } /** - * @param $arr array + * @param Order|Order[] $arr array * @return Order[] */ - private function getOrders(array $arr): array { + private function getOrders(Order|array $arr): array { if (!is_array($arr[Factory::ORDER])) { $arr[Factory::ORDER] = array($arr[Factory::ORDER]); } @@ -706,7 +706,7 @@ public function getFromDB($pk): ?AbstractModel { * $options[Factory::JOIN] is an array of JoinFilter options * * @param $options array containing option settings - * @return AbstractModel[]|array Returns a list of matching objects + * @return array Returns an array of matching objects * @throws Exception */ private function filterWithJoin(array $options): array { @@ -894,10 +894,7 @@ private function getAllArrayValues(&$vals, $element): void { * @return string */ private function applyOrder(Order|array $orders): string { - $orderQueries = array(); - if (!is_array($orders)) { - $orders = array($orders); - } + $orderQueries = $this->getOrders($orders); foreach ($orders as $order) { $orderQueries[] = $order->getQueryString($this, true); } diff --git a/src/inc/api/APISendProgress.php b/src/inc/api/APISendProgress.php index fa26e2514..a91a96aea 100644 --- a/src/inc/api/APISendProgress.php +++ b/src/inc/api/APISendProgress.php @@ -242,6 +242,10 @@ public function execute(array $QUERY = array()) { $split[3] = Util::strToHex($split[3]); $identifier = "WPA*%*" . implode("*", $split) . "%"; } + else{ + $skipped++; + break; + } $qF1 = new LikeFilterInsensitive(Hash::HASH, $identifier); } else { // we use the exact match for all other hashes to avoid performance loss @@ -322,6 +326,7 @@ public function execute(array $QUERY = array()) { else { // this format is used for -m 16801 $mac_ap = $split[0]; $mac_cli = $split[1]; + $essid = ""; } if (Util::startsWith($essid, '$HEX[') && Util::endsWith($essid, "]") && strlen($essid) % 2 == 0) { $essid = substr($essid, 5, strlen($essid) - 6); From 7d402bfd00e7959d61c1996332e0585f198f34ae Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 11:36:48 +0200 Subject: [PATCH 13/19] force chunk assertion --- src/inc/api/APISendProgress.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inc/api/APISendProgress.php b/src/inc/api/APISendProgress.php index a91a96aea..dde1c4d65 100644 --- a/src/inc/api/APISendProgress.php +++ b/src/inc/api/APISendProgress.php @@ -428,6 +428,7 @@ public function execute(array $QUERY = array()) { DServerLog::log(DServerLog::TRACE, "Updated with received cracks", [$this->agent, $chunk]); + assert($chunk instanceof Chunk); if ($chunk->getState() == DHashcatStatus::STATUS_ABORTED_RUNTIME) { // the chunk was manually interrupted $chunk = Factory::getChunkFactory()->set($chunk, Chunk::STATE, DHashcatStatus::ABORTED); @@ -508,7 +509,6 @@ public function execute(array $QUERY = array()) { // the chunk was aborted or quit $chunk = Factory::getChunkFactory()->set($chunk, Chunk::SPEED, 0); $this->sendErrorResponse(PActions::SEND_PROGRESS, "Chunk was aborted!"); - break; case DHashcatStatus::RUNNING: default: // the chunk isn't finished yet, we will send zaps From a4db06d9f694f584ac96be79a602e898aac0e04a Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 11:42:57 +0200 Subject: [PATCH 14/19] fixed order retrieval --- src/dba/AbstractModelFactory.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/dba/AbstractModelFactory.php b/src/dba/AbstractModelFactory.php index f74cdb881..87751a0c0 100755 --- a/src/dba/AbstractModelFactory.php +++ b/src/dba/AbstractModelFactory.php @@ -230,13 +230,10 @@ private function getFilters(array $arr): array { * @return Order[] */ private function getOrders(Order|array $arr): array { - if (!is_array($arr[Factory::ORDER])) { - $arr[Factory::ORDER] = array($arr[Factory::ORDER]); + if (!is_array($arr)) { + $arr = [$arr]; } - if (isset($arr[Factory::ORDER])) { - return $arr[Factory::ORDER]; - } - return array(); + return $arr; } /** From 196d93cb7b32dbf5b7e2f04ce887317482ecc2c4 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 11:46:29 +0200 Subject: [PATCH 15/19] remove getOrders --- src/dba/AbstractModelFactory.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/dba/AbstractModelFactory.php b/src/dba/AbstractModelFactory.php index 87751a0c0..108da152c 100755 --- a/src/dba/AbstractModelFactory.php +++ b/src/dba/AbstractModelFactory.php @@ -225,17 +225,6 @@ private function getFilters(array $arr): array { return array(); } - /** - * @param Order|Order[] $arr array - * @return Order[] - */ - private function getOrders(Order|array $arr): array { - if (!is_array($arr)) { - $arr = [$arr]; - } - return $arr; - } - /** * @param $arr array * @return Join[] @@ -891,7 +880,10 @@ private function getAllArrayValues(&$vals, $element): void { * @return string */ private function applyOrder(Order|array $orders): string { - $orderQueries = $this->getOrders($orders); + $orderQueries = array(); + if (!is_array($orders)) { + $orders = array($orders); + } foreach ($orders as $order) { $orderQueries[] = $order->getQueryString($this, true); } From b2ce16e0e7afd2c05db4b9971ee3a323b3931bf7 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 14:12:22 +0200 Subject: [PATCH 16/19] last phpstan issues should be fixed, now phpstan covers src/inc and src/dba completely --- ci/phpunit/dba/AbstractModelFactoryTest.php | 10 ++++++++-- phpstan.neon | 14 ++++++------- .../models/AbstractModelFactory.template.txt | 4 ++-- src/dba/models/AccessGroupAgentFactory.php | 4 ++-- src/dba/models/AccessGroupFactory.php | 4 ++-- src/dba/models/AccessGroupUserFactory.php | 4 ++-- src/dba/models/AgentBinaryFactory.php | 4 ++-- src/dba/models/AgentErrorFactory.php | 4 ++-- src/dba/models/AgentFactory.php | 4 ++-- src/dba/models/AgentStatFactory.php | 4 ++-- src/dba/models/AgentZapFactory.php | 4 ++-- src/dba/models/ApiGroupFactory.php | 4 ++-- src/dba/models/ApiKeyFactory.php | 4 ++-- src/dba/models/AssignmentFactory.php | 4 ++-- src/dba/models/ChunkFactory.php | 4 ++-- src/dba/models/ConfigFactory.php | 4 ++-- src/dba/models/ConfigSectionFactory.php | 4 ++-- src/dba/models/CrackerBinaryFactory.php | 4 ++-- src/dba/models/CrackerBinaryTypeFactory.php | 4 ++-- src/dba/models/FileDeleteFactory.php | 4 ++-- src/dba/models/FileDownloadFactory.php | 4 ++-- src/dba/models/FileFactory.php | 4 ++-- src/dba/models/FilePretaskFactory.php | 4 ++-- src/dba/models/FileTaskFactory.php | 4 ++-- src/dba/models/HashBinaryFactory.php | 4 ++-- src/dba/models/HashFactory.php | 4 ++-- src/dba/models/HashTypeFactory.php | 4 ++-- src/dba/models/HashlistFactory.php | 4 ++-- src/dba/models/HashlistHashlistFactory.php | 4 ++-- src/dba/models/HealthCheckAgentFactory.php | 4 ++-- src/dba/models/HealthCheckFactory.php | 4 ++-- src/dba/models/JwtApiKeyFactory.php | 4 ++-- src/dba/models/LogEntryFactory.php | 4 ++-- src/dba/models/NotificationSettingFactory.php | 4 ++-- src/dba/models/PreprocessorFactory.php | 4 ++-- src/dba/models/PretaskFactory.php | 4 ++-- src/dba/models/RegVoucherFactory.php | 4 ++-- src/dba/models/RightGroupFactory.php | 4 ++-- src/dba/models/SessionFactory.php | 4 ++-- src/dba/models/SpeedFactory.php | 4 ++-- src/dba/models/StoredValueFactory.php | 4 ++-- src/dba/models/SupertaskFactory.php | 4 ++-- src/dba/models/SupertaskPretaskFactory.php | 4 ++-- src/dba/models/TaskDebugOutputFactory.php | 4 ++-- src/dba/models/TaskFactory.php | 4 ++-- src/dba/models/TaskWrapperDisplayFactory.php | 4 ++-- src/dba/models/TaskWrapperFactory.php | 4 ++-- src/dba/models/UserFactory.php | 4 ++-- src/dba/models/ZapFactory.php | 4 ++-- src/dba/models/_sqlx_migrationsFactory.php | 4 ++-- src/inc/HTMessages.php | 2 +- src/inc/Lang.php | 2 +- src/inc/Login.php | 5 +++-- src/inc/StartupConfig.php | 1 + src/inc/UI.php | 2 +- src/inc/Util.php | 10 +++++----- src/inc/defines/DAccessControl.php | 7 +------ src/inc/defines/DConfig.php | 7 +------ src/inc/defines/UApi.php | 7 +------ src/inc/handlers/ApiHandler.php | 2 -- src/inc/handlers/HashlistHandler.php | 5 +---- src/inc/handlers/SearchHandler.php | 6 +++--- .../notifications/HashtopolisNotification.php | 3 +-- src/inc/templating/Template.php | 6 +----- src/inc/user_api/UserAPIAccess.php | 4 ++-- src/inc/user_api/UserAPIBasic.php | 1 + src/inc/user_api/UserAPIHashlist.php | 2 +- src/inc/user_api/UserAPIPretask.php | 2 +- src/inc/user_api/UserAPISupertask.php | 2 ++ src/inc/utils/AccessUtils.php | 6 ++---- src/inc/utils/AgentUtils.php | 2 +- src/inc/utils/ApiUtils.php | 2 +- src/inc/utils/ChunkUtils.php | 11 +++++----- src/inc/utils/ConfigUtils.php | 2 +- src/inc/utils/CrackerBinaryUtils.php | 2 +- src/inc/utils/HashlistUtils.php | 12 +++++------ src/inc/utils/LockUtils.php | 2 +- src/inc/utils/PreprocessorUtils.php | 6 +++--- src/inc/utils/SupertaskUtils.php | 4 ++-- src/inc/utils/TaskUtils.php | 20 +++++++++---------- src/inc/utils/TaskWrapperUtils.php | 2 +- 81 files changed, 172 insertions(+), 191 deletions(-) diff --git a/ci/phpunit/dba/AbstractModelFactoryTest.php b/ci/phpunit/dba/AbstractModelFactoryTest.php index e3cd70899..24b58f277 100644 --- a/ci/phpunit/dba/AbstractModelFactoryTest.php +++ b/ci/phpunit/dba/AbstractModelFactoryTest.php @@ -306,7 +306,7 @@ public function testSetRefreshesModel(): void { $hashType = $this->createDatabaseObject(Factory::getHashTypeFactory(), new HashType(null, 'placeholder', 0, 0)); $this->assertInstanceOf(HashType::class, $hashType); $originalObject = $hashType; - Factory::getHashTypeFactory()->set($hashType, HashType::IS_SALTED, 1); + $hashType = Factory::getHashTypeFactory()->set($hashType, HashType::IS_SALTED, 1); $this->assertNotSame($originalObject, $hashType); $this->assertEquals(1, $hashType->getIsSalted()); $this->assertEquals(0, $hashType->getIsSlowHash()); @@ -322,7 +322,7 @@ public function testMsetRefreshesModel(): void { $hashType = $this->createDatabaseObject(Factory::getHashTypeFactory(), new HashType(null, 'placeholder', 0, 0)); $this->assertInstanceOf(HashType::class, $hashType); $originalObject = $hashType; - Factory::getHashTypeFactory()->mset($hashType, [HashType::IS_SALTED => 1, HashType::IS_SLOW_HASH => 1]); + $hashType = Factory::getHashTypeFactory()->mset($hashType, [HashType::IS_SALTED => 1, HashType::IS_SLOW_HASH => 1]); $this->assertNotSame($originalObject, $hashType); $this->assertEquals(1, $hashType->getIsSalted()); $this->assertEquals(1, $hashType->getIsSlowHash()); @@ -367,11 +367,13 @@ public function testIncSuccessTwoObjects(): void { Factory::getHashTypeFactory()->inc($hashType1, HashType::IS_SALTED, 2); + $this->assertTrue($hashType1 instanceof HashType); $this->assertEquals(3, $hashType1->getIsSalted()); $this->assertEquals(1, $hashType2->getIsSalted()); Factory::getHashTypeFactory()->inc($hashType2, HashType::IS_SALTED, 20); + $this->assertTrue($hashType2 instanceof HashType); $this->assertEquals(23, $hashType2->getIsSalted()); $hashTypeUpdated = Factory::getHashTypeFactory()->get($hashType1->getId()); @@ -441,11 +443,13 @@ public function testDecSuccessTwoObjects(): void { Factory::getHashTypeFactory()->dec($hashType1, HashType::IS_SALTED, 2); + $this->assertTrue($hashType1 instanceof HashType); $this->assertEquals(48, $hashType1->getIsSalted()); $this->assertEquals(50, $hashType2->getIsSalted()); Factory::getHashTypeFactory()->dec($hashType2, HashType::IS_SALTED, 20); + $this->assertTrue($hashType2 instanceof HashType); $this->assertEquals(28, $hashType2->getIsSalted()); $hashTypeUpdated = Factory::getHashTypeFactory()->get($hashType1->getId()); @@ -1349,6 +1353,7 @@ public function testFilterWithJoinOverrideOwnFactory(): void { $accessGroup = $this->createDatabaseObject(Factory::getAccessGroupFactory(), new AccessGroup(null, 'ag_' . $testId)); $this->createDatabaseObject(Factory::getFileFactory(), new File(null, 'file_' . $testId, 1, 0, 0, $accessGroup->getId(), 1)); + $this->assertTrue($accessGroup instanceof AccessGroup); $qF = new QueryFilter(AccessGroup::GROUP_NAME, $accessGroup->getGroupName(), '=', Factory::getAccessGroupFactory()); $jF = new JoinFilter( @@ -1375,6 +1380,7 @@ public function testFilterWithJoinQueryFilters(): void { $accessGroup = $this->createDatabaseObject(Factory::getAccessGroupFactory(), new AccessGroup(null, 'ag_' . $testId)); $this->createDatabaseObject(Factory::getFileFactory(), new File(null, 'file1_' . $testId, 1, 0, 0, $accessGroup->getId(), 1)); $this->createDatabaseObject(Factory::getFileFactory(), new File(null, 'file2_' . $testId, 2, 0, 0, $accessGroup->getId(), 1)); + $this->assertTrue($accessGroup instanceof AccessGroup); $qF = new QueryFilter(AccessGroup::GROUP_NAME, $accessGroup->getGroupName(), '=', Factory::getAccessGroupFactory()); $jF = new JoinFilter( diff --git a/phpstan.neon b/phpstan.neon index eaacc12f8..d76f06f9c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,14 +1,12 @@ parameters: paths: - src/inc/apiv2 - - ci/phpunit - - src/dba - - src/inc/api - level: 4 - treatPhpDocTypesAsCertain: false - scanDirectories: - src/dba - src/inc + - ci/phpunit + level: 4 + treatPhpDocTypesAsCertain: false excludePaths: - # Exclude the DBA tests due PHPStan doing weird complaints - - ci/phpunit/dba/AbstractModelFactoryTest.php \ No newline at end of file + # this is deprecated/legacy and will not be touched until remove + - src/inc/Auth_Yubico.php + - src/inc/Login.php \ No newline at end of file diff --git a/src/dba/models/AbstractModelFactory.template.txt b/src/dba/models/AbstractModelFactory.template.txt index 341956132..bbc131f60 100644 --- a/src/dba/models/AbstractModelFactory.template.txt +++ b/src/dba/models/AbstractModelFactory.template.txt @@ -89,10 +89,10 @@ class __MODEL_NAME__Factory extends AbstractModelFactory { /** * @param __MODEL_NAME__ $model - * @return __MODEL_NAME__ + * @return ?__MODEL_NAME__ * @throws Exception */ - function save($model): __MODEL_NAME__ { + function save($model): ?__MODEL_NAME__ { return Util::cast(parent::save($model), __MODEL_NAME__::class); } diff --git a/src/dba/models/AccessGroupAgentFactory.php b/src/dba/models/AccessGroupAgentFactory.php index 3322d64d4..23e77dc73 100644 --- a/src/dba/models/AccessGroupAgentFactory.php +++ b/src/dba/models/AccessGroupAgentFactory.php @@ -89,10 +89,10 @@ function get($pk): ?AccessGroupAgent { /** * @param AccessGroupAgent $model - * @return AccessGroupAgent + * @return ?AccessGroupAgent * @throws Exception */ - function save($model): AccessGroupAgent { + function save($model): ?AccessGroupAgent { return Util::cast(parent::save($model), AccessGroupAgent::class); } diff --git a/src/dba/models/AccessGroupFactory.php b/src/dba/models/AccessGroupFactory.php index 6d1ae8693..a493b106d 100644 --- a/src/dba/models/AccessGroupFactory.php +++ b/src/dba/models/AccessGroupFactory.php @@ -89,10 +89,10 @@ function get($pk): ?AccessGroup { /** * @param AccessGroup $model - * @return AccessGroup + * @return ?AccessGroup * @throws Exception */ - function save($model): AccessGroup { + function save($model): ?AccessGroup { return Util::cast(parent::save($model), AccessGroup::class); } diff --git a/src/dba/models/AccessGroupUserFactory.php b/src/dba/models/AccessGroupUserFactory.php index 2a761ff52..f74582457 100644 --- a/src/dba/models/AccessGroupUserFactory.php +++ b/src/dba/models/AccessGroupUserFactory.php @@ -89,10 +89,10 @@ function get($pk): ?AccessGroupUser { /** * @param AccessGroupUser $model - * @return AccessGroupUser + * @return ?AccessGroupUser * @throws Exception */ - function save($model): AccessGroupUser { + function save($model): ?AccessGroupUser { return Util::cast(parent::save($model), AccessGroupUser::class); } diff --git a/src/dba/models/AgentBinaryFactory.php b/src/dba/models/AgentBinaryFactory.php index 6dab048a8..9d4860608 100644 --- a/src/dba/models/AgentBinaryFactory.php +++ b/src/dba/models/AgentBinaryFactory.php @@ -89,10 +89,10 @@ function get($pk): ?AgentBinary { /** * @param AgentBinary $model - * @return AgentBinary + * @return ?AgentBinary * @throws Exception */ - function save($model): AgentBinary { + function save($model): ?AgentBinary { return Util::cast(parent::save($model), AgentBinary::class); } diff --git a/src/dba/models/AgentErrorFactory.php b/src/dba/models/AgentErrorFactory.php index c9c04f9ed..83ea3028c 100644 --- a/src/dba/models/AgentErrorFactory.php +++ b/src/dba/models/AgentErrorFactory.php @@ -89,10 +89,10 @@ function get($pk): ?AgentError { /** * @param AgentError $model - * @return AgentError + * @return ?AgentError * @throws Exception */ - function save($model): AgentError { + function save($model): ?AgentError { return Util::cast(parent::save($model), AgentError::class); } diff --git a/src/dba/models/AgentFactory.php b/src/dba/models/AgentFactory.php index e989094ba..9910f23b7 100644 --- a/src/dba/models/AgentFactory.php +++ b/src/dba/models/AgentFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Agent { /** * @param Agent $model - * @return Agent + * @return ?Agent * @throws Exception */ - function save($model): Agent { + function save($model): ?Agent { return Util::cast(parent::save($model), Agent::class); } diff --git a/src/dba/models/AgentStatFactory.php b/src/dba/models/AgentStatFactory.php index 5f9c523fc..2e391a18e 100644 --- a/src/dba/models/AgentStatFactory.php +++ b/src/dba/models/AgentStatFactory.php @@ -89,10 +89,10 @@ function get($pk): ?AgentStat { /** * @param AgentStat $model - * @return AgentStat + * @return ?AgentStat * @throws Exception */ - function save($model): AgentStat { + function save($model): ?AgentStat { return Util::cast(parent::save($model), AgentStat::class); } diff --git a/src/dba/models/AgentZapFactory.php b/src/dba/models/AgentZapFactory.php index eed62fc95..839f7909f 100644 --- a/src/dba/models/AgentZapFactory.php +++ b/src/dba/models/AgentZapFactory.php @@ -89,10 +89,10 @@ function get($pk): ?AgentZap { /** * @param AgentZap $model - * @return AgentZap + * @return ?AgentZap * @throws Exception */ - function save($model): AgentZap { + function save($model): ?AgentZap { return Util::cast(parent::save($model), AgentZap::class); } diff --git a/src/dba/models/ApiGroupFactory.php b/src/dba/models/ApiGroupFactory.php index d74658067..8349ec3d4 100644 --- a/src/dba/models/ApiGroupFactory.php +++ b/src/dba/models/ApiGroupFactory.php @@ -89,10 +89,10 @@ function get($pk): ?ApiGroup { /** * @param ApiGroup $model - * @return ApiGroup + * @return ?ApiGroup * @throws Exception */ - function save($model): ApiGroup { + function save($model): ?ApiGroup { return Util::cast(parent::save($model), ApiGroup::class); } diff --git a/src/dba/models/ApiKeyFactory.php b/src/dba/models/ApiKeyFactory.php index 42ab0f80e..4eb56b15e 100644 --- a/src/dba/models/ApiKeyFactory.php +++ b/src/dba/models/ApiKeyFactory.php @@ -89,10 +89,10 @@ function get($pk): ?ApiKey { /** * @param ApiKey $model - * @return ApiKey + * @return ?ApiKey * @throws Exception */ - function save($model): ApiKey { + function save($model): ?ApiKey { return Util::cast(parent::save($model), ApiKey::class); } diff --git a/src/dba/models/AssignmentFactory.php b/src/dba/models/AssignmentFactory.php index 9dc6ba936..dc1fc0f2b 100644 --- a/src/dba/models/AssignmentFactory.php +++ b/src/dba/models/AssignmentFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Assignment { /** * @param Assignment $model - * @return Assignment + * @return ?Assignment * @throws Exception */ - function save($model): Assignment { + function save($model): ?Assignment { return Util::cast(parent::save($model), Assignment::class); } diff --git a/src/dba/models/ChunkFactory.php b/src/dba/models/ChunkFactory.php index 0a2f9e5d6..bcbc5e585 100644 --- a/src/dba/models/ChunkFactory.php +++ b/src/dba/models/ChunkFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Chunk { /** * @param Chunk $model - * @return Chunk + * @return ?Chunk * @throws Exception */ - function save($model): Chunk { + function save($model): ?Chunk { return Util::cast(parent::save($model), Chunk::class); } diff --git a/src/dba/models/ConfigFactory.php b/src/dba/models/ConfigFactory.php index bf570395f..2cdd5c928 100644 --- a/src/dba/models/ConfigFactory.php +++ b/src/dba/models/ConfigFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Config { /** * @param Config $model - * @return Config + * @return ?Config * @throws Exception */ - function save($model): Config { + function save($model): ?Config { return Util::cast(parent::save($model), Config::class); } diff --git a/src/dba/models/ConfigSectionFactory.php b/src/dba/models/ConfigSectionFactory.php index 0311d7f90..33a4da170 100644 --- a/src/dba/models/ConfigSectionFactory.php +++ b/src/dba/models/ConfigSectionFactory.php @@ -89,10 +89,10 @@ function get($pk): ?ConfigSection { /** * @param ConfigSection $model - * @return ConfigSection + * @return ?ConfigSection * @throws Exception */ - function save($model): ConfigSection { + function save($model): ?ConfigSection { return Util::cast(parent::save($model), ConfigSection::class); } diff --git a/src/dba/models/CrackerBinaryFactory.php b/src/dba/models/CrackerBinaryFactory.php index 3d903e81d..7d9e805ca 100644 --- a/src/dba/models/CrackerBinaryFactory.php +++ b/src/dba/models/CrackerBinaryFactory.php @@ -89,10 +89,10 @@ function get($pk): ?CrackerBinary { /** * @param CrackerBinary $model - * @return CrackerBinary + * @return ?CrackerBinary * @throws Exception */ - function save($model): CrackerBinary { + function save($model): ?CrackerBinary { return Util::cast(parent::save($model), CrackerBinary::class); } diff --git a/src/dba/models/CrackerBinaryTypeFactory.php b/src/dba/models/CrackerBinaryTypeFactory.php index 4fa64fe10..210287580 100644 --- a/src/dba/models/CrackerBinaryTypeFactory.php +++ b/src/dba/models/CrackerBinaryTypeFactory.php @@ -89,10 +89,10 @@ function get($pk): ?CrackerBinaryType { /** * @param CrackerBinaryType $model - * @return CrackerBinaryType + * @return ?CrackerBinaryType * @throws Exception */ - function save($model): CrackerBinaryType { + function save($model): ?CrackerBinaryType { return Util::cast(parent::save($model), CrackerBinaryType::class); } diff --git a/src/dba/models/FileDeleteFactory.php b/src/dba/models/FileDeleteFactory.php index ccbd36804..0315fd23e 100644 --- a/src/dba/models/FileDeleteFactory.php +++ b/src/dba/models/FileDeleteFactory.php @@ -89,10 +89,10 @@ function get($pk): ?FileDelete { /** * @param FileDelete $model - * @return FileDelete + * @return ?FileDelete * @throws Exception */ - function save($model): FileDelete { + function save($model): ?FileDelete { return Util::cast(parent::save($model), FileDelete::class); } diff --git a/src/dba/models/FileDownloadFactory.php b/src/dba/models/FileDownloadFactory.php index 1579754d6..97b216a27 100644 --- a/src/dba/models/FileDownloadFactory.php +++ b/src/dba/models/FileDownloadFactory.php @@ -89,10 +89,10 @@ function get($pk): ?FileDownload { /** * @param FileDownload $model - * @return FileDownload + * @return ?FileDownload * @throws Exception */ - function save($model): FileDownload { + function save($model): ?FileDownload { return Util::cast(parent::save($model), FileDownload::class); } diff --git a/src/dba/models/FileFactory.php b/src/dba/models/FileFactory.php index 341220545..1c45a9686 100644 --- a/src/dba/models/FileFactory.php +++ b/src/dba/models/FileFactory.php @@ -89,10 +89,10 @@ function get($pk): ?File { /** * @param File $model - * @return File + * @return ?File * @throws Exception */ - function save($model): File { + function save($model): ?File { return Util::cast(parent::save($model), File::class); } diff --git a/src/dba/models/FilePretaskFactory.php b/src/dba/models/FilePretaskFactory.php index 9cc53a793..dbfb39cb7 100644 --- a/src/dba/models/FilePretaskFactory.php +++ b/src/dba/models/FilePretaskFactory.php @@ -89,10 +89,10 @@ function get($pk): ?FilePretask { /** * @param FilePretask $model - * @return FilePretask + * @return ?FilePretask * @throws Exception */ - function save($model): FilePretask { + function save($model): ?FilePretask { return Util::cast(parent::save($model), FilePretask::class); } diff --git a/src/dba/models/FileTaskFactory.php b/src/dba/models/FileTaskFactory.php index 2577a2ecf..a0a7a3e29 100644 --- a/src/dba/models/FileTaskFactory.php +++ b/src/dba/models/FileTaskFactory.php @@ -89,10 +89,10 @@ function get($pk): ?FileTask { /** * @param FileTask $model - * @return FileTask + * @return ?FileTask * @throws Exception */ - function save($model): FileTask { + function save($model): ?FileTask { return Util::cast(parent::save($model), FileTask::class); } diff --git a/src/dba/models/HashBinaryFactory.php b/src/dba/models/HashBinaryFactory.php index 2a3f213c5..3a4ed6276 100644 --- a/src/dba/models/HashBinaryFactory.php +++ b/src/dba/models/HashBinaryFactory.php @@ -89,10 +89,10 @@ function get($pk): ?HashBinary { /** * @param HashBinary $model - * @return HashBinary + * @return ?HashBinary * @throws Exception */ - function save($model): HashBinary { + function save($model): ?HashBinary { return Util::cast(parent::save($model), HashBinary::class); } diff --git a/src/dba/models/HashFactory.php b/src/dba/models/HashFactory.php index 36801d87a..aa9dead38 100644 --- a/src/dba/models/HashFactory.php +++ b/src/dba/models/HashFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Hash { /** * @param Hash $model - * @return Hash + * @return ?Hash * @throws Exception */ - function save($model): Hash { + function save($model): ?Hash { return Util::cast(parent::save($model), Hash::class); } diff --git a/src/dba/models/HashTypeFactory.php b/src/dba/models/HashTypeFactory.php index a7699169b..8149c12da 100644 --- a/src/dba/models/HashTypeFactory.php +++ b/src/dba/models/HashTypeFactory.php @@ -89,10 +89,10 @@ function get($pk): ?HashType { /** * @param HashType $model - * @return HashType + * @return ?HashType * @throws Exception */ - function save($model): HashType { + function save($model): ?HashType { return Util::cast(parent::save($model), HashType::class); } diff --git a/src/dba/models/HashlistFactory.php b/src/dba/models/HashlistFactory.php index 62f77de11..363977f73 100644 --- a/src/dba/models/HashlistFactory.php +++ b/src/dba/models/HashlistFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Hashlist { /** * @param Hashlist $model - * @return Hashlist + * @return ?Hashlist * @throws Exception */ - function save($model): Hashlist { + function save($model): ?Hashlist { return Util::cast(parent::save($model), Hashlist::class); } diff --git a/src/dba/models/HashlistHashlistFactory.php b/src/dba/models/HashlistHashlistFactory.php index 6d9f8deb5..ee013d808 100644 --- a/src/dba/models/HashlistHashlistFactory.php +++ b/src/dba/models/HashlistHashlistFactory.php @@ -89,10 +89,10 @@ function get($pk): ?HashlistHashlist { /** * @param HashlistHashlist $model - * @return HashlistHashlist + * @return ?HashlistHashlist * @throws Exception */ - function save($model): HashlistHashlist { + function save($model): ?HashlistHashlist { return Util::cast(parent::save($model), HashlistHashlist::class); } diff --git a/src/dba/models/HealthCheckAgentFactory.php b/src/dba/models/HealthCheckAgentFactory.php index bfe402c73..84a424441 100644 --- a/src/dba/models/HealthCheckAgentFactory.php +++ b/src/dba/models/HealthCheckAgentFactory.php @@ -90,10 +90,10 @@ function get($pk): ?HealthCheckAgent { /** * @param HealthCheckAgent $model - * @return HealthCheckAgent + * @return ?HealthCheckAgent * @throws Exception */ - function save($model): HealthCheckAgent { + function save($model): ?HealthCheckAgent { return Util::cast(parent::save($model), HealthCheckAgent::class); } diff --git a/src/dba/models/HealthCheckFactory.php b/src/dba/models/HealthCheckFactory.php index c97ae9548..4a8aa8afa 100644 --- a/src/dba/models/HealthCheckFactory.php +++ b/src/dba/models/HealthCheckFactory.php @@ -89,10 +89,10 @@ function get($pk): ?HealthCheck { /** * @param HealthCheck $model - * @return HealthCheck + * @return ?HealthCheck * @throws Exception */ - function save($model): HealthCheck { + function save($model): ?HealthCheck { return Util::cast(parent::save($model), HealthCheck::class); } diff --git a/src/dba/models/JwtApiKeyFactory.php b/src/dba/models/JwtApiKeyFactory.php index 9de1b0460..420f1dafa 100644 --- a/src/dba/models/JwtApiKeyFactory.php +++ b/src/dba/models/JwtApiKeyFactory.php @@ -89,10 +89,10 @@ function get($pk): ?JwtApiKey { /** * @param JwtApiKey $model - * @return JwtApiKey + * @return ?JwtApiKey * @throws Exception */ - function save($model): JwtApiKey { + function save($model): ?JwtApiKey { return Util::cast(parent::save($model), JwtApiKey::class); } diff --git a/src/dba/models/LogEntryFactory.php b/src/dba/models/LogEntryFactory.php index e7ebfe21e..caab53abd 100644 --- a/src/dba/models/LogEntryFactory.php +++ b/src/dba/models/LogEntryFactory.php @@ -89,10 +89,10 @@ function get($pk): ?LogEntry { /** * @param LogEntry $model - * @return LogEntry + * @return ?LogEntry * @throws Exception */ - function save($model): LogEntry { + function save($model): ?LogEntry { return Util::cast(parent::save($model), LogEntry::class); } diff --git a/src/dba/models/NotificationSettingFactory.php b/src/dba/models/NotificationSettingFactory.php index d09b9e77b..c488c81b0 100644 --- a/src/dba/models/NotificationSettingFactory.php +++ b/src/dba/models/NotificationSettingFactory.php @@ -89,10 +89,10 @@ function get($pk): ?NotificationSetting { /** * @param NotificationSetting $model - * @return NotificationSetting + * @return ?NotificationSetting * @throws Exception */ - function save($model): NotificationSetting { + function save($model): ?NotificationSetting { return Util::cast(parent::save($model), NotificationSetting::class); } diff --git a/src/dba/models/PreprocessorFactory.php b/src/dba/models/PreprocessorFactory.php index 78dbb2214..d235e02bd 100644 --- a/src/dba/models/PreprocessorFactory.php +++ b/src/dba/models/PreprocessorFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Preprocessor { /** * @param Preprocessor $model - * @return Preprocessor + * @return ?Preprocessor * @throws Exception */ - function save($model): Preprocessor { + function save($model): ?Preprocessor { return Util::cast(parent::save($model), Preprocessor::class); } diff --git a/src/dba/models/PretaskFactory.php b/src/dba/models/PretaskFactory.php index 8c9c919f1..d49ef45ac 100644 --- a/src/dba/models/PretaskFactory.php +++ b/src/dba/models/PretaskFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Pretask { /** * @param Pretask $model - * @return Pretask + * @return ?Pretask * @throws Exception */ - function save($model): Pretask { + function save($model): ?Pretask { return Util::cast(parent::save($model), Pretask::class); } diff --git a/src/dba/models/RegVoucherFactory.php b/src/dba/models/RegVoucherFactory.php index 4b3d5b092..57c3f7f7b 100644 --- a/src/dba/models/RegVoucherFactory.php +++ b/src/dba/models/RegVoucherFactory.php @@ -89,10 +89,10 @@ function get($pk): ?RegVoucher { /** * @param RegVoucher $model - * @return RegVoucher + * @return ?RegVoucher * @throws Exception */ - function save($model): RegVoucher { + function save($model): ?RegVoucher { return Util::cast(parent::save($model), RegVoucher::class); } diff --git a/src/dba/models/RightGroupFactory.php b/src/dba/models/RightGroupFactory.php index cecf969b7..b38a9569f 100644 --- a/src/dba/models/RightGroupFactory.php +++ b/src/dba/models/RightGroupFactory.php @@ -89,10 +89,10 @@ function get($pk): ?RightGroup { /** * @param RightGroup $model - * @return RightGroup + * @return ?RightGroup * @throws Exception */ - function save($model): RightGroup { + function save($model): ?RightGroup { return Util::cast(parent::save($model), RightGroup::class); } diff --git a/src/dba/models/SessionFactory.php b/src/dba/models/SessionFactory.php index 8c94942de..bc5769625 100644 --- a/src/dba/models/SessionFactory.php +++ b/src/dba/models/SessionFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Session { /** * @param Session $model - * @return Session + * @return ?Session * @throws Exception */ - function save($model): Session { + function save($model): ?Session { return Util::cast(parent::save($model), Session::class); } diff --git a/src/dba/models/SpeedFactory.php b/src/dba/models/SpeedFactory.php index b87010382..63fec7a64 100644 --- a/src/dba/models/SpeedFactory.php +++ b/src/dba/models/SpeedFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Speed { /** * @param Speed $model - * @return Speed + * @return ?Speed * @throws Exception */ - function save($model): Speed { + function save($model): ?Speed { return Util::cast(parent::save($model), Speed::class); } diff --git a/src/dba/models/StoredValueFactory.php b/src/dba/models/StoredValueFactory.php index ee131ffe3..518f5d2df 100644 --- a/src/dba/models/StoredValueFactory.php +++ b/src/dba/models/StoredValueFactory.php @@ -89,10 +89,10 @@ function get($pk): ?StoredValue { /** * @param StoredValue $model - * @return StoredValue + * @return ?StoredValue * @throws Exception */ - function save($model): StoredValue { + function save($model): ?StoredValue { return Util::cast(parent::save($model), StoredValue::class); } diff --git a/src/dba/models/SupertaskFactory.php b/src/dba/models/SupertaskFactory.php index d309f3f59..5f7c94f3e 100644 --- a/src/dba/models/SupertaskFactory.php +++ b/src/dba/models/SupertaskFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Supertask { /** * @param Supertask $model - * @return Supertask + * @return ?Supertask * @throws Exception */ - function save($model): Supertask { + function save($model): ?Supertask { return Util::cast(parent::save($model), Supertask::class); } diff --git a/src/dba/models/SupertaskPretaskFactory.php b/src/dba/models/SupertaskPretaskFactory.php index 4e2c64534..23076a9e7 100644 --- a/src/dba/models/SupertaskPretaskFactory.php +++ b/src/dba/models/SupertaskPretaskFactory.php @@ -89,10 +89,10 @@ function get($pk): ?SupertaskPretask { /** * @param SupertaskPretask $model - * @return SupertaskPretask + * @return ?SupertaskPretask * @throws Exception */ - function save($model): SupertaskPretask { + function save($model): ?SupertaskPretask { return Util::cast(parent::save($model), SupertaskPretask::class); } diff --git a/src/dba/models/TaskDebugOutputFactory.php b/src/dba/models/TaskDebugOutputFactory.php index 944e0db88..5b5173566 100644 --- a/src/dba/models/TaskDebugOutputFactory.php +++ b/src/dba/models/TaskDebugOutputFactory.php @@ -89,10 +89,10 @@ function get($pk): ?TaskDebugOutput { /** * @param TaskDebugOutput $model - * @return TaskDebugOutput + * @return ?TaskDebugOutput * @throws Exception */ - function save($model): TaskDebugOutput { + function save($model): ?TaskDebugOutput { return Util::cast(parent::save($model), TaskDebugOutput::class); } diff --git a/src/dba/models/TaskFactory.php b/src/dba/models/TaskFactory.php index fc1e24ba6..9887c02b6 100644 --- a/src/dba/models/TaskFactory.php +++ b/src/dba/models/TaskFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Task { /** * @param Task $model - * @return Task + * @return ?Task * @throws Exception */ - function save($model): Task { + function save($model): ?Task { return Util::cast(parent::save($model), Task::class); } diff --git a/src/dba/models/TaskWrapperDisplayFactory.php b/src/dba/models/TaskWrapperDisplayFactory.php index 30f8082f8..ef31548a9 100644 --- a/src/dba/models/TaskWrapperDisplayFactory.php +++ b/src/dba/models/TaskWrapperDisplayFactory.php @@ -89,10 +89,10 @@ function get($pk): ?TaskWrapperDisplay { /** * @param TaskWrapperDisplay $model - * @return TaskWrapperDisplay + * @return ?TaskWrapperDisplay * @throws Exception */ - function save($model): TaskWrapperDisplay { + function save($model): ?TaskWrapperDisplay { return Util::cast(parent::save($model), TaskWrapperDisplay::class); } diff --git a/src/dba/models/TaskWrapperFactory.php b/src/dba/models/TaskWrapperFactory.php index 7c08b655c..a6ac47d5f 100644 --- a/src/dba/models/TaskWrapperFactory.php +++ b/src/dba/models/TaskWrapperFactory.php @@ -89,10 +89,10 @@ function get($pk): ?TaskWrapper { /** * @param TaskWrapper $model - * @return TaskWrapper + * @return ?TaskWrapper * @throws Exception */ - function save($model): TaskWrapper { + function save($model): ?TaskWrapper { return Util::cast(parent::save($model), TaskWrapper::class); } diff --git a/src/dba/models/UserFactory.php b/src/dba/models/UserFactory.php index d91d104bd..7bdd2217e 100644 --- a/src/dba/models/UserFactory.php +++ b/src/dba/models/UserFactory.php @@ -89,10 +89,10 @@ function get($pk): ?User { /** * @param User $model - * @return User + * @return ?User * @throws Exception */ - function save($model): User { + function save($model): ?User { return Util::cast(parent::save($model), User::class); } diff --git a/src/dba/models/ZapFactory.php b/src/dba/models/ZapFactory.php index ae1f8b486..6df221673 100644 --- a/src/dba/models/ZapFactory.php +++ b/src/dba/models/ZapFactory.php @@ -89,10 +89,10 @@ function get($pk): ?Zap { /** * @param Zap $model - * @return Zap + * @return ?Zap * @throws Exception */ - function save($model): Zap { + function save($model): ?Zap { return Util::cast(parent::save($model), Zap::class); } diff --git a/src/dba/models/_sqlx_migrationsFactory.php b/src/dba/models/_sqlx_migrationsFactory.php index f5858cfa7..c4d8b79e2 100644 --- a/src/dba/models/_sqlx_migrationsFactory.php +++ b/src/dba/models/_sqlx_migrationsFactory.php @@ -94,10 +94,10 @@ function get($pk): ?_sqlx_migrations { /** * @param _sqlx_migrations $model - * @return _sqlx_migrations + * @return ?_sqlx_migrations * @throws Exception */ - function save($model): _sqlx_migrations { + function save($model): ?_sqlx_migrations { return Util::cast(parent::save($model), _sqlx_migrations::class); } diff --git a/src/inc/HTMessages.php b/src/inc/HTMessages.php index 7ff9e6547..7f2233704 100644 --- a/src/inc/HTMessages.php +++ b/src/inc/HTMessages.php @@ -10,7 +10,7 @@ class HTMessages extends Exception { public function __construct($message = "", $code = 0, ?Throwable $previous = NULL) { $this->arr = $message; - $this->message = implode("\n", $this->arr); + parent::__construct(implode("\n", $this->arr), $code, $previous); } public function getHTMLMessage() { diff --git a/src/inc/Lang.php b/src/inc/Lang.php index cf70795b9..841721484 100755 --- a/src/inc/Lang.php +++ b/src/inc/Lang.php @@ -126,7 +126,7 @@ public function getNumAvailableLanguages() { * Get the written name of a given language name. * * @param string $name name identifier of language - * @return string containing the name, false if language is not found + * @return string|bool containing the name, false if language is not found */ public function getLanguageName($name) { if (isset($this->langArr[$name]['name'])) { diff --git a/src/inc/Login.php b/src/inc/Login.php index 48e7f791d..5f62765db 100755 --- a/src/inc/Login.php +++ b/src/inc/Login.php @@ -15,6 +15,7 @@ use Hashtopolis\inc\handlers\NotificationHandler; use Hashtopolis\inc\SConfig; use Hashtopolis\inc\Util; +use function PHPUnit\Framework\assertNotNull; /** * Handles the login sessions @@ -24,8 +25,7 @@ class Login { private $user = null; private $valid = false; - /** @var Session $session */ - private $session = null; + private ?Session $session = null; private static $instance = null; @@ -85,6 +85,7 @@ public function isLoggedin() { * Logs the current user out and closes his session */ public function logout() { + assertNotNull($this->session); Factory::getSessionFactory()->set($this->session, Session::IS_OPEN, 0); $this->session = null; $this->user = null; diff --git a/src/inc/StartupConfig.php b/src/inc/StartupConfig.php index 0465f9e1d..d8f97f751 100644 --- a/src/inc/StartupConfig.php +++ b/src/inc/StartupConfig.php @@ -149,6 +149,7 @@ private function loadLegacyConfig(): void { // this is either an existing setup, or a new setup without docker include(dirname(__FILE__) . "/conf.php"); + /** @var array{user: string, pass: string, db: string, server: string, port: string} $CONN */ // check if directories is set, otherwise set the defaults for it if (!isset($DIRECTORIES)) { diff --git a/src/inc/UI.php b/src/inc/UI.php index 6e04fd9a0..cd70130c9 100644 --- a/src/inc/UI.php +++ b/src/inc/UI.php @@ -50,7 +50,7 @@ public static function addMessage($type, $message): void { public static function getNumMessages($type = "ALL"): int { $count = 0; foreach (self::$objects['messages'] as $message) { - /** @var $message DataSet */ + /** @var DataSet $message */ if ($message->getVal('type') == $type || $type == "ALL") { $count++; } diff --git a/src/inc/Util.php b/src/inc/Util.php index 9e1835e17..db4b490c5 100755 --- a/src/inc/Util.php +++ b/src/inc/Util.php @@ -143,7 +143,7 @@ public static function getSpeedDataSet($taskId, $limit = 50, $agentId = 0, $delt $first = $entries[0]->getTime(); foreach ($entries as $entry) { - $pos = $limit - 1 - floor(($first - $entry->getTime()) / $delta); + $pos = intval($limit - 1 - floor(($first - $entry->getTime()) / $delta)); if ($pos < 0) { continue; // too old entry } @@ -155,7 +155,7 @@ public static function getSpeedDataSet($taskId, $limit = 50, $agentId = 0, $delt } // prepare with timestamps - $first = round($first, -log10($delta)); + $first = intval(round($first, -log10($delta))); $timestampData = []; foreach ($data as $key => $val) { $timestampData[$first - ($limit - 1 - $key) * $delta] = $val; @@ -484,7 +484,7 @@ public static function getFileInfo($task, $accessGroups) { $qF = new QueryFilter(FileTask::TASK_ID, $task->getId(), "=", Factory::getFileTaskFactory()); $jF = new JoinFilter(Factory::getFileTaskFactory(), FileTask::FILE_ID, File::FILE_ID); $joinedFiles = Factory::getFileFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $files File[] */ + /** @var File[] $files */ $files = $joinedFiles[Factory::getFileFactory()->getModelName()]; $sizeFiles = 0; $fileSecret = false; @@ -528,7 +528,7 @@ public static function getAccessGroupIds($userId) { $qF = new QueryFilter(AccessGroupUser::USER_ID, $userId, "=", Factory::getAccessGroupUserFactory()); $jF = new JoinFilter(Factory::getAccessGroupUserFactory(), AccessGroup::ACCESS_GROUP_ID, AccessGroupUser::ACCESS_GROUP_ID); $joined = Factory::getAccessGroupFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $accessGroups AccessGroup[] */ + /** @var AccessGroup[] $accessGroups */ $accessGroups = $joined[Factory::getAccessGroupFactory()->getModelName()]; return Util::arrayOfIds($accessGroups); } @@ -929,7 +929,7 @@ public static function tickdone($prog, $total) { public static function getUsernameById($id) { $user = Factory::getUserFactory()->get($id); if ($user === null) { - return "Unknown" . (strlen($id) > 0) ? "-$id" : ""; + return "Unknown" . ((strlen("" . $id) > 0) ? "-$id" : ""); } return $user->getUsername(); } diff --git a/src/inc/defines/DAccessControl.php b/src/inc/defines/DAccessControl.php index c563c93f7..5a0b32e58 100644 --- a/src/inc/defines/DAccessControl.php +++ b/src/inc/defines/DAccessControl.php @@ -37,12 +37,7 @@ class DAccessControl { const LOGIN_ACCESS = "loginAccess"; static function getConstants() { - try { - $oClass = new ReflectionClass(__CLASS__); - } - catch (ReflectionException $e) { - die("Exception: " . $e->getMessage()); - } + $oClass = new ReflectionClass(__CLASS__); return $oClass->getConstants(); } diff --git a/src/inc/defines/DConfig.php b/src/inc/defines/DConfig.php index 8dac65937..cc9892440 100644 --- a/src/inc/defines/DConfig.php +++ b/src/inc/defines/DConfig.php @@ -83,12 +83,7 @@ class DConfig { const NOTIFICATIONS_PROXY_TYPE = "notificationsProxyType"; static function getConstants() { - try { - $oClass = new ReflectionClass(__CLASS__); - } - catch (ReflectionException $e) { - die("Exception: " . $e->getMessage()); - } + $oClass = new ReflectionClass(__CLASS__); return $oClass->getConstants(); } diff --git a/src/inc/defines/UApi.php b/src/inc/defines/UApi.php index d506a5ef4..f6786f8f1 100644 --- a/src/inc/defines/UApi.php +++ b/src/inc/defines/UApi.php @@ -9,12 +9,7 @@ abstract class UApi { abstract function describe($constant); static function getConstants() { - try { - $oClass = new ReflectionClass(static::class); - } - catch (ReflectionException $e) { - die("Exception: " . $e->getMessage()); - } + $oClass = new ReflectionClass(static::class); return $oClass->getConstants(); } diff --git a/src/inc/handlers/ApiHandler.php b/src/inc/handlers/ApiHandler.php index b0289b2ad..f2f31c32e 100644 --- a/src/inc/handlers/ApiHandler.php +++ b/src/inc/handlers/ApiHandler.php @@ -8,8 +8,6 @@ use Hashtopolis\inc\UI; class ApiHandler implements Handler { - private $user; - public function __construct($id = null) { // nothing } diff --git a/src/inc/handlers/HashlistHandler.php b/src/inc/handlers/HashlistHandler.php index d53bd33af..b79b69df3 100644 --- a/src/inc/handlers/HashlistHandler.php +++ b/src/inc/handlers/HashlistHandler.php @@ -16,10 +16,7 @@ use Hashtopolis\inc\Util; class HashlistHandler implements Handler { - /** - * @var Hashlist $hashlist - */ - private $hashlist; + private ?Hashlist $hashlist; public function __construct($hashlistId = null) { if ($hashlistId == null) { diff --git a/src/inc/handlers/SearchHandler.php b/src/inc/handlers/SearchHandler.php index 4f5a31d43..e12b98938 100644 --- a/src/inc/handlers/SearchHandler.php +++ b/src/inc/handlers/SearchHandler.php @@ -86,7 +86,7 @@ private function search() { $qF1 = new LikeFilterInsensitive(Hash::PLAINTEXT, "%" . $queryEntry . "%"); $qF2 = new ContainFilter(Hash::HASHLIST_ID, Util::arrayOfIds($userHashlists), Factory::getHashFactory()); $joined2 = Factory::getHashFactory()->filter([Factory::FILTER => [$qF1, $qF2], Factory::JOIN => $jF]); - /** @var $hashes Hash[] */ + /** @var Hash[] $hashes */ $hashes = $joined2[Factory::getHashFactory()->getModelName()]; for ($i = 0; $i < sizeof($hashes); $i++) { $joined[Factory::getHashFactory()->getModelName()][] = $joined2[Factory::getHashFactory()->getModelName()][$i]; @@ -94,7 +94,7 @@ private function search() { } $resultEntry = new DataSet(); - /** @var $hashes Hash[] */ + /** @var Hash[] $hashes */ $hashes = $joined[Factory::getHashFactory()->getModelName()]; if (sizeof($hashes) == 0) { $resultEntry->addValue("found", false); @@ -105,7 +105,7 @@ private function search() { $resultEntry->addValue("query", $queryEntry); $matches = array(); for ($i = 0; $i < sizeof($hashes); $i++) { - /** @var $hash Hash */ + /** @var Hash $hash */ $hash = $joined[Factory::getHashFactory()->getModelName()][$i]; $matches[] = $hash; if ($hashlists->getVal($hash->getHashlistId()) == false) { diff --git a/src/inc/notifications/HashtopolisNotification.php b/src/inc/notifications/HashtopolisNotification.php index d0a53c04f..99423bdef 100644 --- a/src/inc/notifications/HashtopolisNotification.php +++ b/src/inc/notifications/HashtopolisNotification.php @@ -16,8 +16,7 @@ abstract class HashtopolisNotification { public static $name; protected $receiver; - /** @var $notification NotificationSetting */ - protected $notification; + protected NotificationSetting $notification; private static $instances = []; diff --git a/src/inc/templating/Template.php b/src/inc/templating/Template.php index 4e7a6814f..3e40c7ce5 100644 --- a/src/inc/templating/Template.php +++ b/src/inc/templating/Template.php @@ -32,7 +32,7 @@ public function __construct($template, $direct = false) { if (ini_get("display_errors") == 1) { echo "ERROR: Template $template not found!\n"; } - return false; + return; } } $this->content = file_get_contents($path); @@ -42,7 +42,6 @@ public function __construct($template, $direct = false) { $this->resolveDependencies(); $parsed = $this->parse($this->content); $this->statements = $parsed[0]; - return true; } public function getContent() { @@ -324,9 +323,6 @@ private function resolveDependencies() { switch ($command[0]) { case "TEMPLATE": $tmp = new Template($command[1]); - if ($tmp === false) { - return false; - } $tmp->resolveDependencies(); $render = $tmp->getContent(); if ($render === false) { diff --git a/src/inc/user_api/UserAPIAccess.php b/src/inc/user_api/UserAPIAccess.php index f13e26fdf..50e25c12e 100644 --- a/src/inc/user_api/UserAPIAccess.php +++ b/src/inc/user_api/UserAPIAccess.php @@ -4,8 +4,8 @@ use Hashtopolis\inc\utils\AccessControlUtils; use Throwable; -use Hashtopolis\inc\apiv2\common\error\HttpConflict; -use Hashtopolis\inc\apiv2\common\error\HttpError; +use Hashtopolis\inc\apiv2\error\HttpConflict; +use Hashtopolis\inc\apiv2\error\HttpError; use Hashtopolis\inc\defines\UQuery; use Hashtopolis\inc\defines\UQueryAccess; use Hashtopolis\inc\defines\UQueryTask; diff --git a/src/inc/user_api/UserAPIBasic.php b/src/inc/user_api/UserAPIBasic.php index d544bc5a8..7b8af0c69 100644 --- a/src/inc/user_api/UserAPIBasic.php +++ b/src/inc/user_api/UserAPIBasic.php @@ -6,6 +6,7 @@ use Hashtopolis\dba\models\ApiKey; use Hashtopolis\dba\QueryFilter; use Hashtopolis\dba\Factory; +use Hashtopolis\inc\agent\PValues; use Hashtopolis\inc\defines\UQuery; use Hashtopolis\inc\defines\UQueryTask; use Hashtopolis\inc\defines\UResponse; diff --git a/src/inc/user_api/UserAPIHashlist.php b/src/inc/user_api/UserAPIHashlist.php index 22083e5a5..7a54be0a4 100644 --- a/src/inc/user_api/UserAPIHashlist.php +++ b/src/inc/user_api/UserAPIHashlist.php @@ -149,7 +149,7 @@ private function generateWordlist($QUERY) { throw new HTException("Invalid query!"); } $arr = HashlistUtils::createWordlists($QUERY[UQueryHashlist::HASHLIST_ID], $this->user); - /** @var $file File */ + /** @var File $file */ $file = $arr[2]; $response = [ UResponseHashlist::SECTION => $QUERY[UQueryHashlist::SECTION], diff --git a/src/inc/user_api/UserAPIPretask.php b/src/inc/user_api/UserAPIPretask.php index 4528fb43d..df17b4d95 100644 --- a/src/inc/user_api/UserAPIPretask.php +++ b/src/inc/user_api/UserAPIPretask.php @@ -150,7 +150,7 @@ private function setPretaskMaxAgents($QUERY) { if (!isset($QUERY[UQueryTask::PRETASK_ID]) || !isset($QUERY[UQueryTask::PRETASK_MAX_AGENTS])) { throw new HTException("Invalid query!"); } - PretaskUtils::setMaxAgents($QUERY[UQueryTask::PRETASK_ID], $QUERY[UQueryTask::PRETASK_MAX_AGENTS], $this->user); + PretaskUtils::setMaxAgents($QUERY[UQueryTask::PRETASK_ID], $QUERY[UQueryTask::PRETASK_MAX_AGENTS]); $this->sendSuccessResponse($QUERY); } diff --git a/src/inc/user_api/UserAPISupertask.php b/src/inc/user_api/UserAPISupertask.php index 9bbc9d952..53352a153 100644 --- a/src/inc/user_api/UserAPISupertask.php +++ b/src/inc/user_api/UserAPISupertask.php @@ -93,6 +93,7 @@ private function bulkSupertask($QUERY) { $QUERY[UQueryTask::SUPERTASK_NAME], $QUERY[UQueryTask::TASK_ATTACKCMD], $QUERY[UQueryTask::TASK_CPU_ONLY], + 0, $QUERY[UQueryTask::TASK_SMALL], $QUERY[UQueryTask::TASK_CRACKER_TYPE], $QUERY[UQueryTask::TASK_BENCHTYPE], @@ -125,6 +126,7 @@ private function importSupertask($QUERY) { SupertaskUtils::importSupertask( $QUERY[UQueryTask::SUPERTASK_NAME], $QUERY[UQueryTask::TASK_CPU_ONLY], + 0, $QUERY[UQueryTask::TASK_SMALL], $QUERY[UQueryTask::TASK_OPTIMIZED], $QUERY[UQueryTask::TASK_CRACKER_TYPE], diff --git a/src/inc/utils/AccessUtils.php b/src/inc/utils/AccessUtils.php index 81929d40a..ae6fb18a0 100644 --- a/src/inc/utils/AccessUtils.php +++ b/src/inc/utils/AccessUtils.php @@ -78,13 +78,13 @@ public static function userCanAccessAgent(Agent $agent, User $user): bool { $qF = new QueryFilter(AccessGroupAgent::AGENT_ID, $agent->getId(), "=", Factory::getAccessGroupAgentFactory()); $jF = new JoinFilter(Factory::getAccessGroupAgentFactory(), AccessGroup::ACCESS_GROUP_ID, AccessGroupAgent::ACCESS_GROUP_ID); $joined = Factory::getAccessGroupFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $accessGroupsAgent AccessGroup[] */ + /** @var AccessGroup[] $accessGroupsAgent */ $accessGroupsAgent = $joined[Factory::getAccessGroupFactory()->getModelName()]; $qF = new QueryFilter(AccessGroupUser::USER_ID, $user->getId(), "=", Factory::getAccessGroupUserFactory()); $jF = new JoinFilter(Factory::getAccessGroupUserFactory(), AccessGroup::ACCESS_GROUP_ID, AccessGroupUser::ACCESS_GROUP_ID); $joined = Factory::getAccessGroupFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $accessGroupsUser AccessGroup[] */ + /** @var AccessGroup[] $accessGroupsUser */ $accessGroupsUser = $joined[Factory::getAccessGroupFactory()->getModelName()]; return sizeof(AccessUtils::intersection($accessGroupsAgent, $accessGroupsUser)) > 0; @@ -145,7 +145,6 @@ public static function getAccessGroupsOfUser(User $user): array { $qF = new QueryFilter(AccessGroupUser::USER_ID, $user->getId(), "=", Factory::getAccessGroupUserFactory()); $jF = new JoinFilter(Factory::getAccessGroupUserFactory(), AccessGroup::ACCESS_GROUP_ID, AccessGroupUser::ACCESS_GROUP_ID); $joined = Factory::getAccessGroupFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $accessGroupsUser AccessGroup[] */ return $joined[Factory::getAccessGroupFactory()->getModelName()]; } @@ -157,7 +156,6 @@ public static function getAccessGroupsOfAgent(Agent $agent): array { $qF = new QueryFilter(AccessGroupAgent::AGENT_ID, $agent->getId(), "=", Factory::getAccessGroupAgentFactory()); $jF = new JoinFilter(Factory::getAccessGroupAgentFactory(), AccessGroup::ACCESS_GROUP_ID, AccessGroupAgent::ACCESS_GROUP_ID); $joined = Factory::getAccessGroupFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $accessGroupsUser AccessGroup[] */ return $joined[Factory::getAccessGroupFactory()->getModelName()]; } diff --git a/src/inc/utils/AgentUtils.php b/src/inc/utils/AgentUtils.php index dec5269b3..d4c2266fe 100644 --- a/src/inc/utils/AgentUtils.php +++ b/src/inc/utils/AgentUtils.php @@ -390,7 +390,7 @@ public static function deleteDependencies($agent) { public static function assign(int $agentId, int $taskId, User $user): ?Assignment { $agent = AgentUtils::getAgent($agentId, $user); - if ($taskId == 0 || empty($taskId)) { // unassign + if ($taskId == 0) { // unassign $qF = new QueryFilter(Agent::AGENT_ID, $agent->getId(), "="); Factory::getAssignmentFactory()->massDeletion([Factory::FILTER => $qF]); if (isset($_GET['task'])) { diff --git a/src/inc/utils/ApiUtils.php b/src/inc/utils/ApiUtils.php index 19e6cc047..89dbe67f4 100644 --- a/src/inc/utils/ApiUtils.php +++ b/src/inc/utils/ApiUtils.php @@ -67,7 +67,7 @@ public static function editKey($keyId, $userId, $groupId, $startValid, $endValid else if ($group == null) { throw new HTException("Invalid API group selected!"); } - else if (MASK_API_KEYS && ($key->getUserId() != $userId)) { + else if (($key->getUserId() != $userId)) { throw new HTException("Can't change key owner!"); } diff --git a/src/inc/utils/ChunkUtils.php b/src/inc/utils/ChunkUtils.php index 8085a5d95..4530014d9 100644 --- a/src/inc/utils/ChunkUtils.php +++ b/src/inc/utils/ChunkUtils.php @@ -132,6 +132,7 @@ public static function createNewChunk($task, $assignment) { $length = $remaining; } Factory::getTaskFactory()->inc($task, Task::KEYSPACE_PROGRESS, $length); + assert($task instanceof Task); $initialProgress = ($task->getUsePreprocessor() || $task->getForcePipe()) ? null : 0; $chunk = new Chunk(null, $task->getId(), $start, $length, $assignment->getAgentId(), time(), 0, $start, $initialProgress, DHashcatStatus::INIT, 0, 0); $chunk = Factory::getChunkFactory()->save($chunk); @@ -169,7 +170,7 @@ public static function calculateChunkSize($keyspace, $benchmark, $chunkTime, $to else if ($chunkSize > 10000) { // just protection to avoid millions or whatever chunk number throw new HTException("Too large number of static chunks, most likely because of misconfiguration!"); } - return ceil($keyspace / $chunkSize); + return intval(ceil($keyspace / $chunkSize)); default: throw new HTException("Unknown static chunking method!"); } @@ -182,7 +183,7 @@ public static function calculateChunkSize($keyspace, $benchmark, $chunkTime, $to return $keyspace; } - $size = floor($keyspace * $benchmark * $chunkTime / 100); + $size = floor($keyspace * floatval($benchmark) * $chunkTime / 100); } else { // new benchmarking method @@ -193,8 +194,8 @@ public static function calculateChunkSize($keyspace, $benchmark, $chunkTime, $to } // NEW VARIANT - $factor = $chunkTime / $benchmark[1] * 1000; - $size = floor($factor * $benchmark[0]); + $factor = $chunkTime / floatval($benchmark[1]) * 1000; + $size = floor($factor * floatval($benchmark[0])); } $chunkSize = $size * $tolerance; @@ -207,6 +208,6 @@ public static function calculateChunkSize($keyspace, $benchmark, $chunkTime, $to Util::createLogEntry("API", $QUERY[PQuery::TOKEN], DLogEntry::WARN, "Calculated chunk size was 0 on benchmark $benchmark!"); } - return $chunkSize; + return intval($chunkSize); } } \ No newline at end of file diff --git a/src/inc/utils/ConfigUtils.php b/src/inc/utils/ConfigUtils.php index 3552159ab..6f436e572 100644 --- a/src/inc/utils/ConfigUtils.php +++ b/src/inc/utils/ConfigUtils.php @@ -181,7 +181,7 @@ public static function rebuildCache(): array { $jF = new JoinFilter(Factory::getTaskFactory(), Task::TASK_ID, Chunk::TASK_ID, Factory::getChunkFactory()); $qF = new QueryFilter(Task::TASK_WRAPPER_ID, $taskWrapper->getId(), "=", Factory::getTaskFactory()); $joined = Factory::getChunkFactory()->filter([Factory::JOIN => $jF, Factory::FILTER => $qF]); - /** @var $chunks Chunk[] */ + /** @var Chunk[] $chunks */ $chunks = $joined[Factory::getChunkFactory()->getModelName()]; $total_cracked = 0; diff --git a/src/inc/utils/CrackerBinaryUtils.php b/src/inc/utils/CrackerBinaryUtils.php index 721ffb80f..b6306ec0f 100644 --- a/src/inc/utils/CrackerBinaryUtils.php +++ b/src/inc/utils/CrackerBinaryUtils.php @@ -18,7 +18,7 @@ class CrackerBinaryUtils { public static function getNewestVersion($crackerBinaryTypeId) { $qF = new QueryFilter(CrackerBinary::CRACKER_BINARY_TYPE_ID, $crackerBinaryTypeId, "="); $binaries = Factory::getCrackerBinaryFactory()->filter([Factory::FILTER => $qF]); - /** @var $newest CrackerBinary */ + /** @var ?CrackerBinary $newest */ $newest = null; foreach ($binaries as $binary) { if ($newest == null || Comparator::greaterThan($binary->getVersion(), $newest->getVersion())) { diff --git a/src/inc/utils/HashlistUtils.php b/src/inc/utils/HashlistUtils.php index 36c34bc83..601d1d916 100644 --- a/src/inc/utils/HashlistUtils.php +++ b/src/inc/utils/HashlistUtils.php @@ -60,7 +60,7 @@ public static function editNotes($hashlistId, $notes, $user) { /** * @param string $hash * @param User $user - * @return Hash + * @return ?Hash * @throws HTException */ public static function getHash($hash, $user) { @@ -258,10 +258,10 @@ public static function setSecret($hashlistId, $isSecret, $user) { $jF2 = new JoinFilter(Factory::getTaskWrapperFactory(), Task::TASK_WRAPPER_ID, TaskWrapper::TASK_WRAPPER_ID, Factory::getTaskWrapperFactory()); $jF3 = new JoinFilter(Factory::getHashlistFactory(), Hashlist::HASHLIST_ID, TaskWrapper::HASHLIST_ID, Factory::getTaskWrapperFactory()); $joined = Factory::getAssignmentFactory()->filter([Factory::JOIN => [$jF1, $jF2, $jF3]]); - /** @var $assignments Assignment[] */ + /** @var Assignment[] $assignments */ $assignments = $joined[Factory::getAssignmentFactory()->getModelName()]; for ($x = 0; $x < sizeof($assignments); $x++) { - /** @var $hashlist Hashlist */ + /** @var Hashlist $hashlist */ $hashlist = $joined[Factory::getHashlistFactory()->getModelName()][$x]; if ($hashlist->getId() == $hashlist->getId()) { Factory::getAssignmentFactory()->delete($joined[Factory::getAssignmentFactory()->getModelName()][$x]); @@ -272,7 +272,7 @@ public static function setSecret($hashlistId, $isSecret, $user) { /** * @param int $hashlistId - * @param int $isSecret + * @param $isArchived * @param User $user * @throws HTException */ @@ -588,13 +588,13 @@ public static function delete($hashlistId, $user) { $qF = new QueryFilter(HashlistHashlist::HASHLIST_ID, $hashlist->getId(), "=", Factory::getHashlistHashlistFactory()); $jF = new JoinFilter(Factory::getHashlistFactory(), HashlistHashlist::PARENT_HASHLIST_ID, Hashlist::HASHLIST_ID, Factory::getHashlistHashlistFactory()); $joined = Factory::getHashlistHashlistFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $superHashlists Hashlist[] */ $superHashlists = $joined[Factory::getHashlistFactory()->getModelName()]; $toDelete = []; foreach ($superHashlists as $superHashlist) { Factory::getHashlistFactory()->dec($superHashlist, Hashlist::HASH_COUNT, $hashlist->getHashCount()); Factory::getHashlistFactory()->dec($superHashlist, Hashlist::CRACKED, $hashlist->getCracked()); + /** @var Hashlist $superHashlist */ if ($superHashlist->getHashCount() <= 0) { // this superhashlist has no hashlist which belongs to it anymore -> delete it $toDelete[] = $superHashlist; @@ -1197,7 +1197,7 @@ public static function changeAccessGroup($hashlistId, $accessGroupId, $user) { } $qF = new QueryFilter(Hashlist::HASHLIST_ID, $hashlist->getId(), "="); - $uS = new UpdateSet(Hashlist::ACCESS_GROUP_ID, $accessGroup->getId(), "="); + $uS = new UpdateSet(Hashlist::ACCESS_GROUP_ID, $accessGroup->getId()); Factory::getHashlistFactory()->massUpdate([Factory::FILTER => $qF, Factory::UPDATE => $uS]); $qF = new QueryFilter(TaskWrapper::HASHLIST_ID, $hashlist->getId(), "="); diff --git a/src/inc/utils/LockUtils.php b/src/inc/utils/LockUtils.php index 3da4fb669..06e19cac4 100644 --- a/src/inc/utils/LockUtils.php +++ b/src/inc/utils/LockUtils.php @@ -5,7 +5,7 @@ use Exception; class LockUtils { - /** @var $locks Lock[] */ + /** @var Lock[] $locks */ private static $locks = array(); /** diff --git a/src/inc/utils/PreprocessorUtils.php b/src/inc/utils/PreprocessorUtils.php index 3dab2b497..18759a693 100644 --- a/src/inc/utils/PreprocessorUtils.php +++ b/src/inc/utils/PreprocessorUtils.php @@ -138,7 +138,7 @@ public static function editBinaryName($preprocessorId, $binaryName) { public static function editKeyspaceCommand($preprocessorId, $keyspaceCommand) { if (strlen($keyspaceCommand) == 0) { - $keyspaceCommand == null; + $keyspaceCommand = null; } else if (Util::containsBlacklistedChars($keyspaceCommand)) { throw new HTException("The keyspace command must contain no blacklisted characters!"); @@ -156,7 +156,7 @@ public static function editKeyspaceCommand($preprocessorId, $keyspaceCommand) { public static function editSkipCommand($preprocessorId, $skipCommand) { if (strlen($skipCommand) == 0) { - $skipCommand == null; + $skipCommand = null; } else if (Util::containsBlacklistedChars($skipCommand)) { throw new HTException("The skip command must contain no blacklisted characters!"); @@ -174,7 +174,7 @@ public static function editSkipCommand($preprocessorId, $skipCommand) { public static function editLimitCommand($preprocessorId, $limitCommand) { if (strlen($limitCommand) == 0) { - $limitCommand == null; + $limitCommand = null; } else if (Util::containsBlacklistedChars($limitCommand)) { throw new HTException("The limit command must contain no blacklisted characters!"); diff --git a/src/inc/utils/SupertaskUtils.php b/src/inc/utils/SupertaskUtils.php index baad0c265..e77f7841a 100644 --- a/src/inc/utils/SupertaskUtils.php +++ b/src/inc/utils/SupertaskUtils.php @@ -170,7 +170,7 @@ public static function deleteSupertask($supertaskId) { $joinedTasks = Factory::getPretaskFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); Factory::getSupertaskPretaskFactory()->massDeletion([Factory::FILTER => $qF]); - /** @var $pretasks Pretask[] */ + /** @var Pretask[] $pretasks */ $pretasks = $joinedTasks[Factory::getPretaskFactory()->getModelName()]; foreach ($pretasks as $pretask) { @@ -268,7 +268,7 @@ public static function runSupertask($supertaskId, $hashlistId, $crackerId) { $qF = new QueryFilter(SupertaskPretask::SUPERTASK_ID, $supertask->getId(), "=", Factory::getSupertaskPretaskFactory()); $jF = new JoinFilter(Factory::getSupertaskPretaskFactory(), Pretask::PRETASK_ID, SupertaskPretask::PRETASK_ID); $joined = Factory::getPretaskFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $pretasks Pretask[] */ + /** @var Pretask[] $pretasks */ $pretasks = $joined[Factory::getPretaskFactory()->getModelName()]; Factory::getAgentFactory()->getDB()->beginTransaction(); diff --git a/src/inc/utils/TaskUtils.php b/src/inc/utils/TaskUtils.php index 73825de8b..6e3a05154 100644 --- a/src/inc/utils/TaskUtils.php +++ b/src/inc/utils/TaskUtils.php @@ -497,7 +497,7 @@ public static function changeChunkTime($taskId, $chunkTime, $user) { $qF = new QueryFilter(Assignment::TASK_ID, $task->getId(), "=", Factory::getTaskFactory()); $jF = new JoinFilter(Factory::getTaskFactory(), Task::TASK_ID, Assignment::TASK_ID); $join = Factory::getAssignmentFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $assignments Assignment[] */ + /** @var Assignment[] $assignments */ $assignments = $join[Factory::getAssignmentFactory()->getModelName()]; foreach ($assignments as $assignment) { if ($task->getUseNewBench() == 0) { @@ -743,7 +743,7 @@ public static function updateStatusTimer($taskId, $statusTimer, $user) { } $statusTimer = intval($statusTimer); - if ($statusTimer <= 0 || !is_numeric($statusTimer)) { + if ($statusTimer <= 0) { throw new HTException("Invalid status interval!"); } if ($statusTimer > $task->getChunkTime()) { @@ -757,7 +757,7 @@ public static function updateStatusTimer($taskId, $statusTimer, $user) { * @param int $taskId * @param int $priority * @param User $user - * @param bool $top + * @param bool $topPriority * @throws HTException */ public static function updatePriority($taskId, $priority, $user, $topPriority = false) { @@ -894,8 +894,8 @@ public static function createTask($hashlistId, $name, $attackCmd, $chunkTime, $s if ($priority < 0) { $priority = 0; } - if ($usePreprocessor && $benchtype == 'runtime') { - // enforce speed benchmark type when using PRINCE + if ($usePreprocessor && $benchtype == 0) { + // enforce speed benchmark type when using preprocessor $benchtype = 'speed'; } @@ -948,7 +948,7 @@ public static function createTask($hashlistId, $name, $attackCmd, $chunkTime, $s /** * @param $agent Agent * @param bool $all set true to get all matching tasks for this agent - * @return Task|Task[] + * @return Task|Task[]|null */ public static function getBestTask($agent, $all = false) { $allTasks = array(); @@ -957,7 +957,7 @@ public static function getBestTask($agent, $all = false) { $qF = new QueryFilter(AccessGroupAgent::AGENT_ID, $agent->getId(), "=", Factory::getAccessGroupAgentFactory()); $jF = new JoinFilter(Factory::getAccessGroupAgentFactory(), AccessGroup::ACCESS_GROUP_ID, AccessGroupAgent::ACCESS_GROUP_ID); $joined = Factory::getAccessGroupFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $accessGroupAgent AccessGroup[] */ + /** @var AccessGroup[] $accessGroupAgent */ $accessGroupAgent = $joined[Factory::getAccessGroupFactory()->getModelName()]; $accessGroups = Util::arrayOfIds($accessGroupAgent); @@ -1095,7 +1095,7 @@ public static function deleteTask($task) { $files = $joined[Factory::getFileFactory()->getModelName()]; $toDelete = []; foreach ($files as $file) { - /** @var $file File */ + /** @var File $file */ if ($file->getFileType() == DFileType::TEMPORARY) { unlink(Factory::getStoredValueFactory()->get(DDirectories::FILES)->getVal() . "/" . $file->getFilename()); $toDelete[] = $file; @@ -1147,7 +1147,7 @@ public static function getChunk($chunkId, $user) { * * @param $task Task * @param $agent Agent - * @return Task null if the task is completed or fully dispatched + * @return Task|null null if the task is completed or fully dispatched */ public static function checkTask($task, $agent = null) { if ($task->getIsArchived() == 1) { @@ -1267,7 +1267,6 @@ public static function getFilesOfTask($task) { $qF = new QueryFilter(FileTask::TASK_ID, $task->getId(), "=", Factory::getFileTaskFactory()); $jF = new JoinFilter(Factory::getFileTaskFactory(), File::FILE_ID, FileTask::FILE_ID); $joined = Factory::getFileFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $files File[] */ return $joined[Factory::getFileFactory()->getModelName()]; } @@ -1279,7 +1278,6 @@ public static function getFilesOfPretask($pretask) { $qF = new QueryFilter(FilePretask::PRETASK_ID, $pretask->getId(), "=", Factory::getFilePretaskFactory()); $jF = new JoinFilter(Factory::getFilePretaskFactory(), File::FILE_ID, FilePretask::FILE_ID); $joined = Factory::getFileFactory()->filter([Factory::FILTER => $qF, Factory::JOIN => $jF]); - /** @var $files File[] */ return $joined[Factory::getFileFactory()->getModelName()]; } diff --git a/src/inc/utils/TaskWrapperUtils.php b/src/inc/utils/TaskWrapperUtils.php index fb7095298..5f7490eca 100644 --- a/src/inc/utils/TaskWrapperUtils.php +++ b/src/inc/utils/TaskWrapperUtils.php @@ -47,7 +47,7 @@ public static function updatePriority($taskWrapperId, $priority, $user) { TaskUtils::setSupertaskPriority($taskWrapperId, $priority, $user); break; default: - assert(False, "Internal Error: taskType not recognized"); + throw new HttpError("Internal Error: taskType not recognized"); } } } From 4ba560741b2ab026547ff07b5ecf779af31751b5 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 14:27:39 +0200 Subject: [PATCH 17/19] fixed test and removed test which is not needed anymore as the tested issues are fixed --- ci/phpunit/inc/UtilTest.php | 2 +- ci/phpunit/inc/utils/ChunkUtilsTest.php | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/ci/phpunit/inc/UtilTest.php b/ci/phpunit/inc/UtilTest.php index 8cb976216..0a33763a5 100644 --- a/ci/phpunit/inc/UtilTest.php +++ b/ci/phpunit/inc/UtilTest.php @@ -762,7 +762,7 @@ public function testGetUsernameById(): void { */ public function testGetUsernameByIdNotFound(): void { $result = Util::getUsernameById(99999999); - $this->assertEquals("-99999999", $result); + $this->assertEquals("Unknown-99999999", $result); } /** diff --git a/ci/phpunit/inc/utils/ChunkUtilsTest.php b/ci/phpunit/inc/utils/ChunkUtilsTest.php index 946ba2215..7ad6f88ac 100644 --- a/ci/phpunit/inc/utils/ChunkUtilsTest.php +++ b/ci/phpunit/inc/utils/ChunkUtilsTest.php @@ -97,13 +97,6 @@ public static function invalidBenchmarkCases(): array { ]; } - // Verifies that a benchmark string with no colon routes to the old-benchmark - // path and PHP 8 throws TypeError on arithmetic with a non-numeric string. - public function testOldBenchmarkNonNumericStringThrowsTypeError(): void { - $this->expectException(\TypeError::class); - ChunkUtils::calculateChunkSize(1000000, 'invalid', 60); - } - // Verifies the safety floor: when the formula produces a size <= 0 the result // is clamped to 1 so dispatching never stalls on an infinite zero-size loop. // $QUERY must be set because the clamp path calls Util::createLogEntry which From 84c648058d3f407abfdfe00cbef421a6bcc2f134 Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 14:55:21 +0200 Subject: [PATCH 18/19] fixed enforcing of bench type --- src/inc/utils/TaskUtils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inc/utils/TaskUtils.php b/src/inc/utils/TaskUtils.php index 6e3a05154..5fad03e14 100644 --- a/src/inc/utils/TaskUtils.php +++ b/src/inc/utils/TaskUtils.php @@ -896,7 +896,7 @@ public static function createTask($hashlistId, $name, $attackCmd, $chunkTime, $s } if ($usePreprocessor && $benchtype == 0) { // enforce speed benchmark type when using preprocessor - $benchtype = 'speed'; + $benchtype = 1; } Factory::getAgentFactory()->getDB()->beginTransaction(); From f8c18a64f249ed2690ac6ab0d44c1154872a926f Mon Sep 17 00:00:00 2001 From: s3inlc Date: Fri, 3 Jul 2026 15:04:33 +0200 Subject: [PATCH 19/19] updated test to reflect the correctly enforced switch of bench type on preprocessor runs --- ci/apiv2/test_task.py | 8 ++++++- ci/apiv2/testfiles/task/create_task_004.json | 22 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 ci/apiv2/testfiles/task/create_task_004.json diff --git a/ci/apiv2/test_task.py b/ci/apiv2/test_task.py index 27d8596b3..63a929987 100644 --- a/ci/apiv2/test_task.py +++ b/ci/apiv2/test_task.py @@ -51,9 +51,15 @@ def test_patch_color_null(self): obj = Task.objects.get(taskId=task.id) self.assertIsNone(obj.color) - def test_runtime(self): + def test_runtime_preprocessor(self): task = self.create_test_object(file_id='002') + obj = Task.objects.get(taskId=task.id) + self.assertEqual(obj.useNewBench, 1) + + def test_runtime(self): + task = self.create_test_object(file_id='004') + obj = Task.objects.get(taskId=task.id) self.assertEqual(obj.useNewBench, 0) diff --git a/ci/apiv2/testfiles/task/create_task_004.json b/ci/apiv2/testfiles/task/create_task_004.json new file mode 100644 index 000000000..175435480 --- /dev/null +++ b/ci/apiv2/testfiles/task/create_task_004.json @@ -0,0 +1,22 @@ +{ + "attackCmd": "#HL# -a 0 ad a1", + "chunkSize": 1000, + "chunkTime": 600, + "color": "7C6EFF", + "crackerBinaryId": 1, + "forcePipe": true, + "files": [], + "isArchived": false, + "isCpuTask": false, + "isSmall": false, + "maxAgents": 112, + "notes": "example-note", + "preprocessorCommand": "", + "priority": 10, + "skipKeyspace": 500, + "staticChunks": 2, + "statusTimer": 5, + "taskName": "Example - runtime", + "useNewBench": false, + "preprocessorId": 0 +}