mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 20:25:28 +00:00
Code clean up.
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig;
|
||||
@@ -31,13 +30,11 @@ use Twig_SimpleFunction;
|
||||
|
||||
/**
|
||||
* Contains all amount formatting routines.
|
||||
*
|
||||
* @package FireflyIII\Support\Twig
|
||||
*/
|
||||
class AmountFormat extends Twig_Extension
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFilters(): array
|
||||
{
|
||||
@@ -48,7 +45,7 @@ class AmountFormat extends Twig_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctions(): array
|
||||
{
|
||||
@@ -74,7 +71,6 @@ class AmountFormat extends Twig_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Twig_SimpleFilter
|
||||
*/
|
||||
protected function formatAmount(): Twig_SimpleFilter
|
||||
@@ -102,7 +98,7 @@ class AmountFormat extends Twig_Extension
|
||||
function (AccountModel $account, string $amount, bool $coloured = true): string {
|
||||
$currencyId = intval($account->getMeta('currency_id'));
|
||||
|
||||
if ($currencyId !== 0) {
|
||||
if (0 !== $currencyId) {
|
||||
$currency = TransactionCurrency::find($currencyId);
|
||||
|
||||
return app('amount')->formatAnything($currency, $amount, $coloured);
|
||||
@@ -175,7 +171,6 @@ class AmountFormat extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'formatDestinationAfter',
|
||||
function (array $transaction): string {
|
||||
|
||||
// build fake currency for main amount.
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['transaction_currency_dp'];
|
||||
@@ -183,7 +178,7 @@ class AmountFormat extends Twig_Extension
|
||||
$string = app('amount')->formatAnything($format, $transaction['destination_account_after'], true);
|
||||
|
||||
// also append foreign amount for clarity:
|
||||
if (!is_null($transaction['foreign_destination_amount'])) {
|
||||
if (null !== $transaction['foreign_destination_amount']) {
|
||||
// build fake currency for foreign amount
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['foreign_currency_dp'];
|
||||
@@ -191,7 +186,6 @@ class AmountFormat extends Twig_Extension
|
||||
$string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_destination_amount'], true) . ')';
|
||||
}
|
||||
|
||||
|
||||
return $string;
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
@@ -206,7 +200,6 @@ class AmountFormat extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'formatDestinationBefore',
|
||||
function (array $transaction): string {
|
||||
|
||||
// build fake currency for main amount.
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['transaction_currency_dp'];
|
||||
@@ -226,7 +219,6 @@ class AmountFormat extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'formatSourceAfter',
|
||||
function (array $transaction): string {
|
||||
|
||||
// build fake currency for main amount.
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['transaction_currency_dp'];
|
||||
@@ -234,7 +226,7 @@ class AmountFormat extends Twig_Extension
|
||||
$string = app('amount')->formatAnything($format, $transaction['source_account_after'], true);
|
||||
|
||||
// also append foreign amount for clarity:
|
||||
if (!is_null($transaction['foreign_source_amount'])) {
|
||||
if (null !== $transaction['foreign_source_amount']) {
|
||||
// build fake currency for foreign amount
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['foreign_currency_dp'];
|
||||
@@ -242,7 +234,6 @@ class AmountFormat extends Twig_Extension
|
||||
$string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_source_amount'], true) . ')';
|
||||
}
|
||||
|
||||
|
||||
return $string;
|
||||
},
|
||||
['is_safe' => ['html']]
|
||||
@@ -257,7 +248,6 @@ class AmountFormat extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'formatSourceBefore',
|
||||
function (array $transaction): string {
|
||||
|
||||
// build fake currency for main amount.
|
||||
$format = new TransactionCurrency;
|
||||
$format->decimal_places = $transaction['transaction_currency_dp'];
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig\Extension;
|
||||
@@ -33,13 +32,10 @@ use Lang;
|
||||
use Twig_Extension;
|
||||
|
||||
/**
|
||||
* Class Transaction
|
||||
*
|
||||
* @package FireflyIII\Support\Twig\Extension
|
||||
* Class Transaction.
|
||||
*/
|
||||
class Transaction extends Twig_Extension
|
||||
{
|
||||
|
||||
/**
|
||||
* Can show the amount of a transaction, if that transaction has been collected by the journal collector.
|
||||
*
|
||||
@@ -61,16 +57,16 @@ class Transaction extends Twig_Extension
|
||||
$format = '%s';
|
||||
$coloured = true;
|
||||
|
||||
if ($transaction->transaction_type_type === TransactionType::DEPOSIT) {
|
||||
if (TransactionType::DEPOSIT === $transaction->transaction_type_type) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
if ($transaction->transaction_type_type === TransactionType::TRANSFER) {
|
||||
if (TransactionType::TRANSFER === $transaction->transaction_type_type) {
|
||||
$amount = app('steam')->positive($amount);
|
||||
$coloured = false;
|
||||
$format = '<span class="text-info">%s</span>';
|
||||
}
|
||||
if ($transaction->transaction_type_type === TransactionType::OPENING_BALANCE) {
|
||||
if (TransactionType::OPENING_BALANCE === $transaction->transaction_type_type) {
|
||||
$amount = strval($transaction->transaction_amount);
|
||||
}
|
||||
|
||||
@@ -79,15 +75,13 @@ class Transaction extends Twig_Extension
|
||||
$currency->decimal_places = $transaction->transaction_currency_dp;
|
||||
$str = sprintf($format, app('amount')->formatAnything($currency, $amount, $coloured));
|
||||
|
||||
|
||||
if (!is_null($transaction->transaction_foreign_amount)) {
|
||||
if (null !== $transaction->transaction_foreign_amount) {
|
||||
$amount = bcmul(app('steam')->positive(strval($transaction->transaction_foreign_amount)), '-1');
|
||||
if ($transaction->transaction_type_type === TransactionType::DEPOSIT) {
|
||||
if (TransactionType::DEPOSIT === $transaction->transaction_type_type) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
|
||||
if ($transaction->transaction_type_type === TransactionType::TRANSFER) {
|
||||
if (TransactionType::TRANSFER === $transaction->transaction_type_type) {
|
||||
$amount = app('steam')->positive($amount);
|
||||
$coloured = false;
|
||||
$format = '<span class="text-info">%s</span>';
|
||||
@@ -120,7 +114,7 @@ class Transaction extends Twig_Extension
|
||||
}
|
||||
|
||||
// first display amount:
|
||||
$amount = $transaction['journal_type'] === TransactionType::WITHDRAWAL ? $transaction['source_amount']
|
||||
$amount = TransactionType::WITHDRAWAL === $transaction['journal_type'] ? $transaction['source_amount']
|
||||
: $transaction['destination_amount'];
|
||||
$fakeCurrency = new TransactionCurrency;
|
||||
$fakeCurrency->decimal_places = $transaction['transaction_currency_dp'];
|
||||
@@ -128,8 +122,8 @@ class Transaction extends Twig_Extension
|
||||
$string = app('amount')->formatAnything($fakeCurrency, $amount, true);
|
||||
|
||||
// then display (if present) the foreign amount:
|
||||
if (!is_null($transaction['foreign_source_amount'])) {
|
||||
$amount = $transaction['journal_type'] === TransactionType::WITHDRAWAL ? $transaction['foreign_source_amount']
|
||||
if (null !== $transaction['foreign_source_amount']) {
|
||||
$amount = TransactionType::WITHDRAWAL === $transaction['journal_type'] ? $transaction['foreign_source_amount']
|
||||
: $transaction['foreign_destination_amount'];
|
||||
$fakeCurrency = new TransactionCurrency;
|
||||
$fakeCurrency->decimal_places = $transaction['foreign_currency_dp'];
|
||||
@@ -176,7 +170,7 @@ class Transaction extends Twig_Extension
|
||||
|
||||
// see if the transaction has a budget:
|
||||
$budgets = $transaction->budgets()->get();
|
||||
if ($budgets->count() === 0) {
|
||||
if (0 === $budgets->count()) {
|
||||
$budgets = $transaction->transactionJournal()->first()->budgets()->get();
|
||||
}
|
||||
if ($budgets->count() > 0) {
|
||||
@@ -231,7 +225,7 @@ class Transaction extends Twig_Extension
|
||||
|
||||
// see if the transaction has a category:
|
||||
$categories = $transaction->categories()->get();
|
||||
if ($categories->count() === 0) {
|
||||
if (0 === $categories->count()) {
|
||||
$categories = $transaction->transactionJournal()->first()->categories()->get();
|
||||
}
|
||||
if ($categories->count() > 0) {
|
||||
@@ -296,14 +290,14 @@ class Transaction extends Twig_Extension
|
||||
$type = $transaction->account_type;
|
||||
|
||||
// name is present in object, use that one:
|
||||
if (bccomp($transaction->transaction_amount, '0') === -1 && !is_null($transaction->opposing_account_id)) {
|
||||
if (bccomp($transaction->transaction_amount, '0') === -1 && null !== $transaction->opposing_account_id) {
|
||||
$name = $transaction->opposing_account_name;
|
||||
$transactionId = intval($transaction->opposing_account_id);
|
||||
$type = $transaction->opposing_account_type;
|
||||
}
|
||||
|
||||
// Find the opposing account and use that one:
|
||||
if (bccomp($transaction->transaction_amount, '0') === -1 && is_null($transaction->opposing_account_id)) {
|
||||
if (bccomp($transaction->transaction_amount, '0') === -1 && null === $transaction->opposing_account_id) {
|
||||
// if the amount is negative, find the opposing account and use that one:
|
||||
$journalId = $transaction->journal_id;
|
||||
/** @var TransactionModel $other */
|
||||
@@ -320,7 +314,7 @@ class Transaction extends Twig_Extension
|
||||
$type = $other->type;
|
||||
}
|
||||
|
||||
if ($type === AccountType::CASH) {
|
||||
if (AccountType::CASH === $type) {
|
||||
$txt = '<span class="text-success">(' . trans('firefly.cash') . ')</span>';
|
||||
$cache->store($txt);
|
||||
|
||||
@@ -418,7 +412,7 @@ class Transaction extends Twig_Extension
|
||||
return $cache->get();
|
||||
}
|
||||
$icon = '';
|
||||
if (intval($transaction->reconciled) === 1) {
|
||||
if (1 === intval($transaction->reconciled)) {
|
||||
$icon = '<i class="fa fa-check"></i>';
|
||||
}
|
||||
|
||||
@@ -477,13 +471,13 @@ class Transaction extends Twig_Extension
|
||||
$type = $transaction->account_type;
|
||||
|
||||
// name is present in object, use that one:
|
||||
if (bccomp($transaction->transaction_amount, '0') === 1 && !is_null($transaction->opposing_account_id)) {
|
||||
if (1 === bccomp($transaction->transaction_amount, '0') && null !== $transaction->opposing_account_id) {
|
||||
$name = $transaction->opposing_account_name;
|
||||
$transactionId = intval($transaction->opposing_account_id);
|
||||
$type = $transaction->opposing_account_type;
|
||||
}
|
||||
// Find the opposing account and use that one:
|
||||
if (bccomp($transaction->transaction_amount, '0') === 1 && is_null($transaction->opposing_account_id)) {
|
||||
if (1 === bccomp($transaction->transaction_amount, '0') && null === $transaction->opposing_account_id) {
|
||||
$journalId = $transaction->journal_id;
|
||||
/** @var TransactionModel $other */
|
||||
$other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)
|
||||
@@ -499,7 +493,7 @@ class Transaction extends Twig_Extension
|
||||
$type = $other->type;
|
||||
}
|
||||
|
||||
if ($type === AccountType::CASH) {
|
||||
if (AccountType::CASH === $type) {
|
||||
$txt = '<span class="text-success">(' . trans('firefly.cash') . ')</span>';
|
||||
$cache->store($txt);
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig\Extension;
|
||||
@@ -31,7 +30,6 @@ use Twig_Extension;
|
||||
|
||||
class TransactionJournal extends Twig_Extension
|
||||
{
|
||||
|
||||
/**
|
||||
* @param JournalModel $journal
|
||||
*
|
||||
@@ -63,7 +61,7 @@ class TransactionJournal extends Twig_Extension
|
||||
}
|
||||
$totals[$currencyId]['amount'] = bcadd($transaction->amount, $totals[$currencyId]['amount']);
|
||||
|
||||
if (!is_null($transaction->foreign_currency_id)) {
|
||||
if (null !== $transaction->foreign_currency_id) {
|
||||
$foreignId = $transaction->foreign_currency_id;
|
||||
$foreign = $transaction->foreignCurrency;
|
||||
if (!isset($totals[$foreignId])) {
|
||||
@@ -77,7 +75,7 @@ class TransactionJournal extends Twig_Extension
|
||||
}
|
||||
$array = [];
|
||||
foreach ($totals as $total) {
|
||||
if ($type === TransactionType::WITHDRAWAL) {
|
||||
if (TransactionType::WITHDRAWAL === $type) {
|
||||
$total['amount'] = bcmul($total['amount'], '-1');
|
||||
}
|
||||
$array[] = app('amount')->formatAnything($total['currency'], $total['amount']);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig;
|
||||
@@ -33,15 +32,10 @@ use Twig_SimpleFilter;
|
||||
use Twig_SimpleFunction;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class TwigSupport
|
||||
*
|
||||
* @package FireflyIII\Support
|
||||
* Class TwigSupport.
|
||||
*/
|
||||
class General extends Twig_Extension
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -51,12 +45,11 @@ class General extends Twig_Extension
|
||||
$this->balance(),
|
||||
$this->formatFilesize(),
|
||||
$this->mimeIcon(),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctions(): array
|
||||
{
|
||||
@@ -70,12 +63,11 @@ class General extends Twig_Extension
|
||||
$this->steamPositive(),
|
||||
$this->activeRoutePartial(),
|
||||
$this->activeRoutePartialWhat(),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
@@ -96,7 +88,7 @@ class General extends Twig_Extension
|
||||
$args = func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
if (!(strpos($name, $route) === false)) {
|
||||
if (!(false === strpos($name, $route))) {
|
||||
return 'active';
|
||||
}
|
||||
|
||||
@@ -121,7 +113,7 @@ class General extends Twig_Extension
|
||||
$what = $args[2]; // name of the route.
|
||||
$activeWhat = $context['what'] ?? false;
|
||||
|
||||
if ($what === $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) {
|
||||
if ($what === $activeWhat && !(false === strpos(Route::getCurrentRoute()->getName(), $route))) {
|
||||
return 'active';
|
||||
}
|
||||
|
||||
@@ -162,7 +154,7 @@ class General extends Twig_Extension
|
||||
return new Twig_SimpleFilter(
|
||||
'balance',
|
||||
function (?Account $account): string {
|
||||
if (is_null($account)) {
|
||||
if (null === $account) {
|
||||
return 'NULL';
|
||||
}
|
||||
$date = session('end', Carbon::now()->endOfMonth());
|
||||
@@ -193,7 +185,6 @@ class General extends Twig_Extension
|
||||
return new Twig_SimpleFilter(
|
||||
'filesize',
|
||||
function (int $size): string {
|
||||
|
||||
// less than one GB, more than one MB
|
||||
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
||||
return round($size / (1024 * 1024), 2) . ' MB';
|
||||
@@ -209,7 +200,6 @@ class General extends Twig_Extension
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig;
|
||||
@@ -34,14 +33,10 @@ use Twig_SimpleFilter;
|
||||
use Twig_SimpleFunction;
|
||||
|
||||
/**
|
||||
* Class Journal
|
||||
*
|
||||
* @package FireflyIII\Support\Twig
|
||||
* Class Journal.
|
||||
*/
|
||||
class Journal extends Twig_Extension
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
@@ -62,7 +57,7 @@ class Journal extends Twig_Extension
|
||||
$array = [];
|
||||
/** @var Account $entry */
|
||||
foreach ($list as $entry) {
|
||||
if ($entry->accountType->type === AccountType::CASH) {
|
||||
if (AccountType::CASH === $entry->accountType->type) {
|
||||
$array[] = '<span class="text-success">(cash)</span>';
|
||||
continue;
|
||||
}
|
||||
@@ -134,7 +129,7 @@ class Journal extends Twig_Extension
|
||||
$array = [];
|
||||
/** @var Account $entry */
|
||||
foreach ($list as $entry) {
|
||||
if ($entry->accountType->type === AccountType::CASH) {
|
||||
if (AccountType::CASH === $entry->accountType->type) {
|
||||
$array[] = '<span class="text-success">(cash)</span>';
|
||||
continue;
|
||||
}
|
||||
@@ -165,7 +160,6 @@ class Journal extends Twig_Extension
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
|
||||
$budgets = [];
|
||||
// get all budgets:
|
||||
foreach ($journal->budgets as $budget) {
|
||||
@@ -205,7 +199,7 @@ class Journal extends Twig_Extension
|
||||
foreach ($journal->categories as $category) {
|
||||
$categories[] = sprintf('<a title="%1$s" href="%2$s">%1$s</a>', e($category->name), route('categories.show', $category->id));
|
||||
}
|
||||
if (count($categories) === 0) {
|
||||
if (0 === count($categories)) {
|
||||
$set = Category::distinct()->leftJoin('category_transaction', 'categories.id', '=', 'category_transaction.category_id')
|
||||
->leftJoin('transactions', 'category_transaction.transaction_id', '=', 'transactions.id')
|
||||
->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig\Loader;
|
||||
@@ -27,13 +26,10 @@ use FireflyIII\Support\Twig\Extension\TransactionJournal;
|
||||
use Twig_RuntimeLoaderInterface;
|
||||
|
||||
/**
|
||||
* Class TransactionJournalLoader
|
||||
*
|
||||
* @package FireflyIII\Support\Twig\Extension
|
||||
* Class TransactionJournalLoader.
|
||||
*/
|
||||
class TransactionJournalLoader implements Twig_RuntimeLoaderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates the runtime implementation of a Twig element (filter/function/test).
|
||||
*
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig\Loader;
|
||||
@@ -27,13 +26,10 @@ use FireflyIII\Support\Twig\Extension\Transaction;
|
||||
use Twig_RuntimeLoaderInterface;
|
||||
|
||||
/**
|
||||
* Class TransactionLoader
|
||||
*
|
||||
* @package FireflyIII\Support\Twig\Extension
|
||||
* Class TransactionLoader.
|
||||
*/
|
||||
class TransactionLoader implements Twig_RuntimeLoaderInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates the runtime implementation of a Twig element (filter/function/test).
|
||||
*
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig;
|
||||
@@ -28,14 +27,10 @@ use Twig_Extension;
|
||||
use Twig_SimpleFunction;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class PiggyBank
|
||||
*
|
||||
* @package FireflyIII\Support\Twig
|
||||
* Class PiggyBank.
|
||||
*/
|
||||
class PiggyBank extends Twig_Extension
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig;
|
||||
@@ -28,13 +27,10 @@ use Twig_Extension;
|
||||
use Twig_SimpleFunction;
|
||||
|
||||
/**
|
||||
* Class Rule
|
||||
*
|
||||
* @package FireflyIII\Support\Twig
|
||||
* Class Rule.
|
||||
*/
|
||||
class Rule extends Twig_Extension
|
||||
{
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
@@ -84,7 +80,7 @@ class Rule extends Twig_Extension
|
||||
$ruleTriggers = array_keys(Config::get('firefly.rule-triggers'));
|
||||
$possibleTriggers = [];
|
||||
foreach ($ruleTriggers as $key) {
|
||||
if ($key !== 'user_action') {
|
||||
if ('user_action' !== $key) {
|
||||
$possibleTriggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice');
|
||||
}
|
||||
}
|
||||
@@ -93,7 +89,6 @@ class Rule extends Twig_Extension
|
||||
|
||||
return $possibleTriggers;
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig;
|
||||
@@ -28,9 +27,7 @@ use Twig_Extension;
|
||||
use Twig_SimpleFilter;
|
||||
|
||||
/**
|
||||
* Class Transaction
|
||||
*
|
||||
* @package FireflyIII\Support\Twig
|
||||
* Class Transaction.
|
||||
*/
|
||||
class Transaction extends Twig_Extension
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Twig;
|
||||
@@ -28,14 +27,10 @@ use Twig_SimpleFilter;
|
||||
use Twig_SimpleFunction;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class Budget
|
||||
*
|
||||
* @package FireflyIII\Support\Twig
|
||||
* Class Budget.
|
||||
*/
|
||||
class Translation extends Twig_Extension
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -54,20 +49,18 @@ class Translation extends Twig_Extension
|
||||
return $filters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
$this->journalLinkTranslation(),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user