mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 07:38:29 +00:00
Code cleanup
This commit is contained in:
@@ -113,7 +113,7 @@ class AutoCompleteController extends Controller
|
||||
$set = $collector->getJournals()->pluck('description', 'journal_id')->toArray();
|
||||
$return = [];
|
||||
foreach ($set as $id => $description) {
|
||||
$id = intval($id);
|
||||
$id = (int)$id;
|
||||
if ($id !== $except->id) {
|
||||
$return[] = [
|
||||
'id' => $id,
|
||||
|
||||
@@ -123,7 +123,7 @@ class BoxController extends Controller
|
||||
$set = $collector->getJournals();
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($set as $transaction) {
|
||||
$currencyId = intval($transaction->transaction_currency_id);
|
||||
$currencyId = (int)$transaction->transaction_currency_id;
|
||||
$incomes[$currencyId] = $incomes[$currencyId] ?? '0';
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], $transaction->transaction_amount);
|
||||
$sums[$currencyId] = $sums[$currencyId] ?? '0';
|
||||
|
||||
@@ -50,9 +50,6 @@ class ExchangeController extends Controller
|
||||
$rate = $repository->getExchangeRate($fromCurrency, $toCurrency, $date);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (null === $rate->id) {
|
||||
Log::debug(sprintf('No cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));
|
||||
|
||||
@@ -69,7 +66,7 @@ class ExchangeController extends Controller
|
||||
$return['amount'] = null;
|
||||
if (null !== $request->get('amount')) {
|
||||
// assume amount is in "from" currency:
|
||||
$return['amount'] = bcmul($request->get('amount'), strval($rate->rate), 12);
|
||||
$return['amount'] = bcmul($request->get('amount'), (string)$rate->rate, 12);
|
||||
// round to toCurrency decimal places:
|
||||
$return['amount'] = round($return['amount'], $toCurrency->decimal_places);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class FrontpageController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
||||
*/
|
||||
public function piggyBanks(PiggyBankRepositoryInterface $repository)
|
||||
{
|
||||
|
||||
@@ -76,14 +76,17 @@ class IntroController
|
||||
$routeKey = str_replace('.', '_', $route);
|
||||
Log::debug(sprintf('Has outro step for route %s', $routeKey));
|
||||
$elements = config(sprintf('intro.%s', $routeKey));
|
||||
if (!is_array($elements)) {
|
||||
if (!\is_array($elements)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$hasStep = array_key_exists('outro', $elements);
|
||||
|
||||
Log::debug('Elements is array', $elements);
|
||||
Log::debug('Keys is', array_keys($elements));
|
||||
Log::debug(sprintf('Keys has "outro": %s', var_export(in_array('outro', array_keys($elements)), true)));
|
||||
Log::debug(sprintf('Keys has "outro": %s', var_export($hasStep, true)));
|
||||
|
||||
return in_array('outro', array_keys($elements));
|
||||
return $hasStep;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user