Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Replace string operators.
James Coled5240f7afd66
diff --git a/app/Console/Commands/System/OutputsInstructions.php b/app/Console/Commands/System/OutputsInstructions.phpindex e9cd25e5be..ae703f8399 100644--- a/app/Console/Commands/System/OutputsInstructions.php+++ b/app/Console/Commands/System/OutputsInstructions.php@@ -147,10 +147,7 @@ class OutputsInstructions extends Command*/private function showLine(): void{- $line = '+';- $line .= str_repeat('-', 78);- $line .= '+';- $this->line($line);+ $this->line(sprintf('+%s+', str_repeat('-', 78)));}/**diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.phpindex 6ea2ca32d2..620660c5ba 100644--- a/app/Http/Controllers/Json/IntroController.php+++ b/app/Http/Controllers/Json/IntroController.php@@ -41,7 +41,7 @@ class IntroController extends Controllerpublic function getIntroSteps(string $route, ?string $specificPage = null): JsonResponse{app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));- $specificPage ??= '';+ $specificPage ??= '';$steps = $this->getBasicSteps($route);$specificSteps = $this->getSpecificSteps($route, $specificPage);if (0 === count($specificSteps)) {@@ -55,8 +55,8 @@ class IntroController extends Controller// remove last step:array_pop($steps);// merge arrays and add last step again- $steps = array_merge($steps, $specificSteps);- $steps[] = $lastStep;+ $steps = array_merge($steps, $specificSteps);+ $steps[] = $lastStep;}if (!$this->hasOutroStep($route)) {$steps = array_merge($steps, $specificSteps);@@ -77,7 +77,7 @@ class IntroController extends Controllerreturn false;}- $hasStep = array_key_exists('outro', $elements);+ $hasStep = array_key_exists('outro', $elements);app('log')->debug('Elements is array', $elements);app('log')->debug('Keys is', array_keys($elements));@@ -94,10 +94,10 @@ class IntroController extends Controllerpublic function postEnable(string $route, ?string $specialPage = null): JsonResponse{$specialPage ??= '';- $route = str_replace('.', '_', $route);- $key = 'shown_demo_'.$route;+ $route = str_replace('.', '_', $route);+ $key = sprintf('shown_demo_%s', $route);if ('' !== $specialPage) {- $key .= '_'.$specialPage;+ $key = sprintf('%s_%s', $key, $specialPage);}app('log')->debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));app('preferences')->set($key, false);@@ -114,9 +114,9 @@ class IntroController extends Controllerpublic function postFinished(string $route, ?string $specialPage = null): JsonResponse{$specialPage ??= '';- $key = 'shown_demo_'.$route;+ $key = sprintf('shown_demo_%s', $route);if ('' !== $specialPage) {- $key .= '_'.$specialPage;+ $key = sprintf('%s_%s', $key, $specialPage);}app('log')->debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));app('preferences')->set($key, true);diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.phpindex b48e5f7b85..0a2cae44a1 100644--- a/app/Http/Controllers/Recurring/EditController.php+++ b/app/Http/Controllers/Recurring/EditController.php@@ -104,7 +104,7 @@ class EditController extends Controller$repetition = $recurrence->recurrenceRepetitions()->first();$currentRepType = $repetition->repetition_type;if ('' !== $repetition->repetition_moment) {- $currentRepType .= ','.$repetition->repetition_moment;+ $currentRepType = sprintf('%s,%s', $currentRepType,$repetition->repetition_moment);}// put previous url in session if not redirect from store (not "return_to_edit").diff --git a/app/Services/Internal/Update/GroupCloneService.php b/app/Services/Internal/Update/GroupCloneService.phpindex 53cfb14c44..4bb92e31d0 100644--- a/app/Services/Internal/Update/GroupCloneService.php+++ b/app/Services/Internal/Update/GroupCloneService.php@@ -117,10 +117,7 @@ class GroupCloneServiceprivate function cloneNote(Note $note, TransactionJournal $newJournal, int $oldGroupId): void{$newNote = $note->replicate();- $newNote->text .= sprintf(- "\n\n%s",- trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId])- );+ $newNote->text = sprintf("%s\n\n%s",$newNote->text, trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId]));$newNote->noteable_id = $newJournal->id;$newNote->save();}diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.phpindex ed52fa17d9..5f783af1c1 100644--- a/app/Support/CacheProperties.php+++ b/app/Support/CacheProperties.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Support;use Illuminate\Support\Collection;+use Illuminate\Support\Facades\Cache;/*** Class CacheProperties.@@ -55,7 +56,7 @@ class CacheProperties*/public function get(){- return \Cache::get($this->hash);+ return Cache::get($this->hash);}public function getHash(): string@@ -70,18 +71,18 @@ class CacheProperties}$this->hash();- return \Cache::has($this->hash);+ return Cache::has($this->hash);}private function hash(): void{- $content = '';+ $content = '';foreach ($this->properties as $property) {try {- $content .= \Safe\json_encode($property, JSON_THROW_ON_ERROR);+ $content = sprintf('%s%s', $content, \Safe\json_encode($property, JSON_THROW_ON_ERROR));} catch (\JsonException $e) {// @ignoreException- $content .= hash('sha256', (string) time());+ $content = sprintf('%s%s', $content, hash('sha256', (string) time()));}}$this->hash = substr(hash('sha256', $content), 0, 16);@@ -92,6 +93,6 @@ class CacheProperties*/public function store($data): void{- \Cache::forever($this->hash, $data);+ Cache::forever($this->hash, $data);}}