mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
I am changing some string concatenations to sprintf() routines because they are more readable and safer. [skip ci]
This commit is contained in:
@@ -99,7 +99,7 @@ class UpgradeDatabase extends Command
|
|||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
$this->error('Firefly III could not find the "identifier" field in the "transactions" table.');
|
$this->error('Firefly III could not find the "identifier" field in the "transactions" table.');
|
||||||
$this->error('This field is required for Firefly III version ' . config('firefly.version') . ' to run.');
|
$this->error(sprintf('This field is required for Firefly III version %s to run.', config('firefly.version')));
|
||||||
$this->error('Please run "php artisan migrate" to add this field to the table.');
|
$this->error('Please run "php artisan migrate" to add this field to the table.');
|
||||||
$this->info('Then, run "php artisan firefly:upgrade-database" to try again.');
|
$this->info('Then, run "php artisan firefly:upgrade-database" to try again.');
|
||||||
break 2;
|
break 2;
|
||||||
|
@@ -64,15 +64,14 @@ class UpgradeFireflyInstructions extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (is_null($text)) {
|
if (is_null($text)) {
|
||||||
$this->line('Thank you for installing Firefly III, v' . $version);
|
$this->line(sprintf('Thank you for installing Firefly III, v%s', $version));
|
||||||
$this->info('There are no extra upgrade instructions.');
|
$this->info('There are no extra upgrade instructions.');
|
||||||
$this->line('Firefly III should be ready for use.');
|
$this->line('Firefly III should be ready for use.');
|
||||||
} else {
|
} else {
|
||||||
$this->line('+------------------------------------------------------------------------------+');
|
$this->line('+------------------------------------------------------------------------------+');
|
||||||
$this->line('');
|
$this->line('');
|
||||||
$this->line('Thank you for installing Firefly III, v' . $version);
|
$this->line(sprintf('Thank you for installing Firefly III, v%s', $version));
|
||||||
$this->info(wordwrap($text));
|
$this->info(wordwrap($text));
|
||||||
$this->line('');
|
$this->line('');
|
||||||
$this->line('+------------------------------------------------------------------------------+');
|
$this->line('+------------------------------------------------------------------------------+');
|
||||||
|
@@ -54,7 +54,7 @@ class Navigation
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (!isset($functionMap[$repeatFreq])) {
|
if (!isset($functionMap[$repeatFreq])) {
|
||||||
throw new FireflyException('Cannot do addPeriod for $repeat_freq "' . $repeatFreq . '"');
|
throw new FireflyException(sprintf('Cannot do addPeriod for $repeat_freq "%s"', $repeatFreq));
|
||||||
}
|
}
|
||||||
if (isset($modifierMap[$repeatFreq])) {
|
if (isset($modifierMap[$repeatFreq])) {
|
||||||
$add = $add * $modifierMap[$repeatFreq];
|
$add = $add * $modifierMap[$repeatFreq];
|
||||||
@@ -108,7 +108,7 @@ class Navigation
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($functionMap[$repeatFreq])) {
|
if (!isset($functionMap[$repeatFreq])) {
|
||||||
throw new FireflyException('Cannot do endOfPeriod for $repeat_freq "' . $repeatFreq . '"');
|
throw new FireflyException(sprintf('Cannot do endOfPeriod for $repeat_freq "%s"', $repeatFreq));
|
||||||
}
|
}
|
||||||
$function = $functionMap[$repeatFreq];
|
$function = $functionMap[$repeatFreq];
|
||||||
if (isset($modifierMap[$repeatFreq])) {
|
if (isset($modifierMap[$repeatFreq])) {
|
||||||
@@ -202,7 +202,7 @@ class Navigation
|
|||||||
if (isset($formatMap[$repeatFrequency])) {
|
if (isset($formatMap[$repeatFrequency])) {
|
||||||
return $date->formatLocalized(strval($formatMap[$repeatFrequency]));
|
return $date->formatLocalized(strval($formatMap[$repeatFrequency]));
|
||||||
}
|
}
|
||||||
throw new FireflyException('No date formats for frequency "' . $repeatFrequency . '"!');
|
throw new FireflyException(sprintf('No date formats for frequency "%s"!', $repeatFrequency));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,7 +252,7 @@ class Navigation
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
throw new FireflyException('Cannot do startOfPeriod for $repeat_freq "' . $repeatFreq . '"');
|
throw new FireflyException(sprintf('Cannot do startOfPeriod for $repeat_freq "%s"', $repeatFreq));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -313,7 +313,7 @@ class Navigation
|
|||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new FireflyException('Cannot do subtractPeriod for $repeat_freq "' . $repeatFreq . '"');
|
throw new FireflyException(sprintf('Cannot do subtractPeriod for $repeat_freq "%s"', $repeatFreq));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -350,7 +350,7 @@ class Navigation
|
|||||||
|
|
||||||
return $end;
|
return $end;
|
||||||
}
|
}
|
||||||
throw new FireflyException('updateEndDate cannot handle $range "' . $range . '"');
|
throw new FireflyException(sprintf('updateEndDate cannot handle range "%s"', $range));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +387,7 @@ class Navigation
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
throw new FireflyException('updateStartDate cannot handle $range "' . $range . '"');
|
throw new FireflyException(sprintf('updateStartDate cannot handle range "%s"', $range));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ class Preferences
|
|||||||
*/
|
*/
|
||||||
public function delete($name): bool
|
public function delete($name): bool
|
||||||
{
|
{
|
||||||
$fullName = 'preference' . auth()->user()->id . $name;
|
$fullName = sprintf('preference%s%s', auth()->user()->id, $name);
|
||||||
if (Cache::has($fullName)) {
|
if (Cache::has($fullName)) {
|
||||||
Cache::forget($fullName);
|
Cache::forget($fullName);
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ class Preferences
|
|||||||
*/
|
*/
|
||||||
public function getForUser(User $user, $name, $default = null)
|
public function getForUser(User $user, $name, $default = null)
|
||||||
{
|
{
|
||||||
$fullName = 'preference' . $user->id . $name;
|
$fullName = sprintf('preference%s%s', $user->id, $name);
|
||||||
if (Cache::has($fullName)) {
|
if (Cache::has($fullName)) {
|
||||||
return Cache::get($fullName);
|
return Cache::get($fullName);
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ class Preferences
|
|||||||
*/
|
*/
|
||||||
public function setForUser(User $user, $name, $value): Preference
|
public function setForUser(User $user, $name, $value): Preference
|
||||||
{
|
{
|
||||||
$fullName = 'preference' . $user->id . $name;
|
$fullName = sprintf('preference%s%s', $user->id, $name);
|
||||||
Cache::forget($fullName);
|
Cache::forget($fullName);
|
||||||
$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data']);
|
$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data']);
|
||||||
|
|
||||||
|
@@ -125,7 +125,7 @@ class Transaction extends Twig_Extension
|
|||||||
&& bccomp($amount, bcmul($transactionAmount, '-1')) !== 0
|
&& bccomp($amount, bcmul($transactionAmount, '-1')) !== 0
|
||||||
) {
|
) {
|
||||||
// not equal?
|
// not equal?
|
||||||
return ' (' . Amount::formatWithCode($code, $amount, true) . ')';
|
return sprintf(' (%s)', Amount::formatWithCode($code, $amount, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
Reference in New Issue
Block a user