Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Removed double method.
James Cole0f1ec7d00325
diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.phpindex d49171e3e1..62f99d89a6 100644--- a/app/Support/Twig/Journal.php+++ b/app/Support/Twig/Journal.php@@ -18,9 +18,7 @@ use Amount;use FireflyIII\Models\Account;use FireflyIII\Models\Budget as ModelBudget;use FireflyIII\Models\Category;-use FireflyIII\Models\Transaction;use FireflyIII\Models\TransactionJournal;-use FireflyIII\Models\TransactionType;use FireflyIII\Support\CacheProperties;use Twig_Extension;use Twig_SimpleFilter;@@ -184,8 +182,6 @@ class Journal extends Twig_Extension$this->formatBudgetPerspective(),$this->journalBudgets(),$this->journalCategories(),- $this->transactionBudgets(),- $this->transactionCategories(),];return $functions;@@ -316,68 +312,6 @@ class Journal extends Twig_Extension);}- /**- * @return Twig_SimpleFunction- */- public function transactionBudgets(): Twig_SimpleFunction- {- return new Twig_SimpleFunction(- 'transactionBudgets', function (Transaction $transaction): string {- $cache = new CacheProperties;- $cache->addProperty($transaction->id);- $cache->addProperty('transaction');- $cache->addProperty('budget-string');- if ($cache->has()) {- return $cache->get();- }-- $budgets = [];- // get all budgets:- foreach ($transaction->budgets as $budget) {- $budgets[] = '<a href="' . route('budgets.show', [$budget->id]) . '" title="' . e($budget->name) . '">' . e($budget->name) . '</a>';- }- $string = join(', ', array_unique($budgets));- $cache->store($string);-- return $string;--- }- );- }-- /**- * @return Twig_SimpleFunction- */- public function transactionCategories(): Twig_SimpleFunction- {- return new Twig_SimpleFunction(- 'transactionCategories', function (Transaction $transaction): string {- $cache = new CacheProperties;- $cache->addProperty($transaction->id);- $cache->addProperty('transaction');- $cache->addProperty('category-string');- if ($cache->has()) {- return $cache->get();- }--- $categories = [];- // get all budgets:- foreach ($transaction->categories as $category) {- $categories[] = '<a href="' . route('categories.show', [$category->id]) . '" title="' . e($category->name) . '">' . e($category->name) . '</a>';- }-- $string = join(', ', array_unique($categories));- $cache->store($string);-- return $string;--- }- );- }-/*** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's 5.*diff --git a/app/Support/Twig/Transaction.php b/app/Support/Twig/Transaction.phpindex 1baebdfc7a..234fee5b5a 100644--- a/app/Support/Twig/Transaction.php+++ b/app/Support/Twig/Transaction.php@@ -149,7 +149,7 @@ class Transaction extends Twig_Extensionif ($budgets->count() > 0) {$str = [];foreach ($budgets as $budget) {- $str[] = sprintf('<a href="%s" title="%s">%s</a>', route('budgets.show', $budget->id), $budget->name, $budget->name);+ $str[] = sprintf('<a href="%s" title="%s">%s</a>', route('budgets.show', [$budget->id]), $budget->name, $budget->name);}return join(', ', $str);@@ -176,7 +176,7 @@ class Transaction extends Twig_Extensionif ($categories->count() > 0) {$str = [];foreach ($categories as $category) {- $str[] = sprintf('<a href="%s" title="%s">%s</a>', route('categories.show', $category->id), $category->name, $category->name);+ $str[] = sprintf('<a href="%s" title="%s">%s</a>', route('categories.show', [$category->id]), $category->name, $category->name);}return join(', ', $str);@@ -219,7 +219,7 @@ class Transaction extends Twig_Extensionreturn '<span class="text-success">(cash)</span>';}- return '<a title="' . e($name) . '" href="' . route('accounts.show', $id) . '">' . e($name) . '</a>';+ return '<a title="' . e($name) . '" href="' . route('accounts.show', [$id]) . '">' . e($name) . '</a>';}, ['is_safe' => ['html']]);@@ -257,7 +257,7 @@ class Transaction extends Twig_Extensionreturn '<span class="text-success">(cash)</span>';}- return '<a title="' . e($name) . '" href="' . route('accounts.show', $id) . '">' . e($name) . '</a>';+ return '<a title="' . e($name) . '" href="' . route('accounts.show', [$id]) . '">' . e($name) . '</a>';}, ['is_safe' => ['html']]);