phpstan, phpcs, phpunit fixes

This commit is contained in:
Dennis Eichhorn 2023-01-27 22:12:09 +01:00
parent de4f2ffb5f
commit 7c10a514d9
5 changed files with 35 additions and 8 deletions

View File

@ -49,6 +49,12 @@
"default": null, "default": null,
"null": true "null": true
}, },
"auditor_audit_blockchain": {
"name": "auditor_audit_blockchain",
"type": "VARCHAR(129)",
"default": null,
"null": true
},
"auditor_audit_created_at": { "auditor_audit_created_at": {
"name": "auditor_audit_created_at", "name": "auditor_audit_created_at",
"type": "DATETIME", "type": "DATETIME",

View File

@ -4,7 +4,7 @@
* *
* PHP Version 8.1 * PHP Version 8.1
* *
* @package Modules\Admin * @package Modules\Auditor
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
@ -12,7 +12,7 @@
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Modules\Admin\Controller; namespace Modules\Auditor\Controller;
use Modules\Auditor\Models\AuditMapper; use Modules\Auditor\Models\AuditMapper;
use Modules\Auditor\Models\NullAudit; use Modules\Auditor\Models\NullAudit;
@ -23,11 +23,11 @@ use phpOMS\Message\ResponseAbstract;
use phpOMS\Views\View; use phpOMS\Views\View;
/** /**
* Admin controller class. * Auditor controller class.
* *
* This class is responsible for the basic admin activities such as managing accounts, groups, permissions and modules. * This class is responsible for the basic admin activities such as managing accounts, groups, permissions and modules.
* *
* @package Modules\Admin * @package Modules\Auditor
* @license OMS License 1.0 * @license OMS License 1.0
* @link https://jingga.app * @link https://jingga.app
* @since 1.0.0 * @since 1.0.0
@ -54,6 +54,7 @@ final class CliController extends Controller
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Auditor/Theme/Cli/blockchain'); $view->setTemplate('/Modules/Auditor/Theme/Cli/blockchain');
/** @var \Modules\Auditor\Models\Audit $first */
$first = AuditMapper::get() $first = AuditMapper::get()
->where('blockchain', null) ->where('blockchain', null)
->sort('id', OrderType::ASC) ->sort('id', OrderType::ASC)
@ -61,6 +62,7 @@ final class CliController extends Controller
->execute(); ->execute();
if ($first->getId() === 1) { if ($first->getId() === 1) {
/** @var \Modules\Auditor\Models\Audit $first */
$first = AuditMapper::get() $first = AuditMapper::get()
->where('id', $first->getId() + 1) ->where('id', $first->getId() + 1)
->execute(); ->execute();
@ -68,19 +70,22 @@ final class CliController extends Controller
$count = 0; $count = 0;
if (!($first instanceof NullAudit)) { if (!($first instanceof NullAudit)) {
/** @var \Modules\Auditor\Models\Audit $last */
$last = AuditMapper::get() $last = AuditMapper::get()
->sort('id', OrderType::DESC) ->sort('id', OrderType::DESC)
->limit(1) ->limit(1)
->execute(); ->execute();
/** @var \Modules\Auditor\Models\Audit $previous */
$previous = AuditMapper::get() $previous = AuditMapper::get()
->where('id', $first->getId() - 1) ->where('id', $first->getId() - 1)
->execute(); ->execute();
$current = $first; $current = $first;
$endLastBatchId = $first->getId() - 1; $endLastBatchId = $first->getId() - 1;
while ($current->getId() !== 0 && $current->getId() <= $last->getId()) { while ($current->getId() !== 0 && $current->getId() <= $last->getId()) {
/** @var \Modules\Auditor\Models\Audit[] $batch */
$batch = AuditMapper::getAll() $batch = AuditMapper::getAll()
->where('id', $endLastBatchId, '>') ->where('id', $endLastBatchId, '>')
->sort('id', OrderType::ASC) ->sort('id', OrderType::ASC)

View File

@ -51,7 +51,7 @@ final class AuditMapper extends DataMapperFactory
/** /**
* Belongs to. * Belongs to.
* *
* @var array<string, array{mapper:string, external:string, column?:string, by?:string}> * @var array<string, array{mapper:class-string, external:string, column?:string, by?:string}>
* @since 1.0.0 * @since 1.0.0
*/ */
public const BELONGS_TO = [ public const BELONGS_TO = [
@ -64,7 +64,7 @@ final class AuditMapper extends DataMapperFactory
/** /**
* Model to use by the mapper. * Model to use by the mapper.
* *
* @var string * @var class-string
* @since 1.0.0 * @since 1.0.0
*/ */
public const MODEL = Audit::class; public const MODEL = Audit::class;

View File

@ -0,0 +1,16 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\Auditor
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Auditor' => [
]];

View File

@ -12,5 +12,5 @@
*/ */
declare(strict_types=1); declare(strict_types=1);
return ['Navigation' => [ return ['Auditor' => [
]]; ]];