mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup.
This commit is contained in:
@@ -258,7 +258,7 @@ class Roles implements ConfigurationInterface
|
||||
if ('_ignore' !== $role) {
|
||||
++$assigned;
|
||||
}
|
||||
if (in_array($role, ['amount','amount_credit','amount_debet'])) {
|
||||
if (in_array($role, ['amount', 'amount_credit', 'amount_debet'])) {
|
||||
$hasAmount = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,6 @@ class Preferences
|
||||
{
|
||||
$fullName = sprintf('preference%s%s', $user->id, $name);
|
||||
if (Cache::has($fullName)) {
|
||||
|
||||
return Cache::get($fullName);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class Transaction extends Twig_Extension
|
||||
$coloured = true;
|
||||
|
||||
// at this point amount is always negative.
|
||||
if ($transaction->transaction_type_type === TransactionType::RECONCILIATION && bccomp(strval($transaction->transaction_amount),'0') === 1) {
|
||||
if (TransactionType::RECONCILIATION === $transaction->transaction_type_type && 1 === bccomp(strval($transaction->transaction_amount), '0')) {
|
||||
$amount = bcmul($amount, '-1');
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ class Transaction extends Twig_Extension
|
||||
return $cache->get();
|
||||
}
|
||||
|
||||
if($transaction->transaction_type_type === TransactionType::RECONCILIATION) {
|
||||
if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) {
|
||||
return '—';
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ class Transaction extends Twig_Extension
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
}
|
||||
if($transaction->transaction_type_type === TransactionType::RECONCILIATION) {
|
||||
if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) {
|
||||
return '—';
|
||||
}
|
||||
|
||||
|
||||
@@ -148,21 +148,6 @@ class General extends Twig_Extension
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFilter
|
||||
*/
|
||||
protected function markdown(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'markdown',
|
||||
function (string $text): string {
|
||||
$converter = new CommonMarkConverter;
|
||||
|
||||
return $converter->convertToHtml($text);
|
||||
},['is_safe' => ['html']]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFilter
|
||||
*/
|
||||
@@ -181,7 +166,6 @@ class General extends Twig_Extension
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFunction
|
||||
*/
|
||||
@@ -244,6 +228,21 @@ class General extends Twig_Extension
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFilter
|
||||
*/
|
||||
protected function markdown(): Twig_SimpleFilter
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'markdown',
|
||||
function (string $text): string {
|
||||
$converter = new CommonMarkConverter;
|
||||
|
||||
return $converter->convertToHtml($text);
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Twig_SimpleFilter
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user