mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 22:38:42 +00:00
fix bugs, phpstan, phpcs
This commit is contained in:
parent
6c917b5486
commit
fb968fbef7
|
|
@ -48,7 +48,7 @@ interface PointInterface
|
||||||
/**
|
/**
|
||||||
* Set the coordinate of the point
|
* Set the coordinate of the point
|
||||||
*
|
*
|
||||||
* @param int $index Index of the coordinate (e.g. 0 = x);
|
* @param int $index Index of the coordinate (e.g. 0 = x);
|
||||||
* @param mixed $value Value of the coordinate
|
* @param mixed $value Value of the coordinate
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ final class CookieJar
|
||||||
|
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
foreach ($this->cookies as $key => $cookie) {
|
foreach ($this->cookies as $key => $cookie) {
|
||||||
\setcookie($key, $cookie['value'], $cookie['expiry'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly'], ['samesite'=>'Strict']);
|
\setcookie($key, $cookie['value'], $cookie['expiry'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly'], ['samesite' => 'Strict']);
|
||||||
}
|
}
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,11 @@ class CountryMapper extends DataMapperAbstract
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'country_id' => ['name' => 'country_id', 'type' => 'int', 'internal' => 'id'],
|
'country_id' => ['name' => 'country_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'country_name' => ['name' => 'country_name', 'type' => 'string', 'internal' => 'name'],
|
'country_name' => ['name' => 'country_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
'country_code2' => ['name' => 'country_code2', 'type' => 'string', 'internal' => 'code2'],
|
'country_code2' => ['name' => 'country_code2', 'type' => 'string', 'internal' => 'code2'],
|
||||||
'country_code3' => ['name' => 'country_code3', 'type' => 'string', 'internal' => 'code3'],
|
'country_code3' => ['name' => 'country_code3', 'type' => 'string', 'internal' => 'code3'],
|
||||||
'country_numeric' => ['name' => 'country_numeric', 'type' => 'int', 'internal' => 'numeric'],
|
'country_numeric' => ['name' => 'country_numeric', 'type' => 'int', 'internal' => 'numeric'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,11 @@ final class CurrencyMapper extends DataMapperAbstract
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'currency_id' => ['name' => 'currency_id', 'type' => 'int', 'internal' => 'id'],
|
'currency_id' => ['name' => 'currency_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'currency_name' => ['name' => 'currency_name', 'type' => 'string', 'internal' => 'name'],
|
'currency_name' => ['name' => 'currency_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
'currency_char' => ['name' => 'currency_char', 'type' => 'string', 'internal' => 'code'],
|
'currency_code' => ['name' => 'currency_code', 'type' => 'string', 'internal' => 'code'],
|
||||||
'currency_number' => ['name' => 'currency_number', 'type' => 'string', 'internal' => 'number'],
|
'currency_number' => ['name' => 'currency_number', 'type' => 'string', 'internal' => 'number'],
|
||||||
'currency_symbol' => ['name' => 'currency_symbol', 'type' => 'string', 'internal' => 'symbol'],
|
'currency_symbol' => ['name' => 'currency_symbol', 'type' => 'string', 'internal' => 'symbol'],
|
||||||
'currency_subunits' => ['name' => 'currency_subunits', 'type' => 'int', 'internal' => 'subunits'],
|
'currency_subunits' => ['name' => 'currency_subunits', 'type' => 'int', 'internal' => 'subunits'],
|
||||||
'currency_decimals' => ['name' => 'currency_decimals', 'type' => 'string', 'internal' => 'decimals'],
|
'currency_decimal' => ['name' => 'currency_decimal', 'type' => 'string', 'internal' => 'decimals'],
|
||||||
'currency_countries' => ['name' => 'currency_countries', 'type' => 'string', 'internal' => 'countries'],
|
'currency_countries' => ['name' => 'currency_countries', 'type' => 'string', 'internal' => 'countries'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class Localization
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private string $currency = ISO4217Enum::_USD;
|
private string $currency = ISO4217CharEnum::_USD;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number format.
|
* Number format.
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,6 @@ final class Request extends RequestAbstract
|
||||||
\parse_str($content, $temp);
|
\parse_str($content, $temp);
|
||||||
$this->data += $temp;
|
$this->data += $temp;
|
||||||
} elseif (\stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') !== false) {
|
} elseif (\stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') !== false) {
|
||||||
$content = \file_get_contents('php://input');
|
|
||||||
$stream = \fopen('php://input', 'r');
|
$stream = \fopen('php://input', 'r');
|
||||||
$partInfo = null;
|
$partInfo = null;
|
||||||
$boundary = null;
|
$boundary = null;
|
||||||
|
|
@ -277,16 +276,13 @@ final class Request extends RequestAbstract
|
||||||
|
|
||||||
\preg_match_all($regex, $headerVal, $matches, \PREG_SET_ORDER);
|
\preg_match_all($regex, $headerVal, $matches, \PREG_SET_ORDER);
|
||||||
|
|
||||||
for ($i = 0; $i < \count($matches); ++$i) {
|
$length = \count($matches);
|
||||||
|
for ($i = 0; $i < $length; ++$i) {
|
||||||
$match = $matches[$i];
|
$match = $matches[$i];
|
||||||
$name = $match['name'];
|
$name = $match['name'];
|
||||||
$quotedValue = $match['quotedValue'];
|
$quotedValue = $match['quotedValue'];
|
||||||
|
|
||||||
if (empty($quotedValue)) {
|
$value = empty($quotedValue) ? $value = $match['value'] : \stripcslashes($quotedValue);
|
||||||
$value = $match['value'];
|
|
||||||
} else {
|
|
||||||
$value = \stripcslashes($quotedValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($name === $headerKey && $i === 0) {
|
if ($name === $headerKey && $i === 0) {
|
||||||
$name = 'value';
|
$name = 'value';
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ final class InfoManager
|
||||||
/**
|
/**
|
||||||
* Info data.
|
* Info data.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array{name:array{id:int, internal:string, external:string}, category:string, vision:string, requirements:array, creator:array{name:string, website:string}, description:string, directory:string, dependencies:array<string, string>, providing:array<string, string>, load:array<int, array{pid:string[], type:int, for:string, file:string, from:string}>}|array
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private array $info = [];
|
private array $info = [];
|
||||||
|
|
@ -84,7 +84,9 @@ final class InfoManager
|
||||||
throw new PathException($this->path);
|
throw new PathException($this->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$contents = \file_get_contents($this->path);
|
$contents = \file_get_contents($this->path);
|
||||||
|
|
||||||
|
/** @var array{name:array{id:int, internal:string, external:string}, category:string, vision:string, requirements:array, creator:array{name:string, website:string}, description:string, directory:string, dependencies:array<string, string>, providing:array<string, string>, load:array<int, array{pid:string[], type:int, for:string, file:string, from:string}>} $info */
|
||||||
$info = \json_decode($contents === false ? '[]' : $contents, true);
|
$info = \json_decode($contents === false ? '[]' : $contents, true);
|
||||||
$this->info = $info === false ? [] : $info;
|
$this->info = $info === false ? [] : $info;
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +130,7 @@ final class InfoManager
|
||||||
/**
|
/**
|
||||||
* Get info data.
|
* Get info data.
|
||||||
*
|
*
|
||||||
* @return array<string, array>
|
* @return array{name:array{id:int, internal:string, external:string}, category:string, vision:string, requirements:array, creator:array{name:string, website:string}, description:string, directory:string, dependencies:array<string, string>, providing:array<string, string>, load:array<int, array{pid:string[], type:int, for:string, file:string, from:string}>}|array
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
@ -236,7 +238,7 @@ final class InfoManager
|
||||||
/**
|
/**
|
||||||
* Get info data.
|
* Get info data.
|
||||||
*
|
*
|
||||||
* @return array<array>
|
* @return array<array{pid:string[], type:int, for:string, file:string, from:string}>
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ abstract class ModuleAbstract
|
||||||
/**
|
/**
|
||||||
* Get module dependencies
|
* Get module dependencies
|
||||||
*
|
*
|
||||||
* @return array
|
* @return string[]
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ final class PackageManager
|
||||||
/**
|
/**
|
||||||
* Download files
|
* Download files
|
||||||
*
|
*
|
||||||
* @param array $components Component data
|
* @param array<string, string> $components Component data
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -228,7 +228,7 @@ final class PackageManager
|
||||||
/**
|
/**
|
||||||
* Move files
|
* Move files
|
||||||
*
|
*
|
||||||
* @param array $components Component data
|
* @param array<string, string> $components Component data
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -247,7 +247,7 @@ final class PackageManager
|
||||||
/**
|
/**
|
||||||
* Copy files
|
* Copy files
|
||||||
*
|
*
|
||||||
* @param array $components Component data
|
* @param array<string, array<int, string>> $components Component data
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -269,7 +269,7 @@ final class PackageManager
|
||||||
/**
|
/**
|
||||||
* Delete files
|
* Delete files
|
||||||
*
|
*
|
||||||
* @param array $components Component data
|
* @param string[] $components Component data
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -286,7 +286,7 @@ final class PackageManager
|
||||||
/**
|
/**
|
||||||
* Execute commands
|
* Execute commands
|
||||||
*
|
*
|
||||||
* @param array $components Component data
|
* @param string[] $components Component data
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@ class CountryMapperTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertEquals('DE', $obj->getCode2());
|
self::assertEquals('DE', $obj->getCode2());
|
||||||
self::assertEquals('DEU', $obj->getCode3());
|
self::assertEquals('DEU', $obj->getCode3());
|
||||||
self::assertEquals(276, $obj->getNumeric());
|
self::assertEquals(276, $obj->getNumeric());
|
||||||
self::assertEquals('ISO 3166-2:DE', $obj->getSubdevision());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function tearDownAfterClass() : void
|
public static function tearDownAfterClass() : void
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,10 @@ class CurrencyMapperTest extends \PHPUnit\Framework\TestCase
|
||||||
$obj = CurrencyMapper::get(50);
|
$obj = CurrencyMapper::get(50);
|
||||||
self::assertEquals('Euro', $obj->getName());
|
self::assertEquals('Euro', $obj->getName());
|
||||||
self::assertEquals('EUR', $obj->getCode());
|
self::assertEquals('EUR', $obj->getCode());
|
||||||
self::assertEquals(978, $obj->getNumber());
|
self::assertEquals('978', $obj->getNumber());
|
||||||
self::assertEquals(2, $obj->getDecimals());
|
self::assertEquals('€', $obj->getSymbol());
|
||||||
|
self::assertEquals(100, $obj->getSubunits());
|
||||||
|
self::assertEquals('2', $obj->getDecimals());
|
||||||
self::assertStringContainsString('Germany', $obj->getCountries());
|
self::assertStringContainsString('Germany', $obj->getCountries());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,10 @@ class CurrencyTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
$obj = new Currency();
|
$obj = new Currency();
|
||||||
self::assertEquals('', $obj->getName());
|
self::assertEquals('', $obj->getName());
|
||||||
self::assertEquals(0, $obj->getNumber());
|
self::assertEquals('', $obj->getNumber());
|
||||||
self::assertEquals(0, $obj->getDecimals());
|
self::assertEquals('', $obj->getSymbol());
|
||||||
|
self::assertEquals(0, $obj->getSubunits());
|
||||||
|
self::assertEquals('', $obj->getDecimals());
|
||||||
self::assertEquals('', $obj->getCountries());
|
self::assertEquals('', $obj->getCountries());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user