Skip to content

Commit

Permalink
Strict Types update
Browse files Browse the repository at this point in the history
Code reformat
  • Loading branch information
Vitexus committed Dec 1, 2024
1 parent badc593 commit 0fab93c
Show file tree
Hide file tree
Showing 14 changed files with 118 additions and 118 deletions.
18 changes: 9 additions & 9 deletions .openapi-generator/templates/Statementor.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class Statementor extends \Ease\Sand
if ($accountNumber) {
$this->setAccountNumber($accountNumber);
}
if ($scope){

if ($scope) {
$this->setScope($scope);
}

}

/**
Expand All @@ -71,7 +71,7 @@ class Statementor extends \Ease\Sand
*
* @return array
*/
public function getStatements($currencyCode = 'CZK', $statementLine = 'MAIN')
public function getStatements($currencyCode = 'CZK', $statementLine = 'MAIN'): array
{
$apiInstance = new PremiumAPI\GetStatementListApi();
$page = 0;
Expand Down Expand Up @@ -213,13 +213,13 @@ class Statementor extends \Ease\Sand
* Save Statement PDF files
*
* @param string $saveTo
* @param array $statements
* @param array<mixed> $statements - produced by getStatements() function
* @param string $format pdf|xml
* @param string $currencyCode
*
* @return string
* @return array
*/
public function download(string $saveTo, array $statements, $format = 'pdf', $currencyCode = 'CZK')
public function download(string $saveTo, array $statements, string $format = 'pdf', string $currencyCode = 'CZK'): array
{
$saved = [];
$apiInstance = new PremiumAPI\DownloadStatementApi();
Expand Down Expand Up @@ -252,7 +252,7 @@ class Statementor extends \Ease\Sand
*
* @return \DateTime
*/
public function getSince()
public function getSince(): \DateTime
{
return $this->since;
}
Expand All @@ -262,7 +262,7 @@ class Statementor extends \Ease\Sand
*
* @return \DateTime
*/
public function getUntil()
public function getUntil(): \DateTime
{
return $this->until;
}
Expand Down
2 changes: 1 addition & 1 deletion debian/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "deb/rbczpremiumapi",
"description": "An Core of PHP Framework for Ease of writing Applications (debianized)",
"version": "1.2.2",
"version": "1.2.3",
"authors": [
{
"name": "Vítězslav Dvořák",
Expand Down
8 changes: 4 additions & 4 deletions examples/download-statements.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* Get today's transactions list
*/
\Ease\Shared::init(['CERT_PASS', 'XIBMCLIENTID', 'ACCOUNT_NUMBER'], isset($argv[1]) ? $argv[1] : '../.env');
ApiClient::checkCertificatePresence(\Ease\Functions::cfg('CERT_FILE'));
$engine = new Statementor(\Ease\Functions::cfg('ACCOUNT_NUMBER'));
$engine->setScope(\Ease\Functions::cfg('STATEMENT_IMPORT_SCOPE', 'last_month'));
ApiClient::checkCertificatePresence(\Ease\Shared::cfg('CERT_FILE'));
$engine = new Statementor(\Ease\Shared::cfg('ACCOUNT_NUMBER'));
$engine->setScope(\Ease\Shared::cfg('STATEMENT_IMPORT_SCOPE', 'last_month'));

$saveTo = \Ease\Functions::cfg('STATEMENT_SAVE_DIR', './');
$saveTo = \Ease\Shared::cfg('STATEMENT_SAVE_DIR', './');

if (file_exists($saveTo) === false) {
mkdir($saveTo, 0777, true);
Expand Down
2 changes: 1 addition & 1 deletion lib/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ public static function sourceString()
/**
* Try to check certificate readibilty
*
* @throws Exception - Certificate file not found
*
* @param string $certFile path to certificate
* @param boolean $die throw exception or return false ?
* @throws Exception - Certificate file not found
*
* @return boolean certificate file
*/
Expand Down
8 changes: 4 additions & 4 deletions lib/ObjectSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ private static function isEmptyValue($value, string $openApiType): bool
case 'float':
return $value !== 0 && $value !== 0.0;

# For boolean values, '' is considered empty
# For boolean values, '' is considered empty
case 'bool':
case 'boolean':
return !in_array($value, [false, 0], true);

# For all the other types, any value at this point can be considered empty.
# For all the other types, any value at this point can be considered empty.
default:
return true;
}
Expand Down Expand Up @@ -239,7 +239,7 @@ public static function toQueryValue(
}

# Handle DateTime objects in query
if ( (($openApiType === "\\DateTime") || $openApiType === 'string') && $value instanceof \DateTime) {
if ((($openApiType === "\\DateTime") || $openApiType === 'string') && $value instanceof \DateTime) {
return ["{$paramName}" => $value->format(self::$dateTimeFormat)];
}

Expand Down Expand Up @@ -294,7 +294,7 @@ public static function toQueryValue(
*/
public static function convertBoolToQueryStringFormat(bool $value)
{
if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) {
if (Configuration::BOOLEAN_FORMAT_STRING === Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) {
return $value ? 'true' : 'false';
}

Expand Down
12 changes: 6 additions & 6 deletions lib/PremiumAPI/DownloadStatementApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class DownloadStatementApi
],
];

/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
Expand Down
12 changes: 6 additions & 6 deletions lib/PremiumAPI/GetAccountBalanceApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class GetAccountBalanceApi
],
];

/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
Expand Down
12 changes: 6 additions & 6 deletions lib/PremiumAPI/GetAccountsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class GetAccountsApi
],
];

/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
Expand Down
12 changes: 6 additions & 6 deletions lib/PremiumAPI/GetBatchDetailApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class GetBatchDetailApi
],
];

