mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Last code optimization before release.
This commit is contained in:
@@ -271,6 +271,7 @@ class ConfigureMappingHandler implements FileConfigurationInterface
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function getValuesForMapping(Reader $reader, array $config, array $columnConfig): array
|
||||
{
|
||||
|
@@ -58,6 +58,7 @@ class ConfigureRolesHandler implements FileConfigurationInterface
|
||||
* @param array $config
|
||||
*
|
||||
* @return MessageBag
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function configurationComplete(array $config): MessageBag
|
||||
{
|
||||
|
@@ -110,6 +110,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function getNextData(): array
|
||||
{
|
||||
|
@@ -128,6 +128,7 @@ class ImportTransaction
|
||||
* @param ColumnValue $columnValue
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function addColumnValue(ColumnValue $columnValue): void
|
||||
{
|
||||
|
@@ -48,6 +48,7 @@ class AssetAccountMapper
|
||||
* @param array $data
|
||||
*
|
||||
* @return Account
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function map(?int $accountId, array $data): Account
|
||||
{
|
||||
|
@@ -81,6 +81,7 @@ class MappedValuesValidator
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function validate(array $mappings): array
|
||||
{
|
||||
|
@@ -135,44 +135,32 @@ class MappingConverger
|
||||
|
||||
return $role;
|
||||
}
|
||||
switch ($role) {
|
||||
default:
|
||||
throw new FireflyException(sprintf('Cannot indicate new role for mapped role "%s"', $role)); // @codeCoverageIgnore
|
||||
case 'account-id':
|
||||
case 'account-name':
|
||||
case 'account-iban':
|
||||
case 'account-number':
|
||||
$newRole = 'account-id';
|
||||
break;
|
||||
case 'bill-id':
|
||||
case 'bill-name':
|
||||
$newRole = 'bill-id';
|
||||
break;
|
||||
case 'budget-id':
|
||||
case 'budget-name':
|
||||
$newRole = 'budget-id';
|
||||
break;
|
||||
case 'currency-id':
|
||||
case 'currency-name':
|
||||
case 'currency-code':
|
||||
case 'currency-symbol':
|
||||
$newRole = 'currency-id';
|
||||
break;
|
||||
case 'category-id':
|
||||
case 'category-name':
|
||||
$newRole = 'category-id';
|
||||
break;
|
||||
case 'foreign-currency-id':
|
||||
case 'foreign-currency-code':
|
||||
$newRole = 'foreign-currency-id';
|
||||
break;
|
||||
case 'opposing-id':
|
||||
case 'opposing-name':
|
||||
case 'opposing-iban':
|
||||
case 'opposing-number':
|
||||
$newRole = 'opposing-id';
|
||||
break;
|
||||
$roleMapping = [
|
||||
'account-id' => 'account-id',
|
||||
'account-name' => 'account-id',
|
||||
'account-iban' => 'account-id',
|
||||
'account-number' => 'account-id',
|
||||
'bill-id' => 'bill-id',
|
||||
'bill-name' => 'bill-id',
|
||||
'budget-id' => 'budget-id',
|
||||
'budget-name' => 'budget-id',
|
||||
'currency-id' => 'currency-id',
|
||||
'currency-name' => 'currency-id',
|
||||
'currency-code' => 'currency-id',
|
||||
'currency-symbol' => 'currency-id',
|
||||
'category-id' => 'category-id',
|
||||
'category-name' => 'category-id',
|
||||
'foreign-currency-id' => 'foreign-currency-id',
|
||||
'foreign-currency-code' => 'foreign-currency-id',
|
||||
'opposing-id' => 'opposing-id',
|
||||
'opposing-name' => 'opposing-id',
|
||||
'opposing-iban' => 'opposing-id',
|
||||
'opposing-number' => 'opposing-id',
|
||||
];
|
||||
if (!isset($roleMapping[$role])) {
|
||||
throw new FireflyException(sprintf('Cannot indicate new role for mapped role "%s"', $role)); // @codeCoverageIgnore
|
||||
}
|
||||
$newRole = $roleMapping[$role];
|
||||
Log::debug(sprintf('Role was "%s", but because of mapping (mapped to #%d), role becomes "%s"', $role, $mapped, $newRole));
|
||||
|
||||
// also store the $mapped values in a "mappedValues" array.
|
||||
|
@@ -45,6 +45,7 @@ class OpposingAccountMapper
|
||||
* @param array $data
|
||||
*
|
||||
* @return Account
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function map(?int $accountId, string $amount, array $data): Account
|
||||
{
|
||||
|
@@ -107,6 +107,7 @@ class StageImportDataHandler
|
||||
* @param LocalAccount $originalSource
|
||||
*
|
||||
* @return array
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
private function convertToArray(array $transactions, SpectreAccount $spectreAccount, LocalAccount $originalSource): array
|
||||
{
|
||||
|
Reference in New Issue
Block a user