mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-10 17:28:40 +00:00
test fixes
This commit is contained in:
parent
370e4fa420
commit
ca57051cd7
|
|
@ -25,6 +25,10 @@ namespace phpOMS\Algorithm\Clustering;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @property array<int, int|float> $coordinates
|
||||
* @property string $name
|
||||
* @property int $group
|
||||
*/
|
||||
interface PointInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -211,20 +211,22 @@ final class EUVATVies implements EUVATInterface
|
|||
$result['vat'] = $json['isValid'] ? 'A' : 'B';
|
||||
$result['name'] = $json['isValid'];
|
||||
|
||||
$result['city'] = \stripos($json['address'] ?? '', "\n") !== false
|
||||
? \substr($json['address'], \stripos($json['address'], "\n") + 1)
|
||||
$newLinePos = \stripos($json['address'] ?? '', "\n");
|
||||
|
||||
$result['city'] = $newLinePos !== false
|
||||
? \substr($json['address'], $newLinePos + 1)
|
||||
: '';
|
||||
|
||||
$result['postal'] = \stripos($json['address'] ?? '', "\n") !== false
|
||||
$result['postal'] = $newLinePos !== false
|
||||
? \substr(
|
||||
$json['address'],
|
||||
\stripos($json['address'], "\n") + 1,
|
||||
\stripos($json['address'], ' ', \stripos($json['address'], "\n")) - \stripos($json['address'], "\n") - 1
|
||||
$newLinePos + 1,
|
||||
\stripos($json['address'], ' ', $newLinePos) - $newLinePos - 1
|
||||
)
|
||||
: '';
|
||||
|
||||
$result['address'] = \stripos($json['address'] ?? '', "\n") !== false
|
||||
? \substr($json['address'], 0, \stripos($json['address'], "\n") - 1)
|
||||
$result['address'] = $newLinePos !== false
|
||||
? \substr($json['address'], 0, $newLinePos - 1)
|
||||
: ($json['address'] ?? '');
|
||||
|
||||
$result['name'] = $result['name'] === '---' ? '' : $result['name'];
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ final class Loan
|
|||
return $loan / $collateral;
|
||||
}
|
||||
|
||||
public static function getAmortizationLoanPayment(float $loan, float $r, int $duration, int $interval)
|
||||
public static function getAmortizationLoanPayment(float $loan, float $r, int $duration, int $interval) : float
|
||||
{
|
||||
return $loan * (($r / $interval * (1.0 + $r / $interval) / $duration) / ((1.0 + $r / $interval) / $duration) - 1);
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ final class Loan
|
|||
return $loan * $r / $interval;
|
||||
}
|
||||
|
||||
public static function getAmortizationPrincipalPayment(float $payment, float $interest)
|
||||
public static function getAmortizationPrincipalPayment(float $payment, float $interest) : float
|
||||
{
|
||||
return $payment - $interest;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ final class Dispatcher implements DispatcherInterface
|
|||
|
||||
if (($c = \count($dispatch)) === 3) {
|
||||
/* Handling static functions */
|
||||
/** @var \Closure $function */
|
||||
$function = $dispatch[0] . '::' . $dispatch[2];
|
||||
|
||||
$views[$controller] = $data === null ? $function() : $function(...$data);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ use phpOMS\Uri\UriInterface;
|
|||
* @SuppressWarnings(PHPMD.Superglobals)
|
||||
*
|
||||
* @property HttpHeader $header
|
||||
* @property HttpUri $uri
|
||||
*/
|
||||
final class HttpRequest extends RequestAbstract
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ final class FormElementGenerator
|
|||
$element .= ' ' . $attribute . '="' . $val . '"';
|
||||
}
|
||||
|
||||
$value ??= $json['default']['value'] ?? '';
|
||||
$value ??= $json['default']['value'] ?? null;
|
||||
|
||||
$element .= (isset($json['default']) || $value !== null ? ' value="' . ($json['subtype'] === 'datetime' ? (new SmartDateTime($value))->format($json['default']['format']) : $value) . '"' : '');
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ final class SocketRouter implements RouterInterface
|
|||
/**
|
||||
* Routes.
|
||||
*
|
||||
* @var array<string, array<int, array{dest:string, verb:int, csrf?:bool, active?:bool, permission:array{module:string, type:int, category:int}, validation?:array{}, pattern?:string}>>
|
||||
* @var array<string, array<int, array{dest:string, verb:int, csrf?:bool, active?:bool, permission:array{module:string, type:int, category:int}, validation?:array, pattern?:string}>>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $routes = [];
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ final class WebRouter implements RouterInterface
|
|||
/**
|
||||
* Routes.
|
||||
*
|
||||
* @var array<string, array<int, array{dest:string, verb:int, csrf?:bool, active?:bool, permission:array{module:string, type:int, category:int}, validation?:array{}, pattern?:string}>>
|
||||
* @var array<string, array<int, array{dest:string, verb:int, csrf?:bool, active?:bool, permission:array{module:string, type:int, category:int}, validation?:array, pattern?:string}>>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private array $routes = [];
|
||||
|
|
|
|||
|
|
@ -127,13 +127,13 @@ final class UriFactory
|
|||
/**
|
||||
* Setup uri builder based on current request
|
||||
*
|
||||
* @param UriInterface $uri Uri
|
||||
* @param HttpUri $uri Uri
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function setupUriBuilder(UriInterface $uri) : void
|
||||
public static function setupUriBuilder(HttpUri $uri) : void
|
||||
{
|
||||
self::setQuery('/scheme', $uri->scheme);
|
||||
self::setQuery('/host', $uri->host);
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ abstract class TwoDAbstract extends CodeAbstract
|
|||
*
|
||||
* @param array $codeArray Code array to render
|
||||
*
|
||||
* @return \GdImage
|
||||
* @return null|\GdImage
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected function createImage(array $codeArray) : mixed
|
||||
protected function createImage(array $codeArray) : ?\GdImage
|
||||
{
|
||||
if (empty($codeArray)) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ class Markdown
|
|||
* @var array{}|array{text:string, id:string, level:string}
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $contentsListArray = [];
|
||||
protected array $contentsListArray = [];
|
||||
|
||||
/**
|
||||
* TOC string after parsing headers
|
||||
|
|
@ -346,7 +346,7 @@ class Markdown
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $contentsListString = '';
|
||||
protected string $contentsListString = '';
|
||||
|
||||
/**
|
||||
* First head level
|
||||
|
|
@ -362,7 +362,7 @@ class Markdown
|
|||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $isBlacklistInitialized = false;
|
||||
protected bool $isBlacklistInitialized = false;
|
||||
|
||||
/**
|
||||
* Header duplicates (same header text)
|
||||
|
|
@ -370,7 +370,7 @@ class Markdown
|
|||
* @var array<string, int>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $anchorDuplicates = [];
|
||||
protected array $anchorDuplicates = [];
|
||||
// TOC: end
|
||||
|
||||
/**
|
||||
|
|
@ -387,7 +387,7 @@ class Markdown
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $currentAbreviation;
|
||||
private string $currentAbbreviation;
|
||||
|
||||
/**
|
||||
* Current abbreviation meaning
|
||||
|
|
@ -420,7 +420,7 @@ class Markdown
|
|||
$this->firstHeadLevel = 0;
|
||||
$this->anchorDuplicates = [];
|
||||
$this->footnoteCount = 0;
|
||||
$this->currentAbreviation = '';
|
||||
$this->currentAbbreviation = '';
|
||||
$this->currentMeaning = '';
|
||||
}
|
||||
|
||||
|
|
@ -3514,14 +3514,14 @@ class Markdown
|
|||
}
|
||||
|
||||
$element['elements'] = self::pregReplaceElements(
|
||||
'/\b' . \preg_quote($this->currentAbreviation, '/') . '\b/',
|
||||
'/\b' . \preg_quote($this->currentAbbreviation, '/') . '\b/',
|
||||
[
|
||||
[
|
||||
'name' => 'abbr',
|
||||
'attributes' => [
|
||||
'title' => $this->currentMeaning,
|
||||
],
|
||||
'text' => $this->currentAbreviation,
|
||||
'text' => $this->currentAbbreviation,
|
||||
],
|
||||
],
|
||||
$element['text']
|
||||
|
|
@ -3563,7 +3563,7 @@ class Markdown
|
|||
}
|
||||
|
||||
foreach ($this->definitionData['Abbreviation'] as $abbreviation => $meaning) {
|
||||
$this->currentAbreviation = $abbreviation;
|
||||
$this->currentAbbreviation = $abbreviation;
|
||||
$this->currentMeaning = $meaning;
|
||||
|
||||
$inline['element'] = $this->elementApplyRecursiveDepthFirst(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user