Code cleanup.

This commit is contained in:
James Cole
2017-11-22 21:12:27 +01:00
parent 4e6b782204
commit 781ca052d8
142 changed files with 213 additions and 859 deletions

View File

@@ -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;
}
}

View File

@@ -127,7 +127,6 @@ class Preferences
{
$fullName = sprintf('preference%s%s', $user->id, $name);
if (Cache::has($fullName)) {
return Cache::get($fullName);
}

View File

@@ -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 '—';
}

View File

@@ -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
*/