mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code cleanup
This commit is contained in:
@@ -50,7 +50,7 @@ class AccountList implements BinderInterface
|
||||
$list[] = (int)$entry;
|
||||
}
|
||||
$list = array_unique($list);
|
||||
if (count($list) === 0) {
|
||||
if (\count($list) === 0) {
|
||||
Log::error('Account list is empty.');
|
||||
throw new NotFoundHttpException; // @codeCoverageIgnore
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ class BudgetList implements BinderInterface
|
||||
$list[] = (int)$entry;
|
||||
}
|
||||
$list = array_unique($list);
|
||||
if (count($list) === 0) {
|
||||
if (\count($list) === 0) {
|
||||
throw new NotFoundHttpException; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class BudgetList implements BinderInterface
|
||||
->get();
|
||||
|
||||
// add empty budget if applicable.
|
||||
if (in_array(0, $list)) {
|
||||
if (\in_array(0, $list)) {
|
||||
$collection->push(new Budget);
|
||||
}
|
||||
|
||||
|
@@ -48,7 +48,7 @@ class CategoryList implements BinderInterface
|
||||
$list[] = (int)$entry;
|
||||
}
|
||||
$list = array_unique($list);
|
||||
if (count($list) === 0) {
|
||||
if (\count($list) === 0) {
|
||||
throw new NotFoundHttpException; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class CategoryList implements BinderInterface
|
||||
->get();
|
||||
|
||||
// add empty category if applicable.
|
||||
if (in_array(0, $list)) {
|
||||
if (\in_array(0, $list)) {
|
||||
$collection->push(new Category);
|
||||
}
|
||||
|
||||
|
@@ -47,7 +47,7 @@ class JournalList implements BinderInterface
|
||||
$list[] = (int)$entry;
|
||||
}
|
||||
$list = array_unique($list);
|
||||
if (count($list) === 0) {
|
||||
if (\count($list) === 0) {
|
||||
throw new NotFoundHttpException; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,7 @@ class TagList implements BinderInterface
|
||||
$list[] = strtolower(trim($entry));
|
||||
}
|
||||
$list = array_unique($list);
|
||||
if (count($list) === 0) {
|
||||
if (\count($list) === 0) {
|
||||
Log::error('Tag list is empty.');
|
||||
throw new NotFoundHttpException; // @codeCoverageIgnore
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class TagList implements BinderInterface
|
||||
|
||||
$collection = $allTags->filter(
|
||||
function (Tag $tag) use ($list) {
|
||||
return in_array(strtolower($tag->tag), $list);
|
||||
return \in_array(strtolower($tag->tag), $list);
|
||||
}
|
||||
);
|
||||
|
||||
|
@@ -58,7 +58,7 @@ class ChartColour
|
||||
*/
|
||||
public static function getColour(int $index): string
|
||||
{
|
||||
$index %= count(self::$colours);
|
||||
$index %= \count(self::$colours);
|
||||
$row = self::$colours[$index];
|
||||
|
||||
return sprintf('rgba(%d, %d, %d, 0.7)', $row[0], $row[1], $row[2]);
|
||||
|
@@ -59,7 +59,6 @@ class ExpandedForm
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function amountNoCurrency(string $name, $value = null, array $options = []): string
|
||||
@@ -129,7 +128,7 @@ class ExpandedForm
|
||||
$currencyId = (int)$account->getMeta('currency_id');
|
||||
$currency = $currencyRepos->findNull($currencyId);
|
||||
$role = $account->getMeta('accountRole');
|
||||
if (0 === strlen($role)) {
|
||||
if (0 === \strlen($role)) {
|
||||
$role = 'no_account_type'; // @codeCoverageIgnore
|
||||
}
|
||||
if (null === $currency) {
|
||||
@@ -159,14 +158,13 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param int $value
|
||||
* @param null $checked
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param int $value
|
||||
* @param null $checked
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function checkbox(string $name, $value = 1, $checked = null, $options = []): string
|
||||
{
|
||||
@@ -225,13 +223,12 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function date(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@@ -246,12 +243,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function file(string $name, array $options = []): string
|
||||
{
|
||||
@@ -264,13 +260,12 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function integer(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@@ -285,13 +280,12 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function location(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@@ -358,14 +352,13 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param array $list
|
||||
* @param null $selected
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param array $list
|
||||
* @param null $selected
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function multiCheckbox(string $name, array $list = [], $selected = null, array $options = []): string
|
||||
{
|
||||
@@ -381,14 +374,13 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param array $list
|
||||
* @param null $selected
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param array $list
|
||||
* @param null $selected
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function multiRadio(string $name, array $list = [], $selected = null, array $options = []): string
|
||||
{
|
||||
@@ -409,8 +401,8 @@ class ExpandedForm
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function nonSelectableAmount(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@@ -438,8 +430,8 @@ class ExpandedForm
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function nonSelectableBalance(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@@ -468,8 +460,7 @@ class ExpandedForm
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function number(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@@ -486,12 +477,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @param $name
|
||||
* @param string $type
|
||||
* @param string $name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function optionsList(string $type, string $name): string
|
||||
{
|
||||
@@ -510,12 +500,11 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function password(string $name, array $options = []): string
|
||||
{
|
||||
@@ -528,14 +517,13 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param array $list
|
||||
* @param null $selected
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param array $list
|
||||
* @param null $selected
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function select(string $name, array $list = [], $selected = null, array $options = []): string
|
||||
{
|
||||
@@ -550,13 +538,12 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function staticText(string $name, $value, array $options = []): string
|
||||
{
|
||||
@@ -569,13 +556,12 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function tags(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@@ -590,13 +576,12 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function text(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@@ -610,13 +595,12 @@ class ExpandedForm
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @param string $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function textarea(string $name, $value = null, array $options = []): string
|
||||
{
|
||||
@@ -718,6 +702,7 @@ class ExpandedForm
|
||||
* @return string
|
||||
*
|
||||
* @throws \FireflyIII\Exceptions\FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function currencyField(string $name, string $view, $value = null, array $options = []): string
|
||||
{
|
||||
|
@@ -61,7 +61,7 @@ class HaveAccounts implements ConfigurationInterface
|
||||
$currency = $currencyRepository->findNull($currencyId);
|
||||
$dbAccounts[$id] = [
|
||||
'account' => $dbAccount,
|
||||
'currency' => null === $currency ? $defaultCurrency : $currency,
|
||||
'currency' => $currency ?? $defaultCurrency,
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -82,10 +82,10 @@ class Map implements ConfigurationInterface
|
||||
continue;
|
||||
}
|
||||
$value = trim($row[$index]);
|
||||
if (strlen($value) > 0) {
|
||||
if (\strlen($value) > 0) {
|
||||
// we can do some preprocessing here,
|
||||
// which is exclusively to fix the tags:
|
||||
if (null !== $this->data[$index]['preProcessMap'] && strlen($this->data[$index]['preProcessMap']) > 0) {
|
||||
if (null !== $this->data[$index]['preProcessMap'] && \strlen($this->data[$index]['preProcessMap']) > 0) {
|
||||
/** @var PreProcessorInterface $preProcessor */
|
||||
$preProcessor = app($this->data[$index]['preProcessMap']);
|
||||
$result = $preProcessor->run($value);
|
||||
@@ -107,7 +107,7 @@ class Map implements ConfigurationInterface
|
||||
$this->data[$index]['values'] = array_unique($this->data[$index]['values']);
|
||||
asort($this->data[$index]['values']);
|
||||
// if the count of this array is zero, there is nothing to map.
|
||||
if (count($this->data[$index]['values']) === 0) {
|
||||
if (\count($this->data[$index]['values']) === 0) {
|
||||
unset($this->data[$index]);
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,7 @@ class Map implements ConfigurationInterface
|
||||
$specifics = $config['specifics'] ?? [];
|
||||
$names = array_keys($specifics);
|
||||
foreach ($names as $name) {
|
||||
if (!in_array($name, $this->validSpecifics)) {
|
||||
if (!\in_array($name, $this->validSpecifics)) {
|
||||
throw new FireflyException(sprintf('"%s" is not a valid class name', $name));
|
||||
}
|
||||
$class = config('csv.import_specifics.' . $name);
|
||||
@@ -309,7 +309,7 @@ class Map implements ConfigurationInterface
|
||||
{
|
||||
// is valid column?
|
||||
$validColumns = array_keys(config('csv.import_roles'));
|
||||
if (!in_array($column, $validColumns)) {
|
||||
if (!\in_array($column, $validColumns)) {
|
||||
throw new FireflyException(sprintf('"%s" is not a valid column.', $column));
|
||||
}
|
||||
|
||||
|
@@ -89,7 +89,7 @@ class Roles implements ConfigurationInterface
|
||||
foreach ($records as $row) {
|
||||
$row = array_values($row);
|
||||
$row = $this->processSpecifics($row);
|
||||
$count = count($row);
|
||||
$count = \count($row);
|
||||
$this->data['total'] = $count > $this->data['total'] ? $count : $this->data['total'];
|
||||
$this->processRow($row);
|
||||
}
|
||||
@@ -246,7 +246,7 @@ class Roles implements ConfigurationInterface
|
||||
if ('_ignore' !== $role) {
|
||||
++$assigned;
|
||||
}
|
||||
if (in_array($role, ['amount', 'amount_credit', 'amount_debit'])) {
|
||||
if (\in_array($role, ['amount', 'amount_credit', 'amount_debit'])) {
|
||||
$hasAmount = true;
|
||||
}
|
||||
if ($role === 'foreign-currency-code') {
|
||||
@@ -313,7 +313,7 @@ class Roles implements ConfigurationInterface
|
||||
{
|
||||
foreach ($row as $index => $value) {
|
||||
$value = trim($value);
|
||||
if (strlen($value) > 0) {
|
||||
if (\strlen($value) > 0) {
|
||||
$this->data['examples'][$index][] = $value;
|
||||
}
|
||||
}
|
||||
|
@@ -173,7 +173,7 @@ class UploadConfig implements ConfigurationInterface
|
||||
private function storeSpecifics(array $data, array $config): array
|
||||
{
|
||||
// loop specifics.
|
||||
if (isset($data['specifics']) && is_array($data['specifics'])) {
|
||||
if (isset($data['specifics']) && \is_array($data['specifics'])) {
|
||||
$names = array_keys($data['specifics']);
|
||||
foreach ($names as $name) {
|
||||
// verify their content.
|
||||
|
@@ -131,7 +131,6 @@ class BunqInformation implements InformationInterface
|
||||
$request->setSessionToken($sessionToken);
|
||||
$request->call();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,8 +138,7 @@ class BunqInformation implements InformationInterface
|
||||
* @param int $userId
|
||||
*
|
||||
* @return Collection
|
||||
*
|
||||
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function getMonetaryAccounts(SessionToken $sessionToken, int $userId): Collection
|
||||
{
|
||||
@@ -191,8 +189,7 @@ class BunqInformation implements InformationInterface
|
||||
|
||||
/**
|
||||
* @return SessionToken
|
||||
*
|
||||
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function startSession(): SessionToken
|
||||
{
|
||||
|
@@ -73,7 +73,7 @@ class Navigation
|
||||
// if period is 1M and diff in month is 2 and new DOM = 1, sub a day:
|
||||
$months = ['1M', 'month', 'monthly'];
|
||||
$difference = $date->month - $theDate->month;
|
||||
if (in_array($repeatFreq, $months) && 2 === $difference && 1 === $date->day) {
|
||||
if (\in_array($repeatFreq, $months) && 2 === $difference && 1 === $date->day) {
|
||||
$date->subDay();
|
||||
}
|
||||
|
||||
@@ -197,14 +197,14 @@ class Navigation
|
||||
if (isset($modifierMap[$repeatFreq])) {
|
||||
$currentEnd->$function($modifierMap[$repeatFreq]);
|
||||
|
||||
if (in_array($repeatFreq, $subDay)) {
|
||||
if (\in_array($repeatFreq, $subDay)) {
|
||||
$currentEnd->subDay();
|
||||
}
|
||||
|
||||
return $currentEnd;
|
||||
}
|
||||
$currentEnd->$function();
|
||||
if (in_array($repeatFreq, $subDay)) {
|
||||
if (\in_array($repeatFreq, $subDay)) {
|
||||
$currentEnd->subDay();
|
||||
}
|
||||
|
||||
|
@@ -150,7 +150,7 @@ class Modifier
|
||||
*/
|
||||
public static function stringCompare(string $haystack, string $needle): bool
|
||||
{
|
||||
$res = !(false === strpos(strtolower($haystack), strtolower($needle)));
|
||||
$res = !(false === stripos($haystack, $needle));
|
||||
Log::debug(sprintf('"%s" is in "%s"? %s', $needle, $haystack, var_export($res, true)));
|
||||
|
||||
return $res;
|
||||
|
@@ -63,8 +63,8 @@ class Search implements SearchInterface
|
||||
public function getWordsAsString(): string
|
||||
{
|
||||
$string = implode(' ', $this->words);
|
||||
if (0 === strlen($string)) {
|
||||
return is_string($this->originalQuery) ? $this->originalQuery : '';
|
||||
if (0 === \strlen($string)) {
|
||||
return \is_string($this->originalQuery) ? $this->originalQuery : '';
|
||||
}
|
||||
|
||||
return $string;
|
||||
@@ -94,7 +94,7 @@ class Search implements SearchInterface
|
||||
$filteredQuery = str_replace($match, '', $filteredQuery);
|
||||
}
|
||||
$filteredQuery = trim(str_replace(['"', "'"], '', $filteredQuery));
|
||||
if (strlen($filteredQuery) > 0) {
|
||||
if (\strlen($filteredQuery) > 0) {
|
||||
$this->words = array_map('trim', explode(' ', $filteredQuery));
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ class Search implements SearchInterface
|
||||
|
||||
// Update counters
|
||||
++$page;
|
||||
$processed += count($set);
|
||||
$processed += \count($set);
|
||||
|
||||
Log::debug(sprintf('Page is now %d, processed is %d', $page, $processed));
|
||||
|
||||
@@ -245,10 +245,10 @@ class Search implements SearchInterface
|
||||
private function extractModifier(string $string)
|
||||
{
|
||||
$parts = explode(':', $string);
|
||||
if (2 === count($parts) && strlen(trim((string)$parts[0])) > 0 && strlen(trim((string)$parts[1]))) {
|
||||
if (2 === \count($parts) && \strlen(trim((string)$parts[0])) > 0 && \strlen(trim((string)$parts[1]))) {
|
||||
$type = trim((string)$parts[0]);
|
||||
$value = trim((string)$parts[1]);
|
||||
if (in_array($type, $this->validModifiers)) {
|
||||
if (\in_array($type, $this->validModifiers)) {
|
||||
// filter for valid type
|
||||
$this->modifiers->push(['type' => $type, 'value' => $value]);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ class Search implements SearchInterface
|
||||
Log::debug(sprintf('Now at transaction #%d', $transaction->id));
|
||||
// first "modifier" is always the text of the search:
|
||||
// check descr of journal:
|
||||
if (count($this->words) > 0
|
||||
if (\count($this->words) > 0
|
||||
&& !$this->strposArray(strtolower((string)$transaction->description), $this->words)
|
||||
&& !$this->strposArray(strtolower((string)$transaction->transaction_description), $this->words)
|
||||
) {
|
||||
@@ -294,7 +294,7 @@ class Search implements SearchInterface
|
||||
*/
|
||||
private function strposArray(string $haystack, array $needle)
|
||||
{
|
||||
if (0 === strlen($haystack)) {
|
||||
if (0 === \strlen($haystack)) {
|
||||
return false;
|
||||
}
|
||||
foreach ($needle as $what) {
|
||||
|
@@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionType;
|
||||
use Lang;
|
||||
use Log;
|
||||
use Twig_Extension;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
|
||||
/**
|
||||
* Class Transaction.
|
||||
@@ -205,7 +206,7 @@ class Transaction extends Twig_Extension
|
||||
public function description(TransactionModel $transaction): string
|
||||
{
|
||||
$description = $transaction->description;
|
||||
if (strlen((string)$transaction->transaction_description) > 0) {
|
||||
if (\strlen((string)$transaction->transaction_description) > 0) {
|
||||
$description = $transaction->transaction_description . ' (' . $transaction->description . ')';
|
||||
}
|
||||
|
||||
@@ -278,7 +279,7 @@ class Transaction extends Twig_Extension
|
||||
public function hasAttachments(TransactionModel $transaction): string
|
||||
{
|
||||
$res = '';
|
||||
if (is_int($transaction->attachmentCount) && $transaction->attachmentCount > 0) {
|
||||
if (\is_int($transaction->attachmentCount) && $transaction->attachmentCount > 0) {
|
||||
$res = sprintf(
|
||||
'<i class="fa fa-paperclip" title="%s"></i>', Lang::choice(
|
||||
'firefly.nr_of_attachments',
|
||||
@@ -289,7 +290,7 @@ class Transaction extends Twig_Extension
|
||||
if ($transaction->attachmentCount === null) {
|
||||
$journalId = (int)$transaction->journal_id;
|
||||
$count = Attachment::whereNull('deleted_at')
|
||||
->where('attachable_type', 'FireflyIII\Models\TransactionJournal')
|
||||
->where('attachable_type', TransactionJournal::class)
|
||||
->where('attachable_id', $journalId)
|
||||
->count();
|
||||
if ($count > 0) {
|
||||
|
@@ -83,7 +83,7 @@ class TransactionJournal extends Twig_Extension
|
||||
if (null === $result) {
|
||||
return false;
|
||||
}
|
||||
if (strlen((string)$result) === 0) {
|
||||
if (\strlen((string)$result) === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -136,6 +136,6 @@ class TransactionJournal extends Twig_Extension
|
||||
$array[] = app('amount')->formatAnything($total['currency'], $total['amount']);
|
||||
}
|
||||
|
||||
return join(' / ', $array);
|
||||
return implode(' / ', $array);
|
||||
}
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ class General extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRoutePartial',
|
||||
function (): string {
|
||||
$args = func_get_args();
|
||||
$args = \func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
if (!(false === strpos($name, $route))) {
|
||||
@@ -101,7 +101,7 @@ class General extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRoutePartialWhat',
|
||||
function ($context): string {
|
||||
$args = func_get_args();
|
||||
$args = \func_get_args();
|
||||
$route = $args[1]; // name of the route.
|
||||
$what = $args[2]; // name of the route.
|
||||
$activeWhat = $context['what'] ?? false;
|
||||
@@ -127,7 +127,7 @@ class General extends Twig_Extension
|
||||
return new Twig_SimpleFunction(
|
||||
'activeRouteStrict',
|
||||
function (): string {
|
||||
$args = func_get_args();
|
||||
$args = \func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
|
||||
if (Route::getCurrentRoute()->getName() === $route) {
|
||||
|
@@ -192,7 +192,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 (0 === count($categories)) {
|
||||
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')
|
||||
|
Reference in New Issue
Block a user