/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
Expand Down
12 changes: 6 additions & 6 deletions lib/PremiumAPI/GetStatementListApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class GetStatementListApi
],
];

/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
Expand Down
12 changes: 6 additions & 6 deletions lib/PremiumAPI/GetTransactionListApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class GetTransactionListApi
],
];

/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
Expand Down
12 changes: 6 additions & 6 deletions lib/PremiumAPI/UploadPaymentsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class UploadPaymentsApi
],
];

/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
/**
* @param ClientInterface $client
* @param Configuration $config
* @param HeaderSelector $selector
* @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
*/
public function __construct(
ClientInterface $client = null,
Configuration $config = null,
Expand Down
18 changes: 9 additions & 9 deletions lib/Statementor.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public function __construct(string $accountNumber = '', string $scope = '')
if ($accountNumber) {
$this->setAccountNumber($accountNumber);
}
if ($scope){

if ($scope) {
$this->setScope($scope);
}

}

/**
Expand All @@ -71,7 +71,7 @@ public function setAccountNumber($accountNumber)
*
* @return array
*/
public function getStatements($currencyCode = 'CZK', $statementLine = 'MAIN')
public function getStatements($currencyCode = 'CZK', $statementLine = 'MAIN'): array
{
$apiInstance = new PremiumAPI\GetStatementListApi();
$page = 0;
Expand Down Expand Up @@ -213,13 +213,13 @@ public function setScope(string $scope): void
* Save Statement PDF files
*
* @param string $saveTo
* @param array $statements
* @param array<mixed> $statements - produced by getStatements() function
* @param string $format pdf|xml
* @param string $currencyCode
*
* @return string
* @return array
*/
public function download(string $saveTo, array $statements, $format = 'pdf', $currencyCode = 'CZK')
public function download(string $saveTo, array $statements, string $format = 'pdf', string $currencyCode = 'CZK'): array
{
$saved = [];
$apiInstance = new PremiumAPI\DownloadStatementApi();
Expand Down Expand Up @@ -252,7 +252,7 @@ public function download(string $saveTo, array $statements, $format = 'pdf', $cu
*
* @return \DateTime
*/
public function getSince()
public function getSince(): \DateTime
{
return $this->since;
}
Expand All @@ -262,7 +262,7 @@ public function getSince()
*
* @return \DateTime
*/
public function getUntil()
public function getUntil(): \DateTime
{
return $this->until;
}
Expand Down
Loading

0 comments on commit 0fab93c

Please sign in to comment.