Fix code structure

This commit is contained in:
James Cole
2023-10-06 18:23:32 +02:00
parent 0ce34048cd
commit 8e183d8cad
7 changed files with 36 additions and 37 deletions

View File

@@ -226,16 +226,16 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v3.28.0", "version": "v3.34.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "113e09fea3d2306319ffaa2423fe3de768b28cff" "reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/113e09fea3d2306319ffaa2423fe3de768b28cff", "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3",
"reference": "113e09fea3d2306319ffaa2423fe3de768b28cff", "reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -309,7 +309,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.28.0" "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.1"
}, },
"funding": [ "funding": [
{ {
@@ -317,7 +317,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-09-22T20:43:40+00:00" "time": "2023-10-03T23:51:05+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@@ -917,16 +917,16 @@
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v6.3.3", "version": "v6.3.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e" "reference": "a1b31d88c0e998168ca7792f222cbecee47428c4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/9915db259f67d21eefee768c1abcf1cc61b1fc9e", "url": "https://api.github.com/repos/symfony/finder/zipball/a1b31d88c0e998168ca7792f222cbecee47428c4",
"reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e", "reference": "a1b31d88c0e998168ca7792f222cbecee47428c4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -961,7 +961,7 @@
"description": "Finds files and directories via an intuitive fluent interface", "description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/finder/tree/v6.3.3" "source": "https://github.com/symfony/finder/tree/v6.3.5"
}, },
"funding": [ "funding": [
{ {
@@ -977,7 +977,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-07-31T08:31:44+00:00" "time": "2023-09-26T12:56:25+00:00"
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
@@ -1745,16 +1745,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v6.3.2", "version": "v6.3.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "53d1a83225002635bca3482fcbf963001313fb68" "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339",
"reference": "53d1a83225002635bca3482fcbf963001313fb68", "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1811,7 +1811,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v6.3.2" "source": "https://github.com/symfony/string/tree/v6.3.5"
}, },
"funding": [ "funding": [
{ {
@@ -1827,7 +1827,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-07-05T08:41:27+00:00" "time": "2023-09-18T10:38:32+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],

View File

@@ -43,8 +43,8 @@ class FixAccountTypes extends Command
{ {
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
protected $description = 'Make sure all journals have the correct from/to account types.'; protected $description = 'Make sure all journals have the correct from/to account types.';
protected $signature = 'firefly-iii:fix-account-types'; protected $signature = 'firefly-iii:fix-account-types';
private int $count; private int $count;
private array $expected; private array $expected;
private AccountFactory $factory; private AccountFactory $factory;
@@ -62,8 +62,7 @@ class FixAccountTypes extends Command
$this->expected = config('firefly.source_dests'); $this->expected = config('firefly.source_dests');
$expected = config('firefly.source_dests'); $expected = config('firefly.source_dests');
$query = TransactionJournal:: $query = TransactionJournal::leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
->leftJoin( ->leftJoin(
'transactions as source', 'transactions as source',
static function (JoinClause $join) { static function (JoinClause $join) {

View File

@@ -88,10 +88,10 @@ class Navigation
if (!array_key_exists($repeatFreq, $functionMap)) { if (!array_key_exists($repeatFreq, $functionMap)) {
Log::error(sprintf( Log::error(sprintf(
'The periodicity %s is unknown. Choose one of available periodicity: %s', 'The periodicity %s is unknown. Choose one of available periodicity: %s',
$repeatFreq, $repeatFreq,
join(', ', array_keys($functionMap)) join(', ', array_keys($functionMap))
)); ));
return $theDate; return $theDate;
} }

View File

@@ -72,17 +72,17 @@ class RecurrenceTransformer extends AbstractTransformer
*/ */
public function transform(Recurrence $recurrence): array public function transform(Recurrence $recurrence): array
{ {
Log::debug('Now in Recurrence::transform()'); app('log')->debug('Now in Recurrence::transform()');
$this->repository->setUser($recurrence->user); $this->repository->setUser($recurrence->user);
$this->piggyRepos->setUser($recurrence->user); $this->piggyRepos->setUser($recurrence->user);
$this->factory->setUser($recurrence->user); $this->factory->setUser($recurrence->user);
$this->budgetRepos->setUser($recurrence->user); $this->budgetRepos->setUser($recurrence->user);
Log::debug('Set user.'); app('log')->debug('Set user.');
$shortType = (string)config(sprintf('firefly.transactionTypesToShort.%s', $recurrence->transactionType->type)); $shortType = (string)config(sprintf('firefly.transactionTypesToShort.%s', $recurrence->transactionType->type));
$notes = $this->repository->getNoteText($recurrence); $notes = $this->repository->getNoteText($recurrence);
$reps = 0 === (int)$recurrence->repetitions ? null : (int)$recurrence->repetitions; $reps = 0 === (int)$recurrence->repetitions ? null : (int)$recurrence->repetitions;
Log::debug('Get basic data.'); app('log')->debug('Get basic data.');
// basic data. // basic data.
return [ return [
@@ -118,7 +118,7 @@ class RecurrenceTransformer extends AbstractTransformer
*/ */
private function getRepetitions(Recurrence $recurrence): array private function getRepetitions(Recurrence $recurrence): array
{ {
Log::debug('Now in getRepetitions().'); app('log')->debug('Now in getRepetitions().');
$fromDate = $recurrence->latest_date ?? $recurrence->first_date; $fromDate = $recurrence->latest_date ?? $recurrence->first_date;
$return = []; $return = [];
@@ -157,7 +157,7 @@ class RecurrenceTransformer extends AbstractTransformer
*/ */
private function getTransactions(Recurrence $recurrence): array private function getTransactions(Recurrence $recurrence): array
{ {
Log::debug(sprintf('Now in %s', __METHOD__)); app('log')->debug(sprintf('Now in %s', __METHOD__));
$return = []; $return = [];
// get all transactions: // get all transactions:
/** @var RecurrenceTransaction $transaction */ /** @var RecurrenceTransaction $transaction */
@@ -246,7 +246,7 @@ class RecurrenceTransformer extends AbstractTransformer
*/ */
private function getTransactionMeta(RecurrenceTransaction $transaction, array $array): array private function getTransactionMeta(RecurrenceTransaction $transaction, array $array): array
{ {
Log::debug(sprintf('Now in %s', __METHOD__)); app('log')->debug(sprintf('Now in %s', __METHOD__));
$array['tags'] = []; $array['tags'] = [];
$array['category_id'] = null; $array['category_id'] = null;
$array['category_name'] = null; $array['category_name'] = null;

View File

@@ -344,8 +344,8 @@ class TransactionGroupTransformer extends AbstractTransformer
], ],
]; ];
} catch (FireflyException $e) { } catch (FireflyException $e) {
Log::error($e->getMessage()); app('log')->error($e->getMessage());
Log::error($e->getTraceAsString()); app('log')->error($e->getTraceAsString());
throw new FireflyException(sprintf('Transaction group #%d is broken. Please check out your log files.', $group->id), 0, $e); throw new FireflyException(sprintf('Transaction group #%d is broken. Please check out your log files.', $group->id), 0, $e);
} }

View File

@@ -270,7 +270,7 @@ class TransactionGroupTransformer extends AbstractTransformer
*/ */
private function stringFromArray(NullArrayObject $array, string $key, ?string $default): ?string private function stringFromArray(NullArrayObject $array, string $key, ?string $default): ?string
{ {
//Log::debug(sprintf('%s: %s', $key, var_export($array[$key], true))); //app('log')->debug(sprintf('%s: %s', $key, var_export($array[$key], true)));
if (null === $array[$key] && null === $default) { if (null === $array[$key] && null === $default) {
return null; return null;
} }
@@ -301,7 +301,7 @@ class TransactionGroupTransformer extends AbstractTransformer
if (null === $string) { if (null === $string) {
return null; return null;
} }
// Log::debug(sprintf('Now in date("%s")', $string)); // app('log')->debug(sprintf('Now in date("%s")', $string));
if (10 === strlen($string)) { if (10 === strlen($string)) {
return Carbon::createFromFormat('Y-m-d', $string, config('app.timezone')); return Carbon::createFromFormat('Y-m-d', $string, config('app.timezone'));
} }

View File

@@ -45,7 +45,7 @@ class WebhookMessageTransformer extends AbstractTransformer
try { try {
$json = json_encode($message->message, JSON_THROW_ON_ERROR); $json = json_encode($message->message, JSON_THROW_ON_ERROR);
} catch (JsonException $e) { } catch (JsonException $e) {
Log::error(sprintf('Could not encode webhook message #%d: %s', $message->id, $e->getMessage())); app('log')->error(sprintf('Could not encode webhook message #%d: %s', $message->id, $e->getMessage()));
} }
return [ return [