mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ final class CookieJar
|
|||
|
||||
// @codeCoverageIgnoreStart
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ class CountryMapper extends DataMapperAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
'country_id' => ['name' => 'country_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'country_name' => ['name' => 'country_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'country_code2' => ['name' => 'country_code2', 'type' => 'string', 'internal' => 'code2'],
|
||||
'country_code3' => ['name' => 'country_code3', 'type' => 'string', 'internal' => 'code3'],
|
||||
'country_numeric' => ['name' => 'country_numeric', 'type' => 'int', 'internal' => 'numeric'],
|
||||
'country_id' => ['name' => 'country_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'country_name' => ['name' => 'country_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'country_code2' => ['name' => 'country_code2', 'type' => 'string', 'internal' => 'code2'],
|
||||
'country_code3' => ['name' => 'country_code3', 'type' => 'string', 'internal' => 'code3'],
|
||||
'country_numeric' => ['name' => 'country_numeric', 'type' => 'int', 'internal' => 'numeric'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ final class CurrencyMapper extends DataMapperAbstract
|
|||
protected static array $columns = [
|
||||
'currency_id' => ['name' => 'currency_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'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_symbol' => ['name' => 'currency_symbol', 'type' => 'string', 'internal' => 'symbol'],
|
||||
'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'],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Localization
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $currency = ISO4217Enum::_USD;
|
||||
private string $currency = ISO4217CharEnum::_USD;
|
||||
|
||||
/**
|
||||
* Number format.
|
||||
|
|
|
|||
|
|
@ -169,7 +169,6 @@ final class Request extends RequestAbstract
|
|||
\parse_str($content, $temp);
|
||||
$this->data += $temp;
|
||||
} elseif (\stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') !== false) {
|
||||
$content = \file_get_contents('php://input');
|
||||
$stream = \fopen('php://input', 'r');
|
||||
$partInfo = null;
|
||||
$boundary = null;
|
||||
|
|
@ -277,16 +276,13 @@ final class Request extends RequestAbstract
|
|||
|
||||
\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];
|
||||
$name = $match['name'];
|
||||
$quotedValue = $match['quotedValue'];
|
||||
|
||||
if (empty($quotedValue)) {
|
||||
$value = $match['value'];
|
||||
} else {
|
||||
$value = \stripcslashes($quotedValue);
|
||||
}
|
||||
$value = empty($quotedValue) ? $value = $match['value'] : \stripcslashes($quotedValue);
|
||||
|
||||
if ($name === $headerKey && $i === 0) {
|
||||
$name = 'value';
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ final class InfoManager
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
private array $info = [];
|
||||
|
|
@ -84,7 +84,9 @@ final class InfoManager
|
|||
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);
|
||||
$this->info = $info === false ? [] : $info;
|
||||
}
|
||||
|
|
@ -128,7 +130,7 @@ final class InfoManager
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
|
|
@ -236,7 +238,7 @@ final class InfoManager
|
|||
/**
|
||||
* Get info data.
|
||||
*
|
||||
* @return array<array>
|
||||
* @return array<array{pid:string[], type:int, for:string, file:string, from:string}>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ abstract class ModuleAbstract
|
|||
/**
|
||||
* Get module dependencies
|
||||
*
|
||||
* @return array
|
||||
* @return string[]
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ final class PackageManager
|
|||
/**
|
||||
* Download files
|
||||
*
|
||||
* @param array $components Component data
|
||||
* @param array<string, string> $components Component data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -228,7 +228,7 @@ final class PackageManager
|
|||
/**
|
||||
* Move files
|
||||
*
|
||||
* @param array $components Component data
|
||||
* @param array<string, string> $components Component data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -247,7 +247,7 @@ final class PackageManager
|
|||
/**
|
||||
* Copy files
|
||||
*
|
||||
* @param array $components Component data
|
||||
* @param array<string, array<int, string>> $components Component data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -269,7 +269,7 @@ final class PackageManager
|
|||
/**
|
||||
* Delete files
|
||||
*
|
||||
* @param array $components Component data
|
||||
* @param string[] $components Component data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -286,7 +286,7 @@ final class PackageManager
|
|||
/**
|
||||
* Execute commands
|
||||
*
|
||||
* @param array $components Component data
|
||||
* @param string[] $components Component data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ class CountryMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('DE', $obj->getCode2());
|
||||
self::assertEquals('DEU', $obj->getCode3());
|
||||
self::assertEquals(276, $obj->getNumeric());
|
||||
self::assertEquals('ISO 3166-2:DE', $obj->getSubdevision());
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass() : void
|
||||
|
|
|
|||
|
|
@ -47,8 +47,10 @@ class CurrencyMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$obj = CurrencyMapper::get(50);
|
||||
self::assertEquals('Euro', $obj->getName());
|
||||
self::assertEquals('EUR', $obj->getCode());
|
||||
self::assertEquals(978, $obj->getNumber());
|
||||
self::assertEquals(2, $obj->getDecimals());
|
||||
self::assertEquals('978', $obj->getNumber());
|
||||
self::assertEquals('€', $obj->getSymbol());
|
||||
self::assertEquals(100, $obj->getSubunits());
|
||||
self::assertEquals('2', $obj->getDecimals());
|
||||
self::assertStringContainsString('Germany', $obj->getCountries());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,10 @@ class CurrencyTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$obj = new Currency();
|
||||
self::assertEquals('', $obj->getName());
|
||||
self::assertEquals(0, $obj->getNumber());
|
||||
self::assertEquals(0, $obj->getDecimals());
|
||||
self::assertEquals('', $obj->getNumber());
|
||||
self::assertEquals('', $obj->getSymbol());
|
||||
self::assertEquals(0, $obj->getSubunits());
|
||||
self::assertEquals('', $obj->getDecimals());
|
||||
self::assertEquals('', $obj->getCountries());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user