mirror of
https://github.com/Karaka-Management/oms-ContractManagement.git
synced 2026-02-15 09:58:41 +00:00
fix phpstan/phpcs
This commit is contained in:
parent
8b33381d0c
commit
4838f51422
|
|
@ -29,8 +29,8 @@ class Navigation
|
||||||
/**
|
/**
|
||||||
* Install navigation providing
|
* Install navigation providing
|
||||||
*
|
*
|
||||||
* @param string $path Module path
|
* @param string $path Module path
|
||||||
* @param ApplicationAbstract $app Application
|
* @param ApplicationAbstract $app Application
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Router\RouteVerb;
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'^.*/contract/list.*$' => [
|
'^.*/contract/list.*$' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractList',
|
'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractList',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ use Modules\ContractManagement\Models\ContractMapper;
|
||||||
*/
|
*/
|
||||||
final class ApiController extends Controller
|
final class ApiController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Api method to create a contract
|
* Api method to create a contract
|
||||||
*
|
*
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
|
|
@ -57,7 +57,7 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
public function apiContractCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
public function apiContractCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
||||||
{
|
{
|
||||||
if (!empty($val = $this->validateContractCreate($request))) {
|
if (!empty($val = $this->validateContractCreate($request))) {
|
||||||
$response->set('contract_create', new FormValidation($val));
|
$response->set('contract_create', new FormValidation($val));
|
||||||
$response->header->status = RequestStatusCode::R_400;
|
$response->header->status = RequestStatusCode::R_400;
|
||||||
|
|
||||||
|
|
@ -103,11 +103,11 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
private function createContractFromRequest(RequestAbstract $request) : Contract
|
private function createContractFromRequest(RequestAbstract $request) : Contract
|
||||||
{
|
{
|
||||||
$contract = new Contract();
|
$contract = new Contract();
|
||||||
$contract->title = (string) ($request->getData('title') ?? '');
|
$contract->title = (string) ($request->getData('title') ?? '');
|
||||||
$contract->description = (string) ($request->getData('description') ?? '');
|
$contract->description = (string) ($request->getData('description') ?? '');
|
||||||
$contract->type = new NullContractType((int) ($request->getData('type') ?? 0));
|
$contract->type = new NullContractType((int) ($request->getData('type') ?? 0));
|
||||||
$contract->start = new \DateTime($request->getData('start') ?? 'now');
|
$contract->start = new \DateTime($request->getData('start') ?? 'now');
|
||||||
|
|
||||||
if (!empty($request->getData('end'))) {
|
if (!empty($request->getData('end'))) {
|
||||||
$contract->end = new \DateTime($request->getData('end'));
|
$contract->end = new \DateTime($request->getData('end'));
|
||||||
|
|
@ -202,7 +202,7 @@ final class ApiController extends Controller
|
||||||
*/
|
*/
|
||||||
private function createContractTypeFromRequest(RequestAbstract $request) : ContractType
|
private function createContractTypeFromRequest(RequestAbstract $request) : ContractType
|
||||||
{
|
{
|
||||||
$contractType = new ContractType();
|
$contractType = new ContractType();
|
||||||
$contractType->name = (string) ($request->getData('name') ?? '');
|
$contractType->name = (string) ($request->getData('name') ?? '');
|
||||||
|
|
||||||
return $contractType;
|
return $contractType;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ use Modules\ContractManagement\Models\ContractMapper;
|
||||||
*/
|
*/
|
||||||
final class BackendController extends Controller
|
final class BackendController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Routing end-point for application behaviour.
|
* Routing end-point for application behaviour.
|
||||||
*
|
*
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ class Contract
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->createdAt = new \DateTimeImmutable('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,7 @@ class ContractType implements \JsonSerializable, ArrayableInterface
|
||||||
*
|
*
|
||||||
* @var ContractTypeL11n
|
* @var ContractTypeL11n
|
||||||
*/
|
*/
|
||||||
protected string |
|
protected string | ContractTypeL11n $l11n;
|
||||||
|
|
||||||
ContractTypeL11n $l11n;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
@ -82,22 +80,22 @@ class ContractType implements \JsonSerializable, ArrayableInterface
|
||||||
* Set l11n
|
* Set l11n
|
||||||
*
|
*
|
||||||
* @param string|ContractTypeL11n $l11n Tag article l11n
|
* @param string|ContractTypeL11n $l11n Tag article l11n
|
||||||
* @param string $lang Language
|
* @param string $lang Language
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function setL11n($l11n, string $lang = ISO639x1Enum::_EN) : void
|
public function setL11n(string|ContractTypeL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
|
||||||
{
|
{
|
||||||
if ($l11n instanceof ContractTypeL11n) {
|
if ($l11n instanceof ContractTypeL11n) {
|
||||||
$this->l11n = $l11n;
|
$this->l11n = $l11n;
|
||||||
} elseif (\is_string($l11n)) {
|
} elseif ($this->l11n instanceof ContractTypeL11n) {
|
||||||
|
$this->l11n->title = $l11n;
|
||||||
|
} else {
|
||||||
$this->l11n = new ContractTypeL11n();
|
$this->l11n = new ContractTypeL11n();
|
||||||
$this->l11n->title = $l11n;
|
$this->l11n->title = $l11n;
|
||||||
$this->l11n->setLanguage($lang);
|
$this->l11n->setLanguage($lang);
|
||||||
} elseif ($this->l11n instanceof ContractTypeL11n && \is_string($l11n)) {
|
|
||||||
$this->l11n->title = $l11n;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,7 @@ class ContractTypeL11n implements \JsonSerializable, ArrayableInterface
|
||||||
* @var int|ContractType
|
* @var int|ContractType
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected int |
|
protected int | ContractType $type = 0;
|
||||||
|
|
||||||
ContractType $type = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language.
|
* Language.
|
||||||
|
|
@ -65,8 +63,8 @@ ContractType $type = 0;
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param int|ContractType $type Attribute type
|
* @param int|ContractType $type Attribute type
|
||||||
* @param string $title Localized title
|
* @param string $title Localized title
|
||||||
* @param string $language Language
|
* @param string $language Language
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,14 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user