mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Fix code structure
This commit is contained in:
		| @@ -43,8 +43,8 @@ class FixAccountTypes extends Command | ||||
| { | ||||
|     use ShowsFriendlyMessages; | ||||
| 
 | ||||
|     protected              $description = 'Make sure all journals have the correct from/to account types.'; | ||||
|     protected              $signature   = 'firefly-iii:fix-account-types'; | ||||
|     protected $description = 'Make sure all journals have the correct from/to account types.'; | ||||
|     protected $signature   = 'firefly-iii:fix-account-types'; | ||||
|     private int            $count; | ||||
|     private array          $expected; | ||||
|     private AccountFactory $factory; | ||||
| @@ -62,8 +62,7 @@ class FixAccountTypes extends Command | ||||
|         $this->expected = config('firefly.source_dests'); | ||||
|         $expected       = config('firefly.source_dests'); | ||||
| 
 | ||||
|         $query = TransactionJournal:: | ||||
|         leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id') | ||||
|         $query = TransactionJournal::leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id') | ||||
|                                    ->leftJoin( | ||||
|                                        'transactions as source', | ||||
|                                        static function (JoinClause $join) { | ||||
|   | ||||
| @@ -88,10 +88,10 @@ class Navigation | ||||
| 
 | ||||
|         if (!array_key_exists($repeatFreq, $functionMap)) { | ||||
|             Log::error(sprintf( | ||||
|                            'The periodicity %s is unknown. Choose one of available periodicity: %s', | ||||
|                            $repeatFreq, | ||||
|                            join(', ', array_keys($functionMap)) | ||||
|                        )); | ||||
|                 'The periodicity %s is unknown. Choose one of available periodicity: %s', | ||||
|                 $repeatFreq, | ||||
|                 join(', ', array_keys($functionMap)) | ||||
|             )); | ||||
|             return $theDate; | ||||
|         } | ||||
| 
 | ||||
|   | ||||
| @@ -72,17 +72,17 @@ class RecurrenceTransformer extends AbstractTransformer | ||||
|      */ | ||||
|     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->piggyRepos->setUser($recurrence->user); | ||||
|         $this->factory->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)); | ||||
|         $notes     = $this->repository->getNoteText($recurrence); | ||||
|         $reps      = 0 === (int)$recurrence->repetitions ? null : (int)$recurrence->repetitions; | ||||
|         Log::debug('Get basic data.'); | ||||
|         app('log')->debug('Get basic data.'); | ||||
| 
 | ||||
|         // basic data.
 | ||||
|         return [ | ||||
| @@ -118,7 +118,7 @@ class RecurrenceTransformer extends AbstractTransformer | ||||
|      */ | ||||
|     private function getRepetitions(Recurrence $recurrence): array | ||||
|     { | ||||
|         Log::debug('Now in getRepetitions().'); | ||||
|         app('log')->debug('Now in getRepetitions().'); | ||||
|         $fromDate = $recurrence->latest_date ?? $recurrence->first_date; | ||||
|         $return   = []; | ||||
| 
 | ||||
| @@ -157,7 +157,7 @@ class RecurrenceTransformer extends AbstractTransformer | ||||
|      */ | ||||
|     private function getTransactions(Recurrence $recurrence): array | ||||
|     { | ||||
|         Log::debug(sprintf('Now in %s', __METHOD__)); | ||||
|         app('log')->debug(sprintf('Now in %s', __METHOD__)); | ||||
|         $return = []; | ||||
|         // get all transactions:
 | ||||
|         /** @var RecurrenceTransaction $transaction */ | ||||
| @@ -246,7 +246,7 @@ class RecurrenceTransformer extends AbstractTransformer | ||||
|      */ | ||||
|     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['category_id']     = null; | ||||
|         $array['category_name']   = null; | ||||
|   | ||||
| @@ -344,8 +344,8 @@ class TransactionGroupTransformer extends AbstractTransformer | ||||
|                 ], | ||||
|             ]; | ||||
|         } catch (FireflyException $e) { | ||||
|             Log::error($e->getMessage()); | ||||
|             Log::error($e->getTraceAsString()); | ||||
|             app('log')->error($e->getMessage()); | ||||
|             app('log')->error($e->getTraceAsString()); | ||||
|             throw new FireflyException(sprintf('Transaction group #%d is broken. Please check out your log files.', $group->id), 0, $e); | ||||
|         } | ||||
| 
 | ||||
|   | ||||
| @@ -270,7 +270,7 @@ class TransactionGroupTransformer extends AbstractTransformer | ||||
|      */ | ||||
|     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) { | ||||
|             return null; | ||||
|         } | ||||
| @@ -301,7 +301,7 @@ class TransactionGroupTransformer extends AbstractTransformer | ||||
|         if (null === $string) { | ||||
|             return null; | ||||
|         } | ||||
|         //        Log::debug(sprintf('Now in date("%s")', $string));
 | ||||
|         //        app('log')->debug(sprintf('Now in date("%s")', $string));
 | ||||
|         if (10 === strlen($string)) { | ||||
|             return Carbon::createFromFormat('Y-m-d', $string, config('app.timezone')); | ||||
|         } | ||||
|   | ||||
| @@ -45,7 +45,7 @@ class WebhookMessageTransformer extends AbstractTransformer | ||||
|         try { | ||||
|             $json = json_encode($message->message, JSON_THROW_ON_ERROR); | ||||
|         } 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 [ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user