Code cleanup before release.

This commit is contained in:
James Cole
2018-03-29 19:01:47 +02:00
parent 40266c6821
commit 170d23d768
76 changed files with 181 additions and 171 deletions

View File

@@ -114,7 +114,7 @@ class Amount implements ConverterInterface
$str = preg_replace('/[^\-\(\)\.\,0-9 ]/', '', $value); $str = preg_replace('/[^\-\(\)\.\,0-9 ]/', '', $value);
$len = strlen($str); $len = strlen($str);
if ('(' === $str[0] && ')' === $str[$len - 1]) { if ('(' === $str[0] && ')' === $str[$len - 1]) {
$str = '-' . substr($str, 1, ($len - 2)); $str = '-' . substr($str, 1, $len - 2);
} }
Log::debug(sprintf('Stripped "%s" away to "%s"', $value, $str)); Log::debug(sprintf('Stripped "%s" away to "%s"', $value, $str));

View File

@@ -281,9 +281,8 @@ class CsvProcessor implements FileProcessorInterface
if (false === $json) { if (false === $json) {
throw new FireflyException(sprintf('Error while encoding JSON for CSV row: %s', $this->getJsonError($jsonError))); // @codeCoverageIgnore throw new FireflyException(sprintf('Error while encoding JSON for CSV row: %s', $this->getJsonError($jsonError))); // @codeCoverageIgnore
} }
$hash = hash('sha256', $json);
return $hash; return hash('sha256', $json);
} }
/** /**
@@ -340,11 +339,8 @@ class CsvProcessor implements FileProcessorInterface
{ {
$hash = $this->getRowHash($array); $hash = $this->getRowHash($array);
$count = $this->repository->countByHash($hash); $count = $this->repository->countByHash($hash);
if ($count > 0) {
return true;
}
return false; return $count > 0;
} }
/** /**

View File

@@ -54,7 +54,7 @@ class CommandHandler extends AbstractProcessingHandler
*/ */
protected function write(array $record) protected function write(array $record)
{ {
$this->command->line((string)trim($record['formatted'])); $this->command->line(trim($record['formatted']));
} }
/** /**

View File

@@ -53,6 +53,7 @@ class AssetAccountIbans implements MapperInterface
$list[$accountId] = $account->name; $list[$accountId] = $account->name;
} }
} }
/** @noinspection AdditionOperationOnArraysInspection */
$list = $topList + $list; $list = $topList + $list;
asort($list); asort($list);
$list = [0 => trans('import.map_do_not_map')] + $list; $list = [0 => trans('import.map_do_not_map')] + $list;

View File

@@ -183,7 +183,7 @@ class ImportJournal
$converter = app($class); $converter = app($class);
Log::debug(sprintf('Now launching converter %s', $class)); Log::debug(sprintf('Now launching converter %s', $class));
if ($converter->convert($modifier['value']) === -1) { if ($converter->convert($modifier['value']) === -1) {
$this->convertedAmount = Steam::negative($amount); $amount = Steam::negative($amount);
} }
Log::debug(sprintf('Foreign amount after conversion is %s', $amount)); Log::debug(sprintf('Foreign amount after conversion is %s', $amount));
} }
@@ -478,7 +478,5 @@ class ImportJournal
$preProcessor = app(sprintf('\FireflyIII\Import\MapperPreProcess\%s', $preProcessorClass)); $preProcessor = app(sprintf('\FireflyIII\Import\MapperPreProcess\%s', $preProcessorClass));
$tags = $preProcessor->run($array['value']); $tags = $preProcessor->run($array['value']);
$this->tags = array_merge($this->tags, $tags); $this->tags = array_merge($this->tags, $tags);
return;
} }
} }

View File

@@ -226,8 +226,6 @@ class BunqRoutine implements RoutineInterface
$config['stage'] = 'registered'; $config['stage'] = 'registered';
$this->setConfig($config); $this->setConfig($config);
$this->addStep(); $this->addStep();
return;
} }
/** /**
@@ -319,6 +317,8 @@ class BunqRoutine implements RoutineInterface
* @param string $expectedType * @param string $expectedType
* *
* @return Account * @return Account
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/ */
private function convertToAccount(LabelMonetaryAccount $party, string $expectedType): Account private function convertToAccount(LabelMonetaryAccount $party, string $expectedType): Account
{ {

View File

@@ -266,8 +266,6 @@ class FileRoutine implements RoutineInterface
private function setExtendedStatus(array $extended): void private function setExtendedStatus(array $extended): void
{ {
$this->repository->setExtendedStatus($this->job, $extended); $this->repository->setExtendedStatus($this->job, $extended);
return;
} }
/** /**

View File

@@ -343,8 +343,6 @@ class SpectreRoutine implements RoutineInterface
$this->setConfig($config); $this->setConfig($config);
$this->setStatus('configuring'); $this->setStatus('configuring');
$this->addStep(); $this->addStep();
return;
} }
/** /**
@@ -468,7 +466,7 @@ class SpectreRoutine implements RoutineInterface
// various meta fields: // various meta fields:
$importJournal->setValue(['role' => 'category-name', 'value' => $transaction->getCategory()]); $importJournal->setValue(['role' => 'category-name', 'value' => $transaction->getCategory()]);
$importJournal->setValue(['role' => 'note', 'value' => $notes]); $importJournal->setValue(['role' => 'note', 'value' => $notes]);
$importJournal->setValue(['role' => 'tags-comma', 'value' => join(',', $tags)]); $importJournal->setValue(['role' => 'tags-comma', 'value' => implode(',', $tags)]);
$collection->push($importJournal); $collection->push($importJournal);
} }
} }
@@ -521,7 +519,6 @@ class SpectreRoutine implements RoutineInterface
$this->setStatus('finished'); $this->setStatus('finished');
$this->addStep(); $this->addStep();
return;
} }
/** /**
@@ -538,7 +535,7 @@ class SpectreRoutine implements RoutineInterface
/** @var array $accountArray */ /** @var array $accountArray */
foreach ($accounts as $accountArray) { foreach ($accounts as $accountArray) {
$account = new Account($accountArray); $account = new Account($accountArray);
$importId = intval($config['accounts-mapped'][$account->getid()] ?? 0); $importId = intval($config['accounts-mapped'][$account->getId()] ?? 0);
$doImport = 0 !== $importId ? true : false; $doImport = 0 !== $importId ? true : false;
if (!$doImport) { if (!$doImport) {
Log::debug(sprintf('Will NOT import from Spectre account #%d ("%s")', $account->getId(), $account->getName())); Log::debug(sprintf('Will NOT import from Spectre account #%d ("%s")', $account->getId(), $account->getName()));
@@ -571,7 +568,6 @@ class SpectreRoutine implements RoutineInterface
{ {
$this->repository->setConfiguration($this->job, $config); $this->repository->setConfiguration($this->job, $config);
return;
} }
/** /**
@@ -583,7 +579,6 @@ class SpectreRoutine implements RoutineInterface
{ {
$this->repository->setExtendedStatus($this->job, $extended); $this->repository->setExtendedStatus($this->job, $extended);
return;
} }
/** /**

View File

@@ -182,7 +182,7 @@ class ImportStorage
*/ */
protected function storeImportJournal(int $index, ImportJournal $importJournal): bool protected function storeImportJournal(int $index, ImportJournal $importJournal): bool
{ {
Log::debug(sprintf('Going to store object #%d/%d with description "%s"', ($index + 1), $this->total, $importJournal->getDescription())); Log::debug(sprintf('Going to store object #%d/%d with description "%s"', $index + 1, $this->total, $importJournal->getDescription()));
$assetAccount = $importJournal->asset->getAccount(); $assetAccount = $importJournal->asset->getAccount();
$amount = $importJournal->getAmount(); $amount = $importJournal->getAmount();
$foreignAmount = $importJournal->getForeignAmount(); $foreignAmount = $importJournal->getForeignAmount();
@@ -370,7 +370,7 @@ class ImportStorage
} }
if ($names === $transfer['names']) { if ($names === $transfer['names']) {
++$hits; ++$hits;
Log::debug(sprintf('Involved accounts, "%s" equals "%s", hits = %d', join(',', $names), join(',', $transfer['names']), $hits)); Log::debug(sprintf('Involved accounts, "%s" equals "%s", hits = %d', implode(',', $names), implode(',', $transfer['names']), $hits));
} }
if (0 === bccomp($amount, $transfer['amount'])) { if (0 === bccomp($amount, $transfer['amount'])) {
++$hits; ++$hits;

View File

@@ -62,6 +62,7 @@ trait ImportSupport
* @param TransactionJournal $journal * @param TransactionJournal $journal
* *
* @return bool * @return bool
* @throws \FireflyIII\Exceptions\FireflyException
*/ */
protected function applyRules(TransactionJournal $journal): bool protected function applyRules(TransactionJournal $journal): bool
{ {
@@ -279,6 +280,7 @@ trait ImportSupport
* is not already present. * is not already present.
* *
* @return array * @return array
* @throws \InvalidArgumentException
*/ */
private function getTransfers(): array private function getTransfers(): array
{ {

View File

@@ -126,6 +126,8 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
/** /**
* Execute the job. * Execute the job.
*
* @throws \FireflyIII\Exceptions\FireflyException
*/ */
public function handle() public function handle()
{ {
@@ -168,6 +170,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
* Collects a list of rule processors, one for each rule within the rule group. * Collects a list of rule processors, one for each rule within the rule group.
* *
* @return array * @return array
* @throws \FireflyIII\Exceptions\FireflyException
*/ */
protected function collectProcessors() protected function collectProcessors()
{ {

View File

@@ -116,6 +116,7 @@ class Account extends Model
* @param string $value * @param string $value
* *
* @return Account * @return Account
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): Account public static function routeBinder(string $value): Account
{ {
@@ -210,6 +211,7 @@ class Account extends Model
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getNameAttribute($value): ?string public function getNameAttribute($value): ?string
{ {
@@ -274,9 +276,12 @@ class Account extends Model
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
* @deprecated * @deprecated
*
* @param EloquentBuilder $query * @param EloquentBuilder $query
* @param string $name * @param string $name
* @param string $value * @param string $value
*
* @throws \InvalidArgumentException
*/ */
public function scopeHasMetaValue(EloquentBuilder $query, $name, $value) public function scopeHasMetaValue(EloquentBuilder $query, $name, $value)
{ {
@@ -296,6 +301,7 @@ class Account extends Model
* @param $value * @param $value
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setIbanAttribute($value) public function setIbanAttribute($value)
{ {
@@ -306,6 +312,7 @@ class Account extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param $value * @param $value
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setNameAttribute($value) public function setNameAttribute($value)
{ {

View File

@@ -33,43 +33,43 @@ class AccountType extends Model
/** /**
* *
*/ */
const DEFAULT = 'Default account'; public const DEFAULT = 'Default account';
/** /**
* *
*/ */
const CASH = 'Cash account'; public const CASH = 'Cash account';
/** /**
* *
*/ */
const ASSET = 'Asset account'; public const ASSET = 'Asset account';
/** /**
* *
*/ */
const EXPENSE = 'Expense account'; public const EXPENSE = 'Expense account';
/** /**
* *
*/ */
const REVENUE = 'Revenue account'; public const REVENUE = 'Revenue account';
/** /**
* *
*/ */
const INITIAL_BALANCE = 'Initial balance account'; public const INITIAL_BALANCE = 'Initial balance account';
/** /**
* *
*/ */
const BENEFICIARY = 'Beneficiary account'; public const BENEFICIARY = 'Beneficiary account';
/** /**
* *
*/ */
const IMPORT = 'Import account'; public const IMPORT = 'Import account';
/** /**
* *
*/ */
const RECONCILIATION = 'Reconciliation account'; public const RECONCILIATION = 'Reconciliation account';
/** /**
* *
*/ */
const LOAN = 'Loan'; public const LOAN = 'Loan';
/** /**
* The attributes that should be casted to native types. * The attributes that should be casted to native types.
* *

View File

@@ -55,6 +55,7 @@ class Attachment extends Model
* @param string $value * @param string $value
* *
* @return Attachment * @return Attachment
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): Attachment public static function routeBinder(string $value): Attachment
{ {
@@ -96,6 +97,7 @@ class Attachment extends Model
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @return null|string * @return null|string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getDescriptionAttribute($value) public function getDescriptionAttribute($value)
{ {
@@ -111,6 +113,7 @@ class Attachment extends Model
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @return null|string * @return null|string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getFilenameAttribute($value) public function getFilenameAttribute($value)
{ {
@@ -126,6 +129,7 @@ class Attachment extends Model
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @return null|string * @return null|string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getMimeAttribute($value) public function getMimeAttribute($value)
{ {
@@ -141,6 +145,7 @@ class Attachment extends Model
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @return null|string * @return null|string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getTitleAttribute($value) public function getTitleAttribute($value)
{ {
@@ -164,6 +169,8 @@ class Attachment extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param string $value * @param string $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setDescriptionAttribute(string $value) public function setDescriptionAttribute(string $value)
{ {
@@ -174,6 +181,7 @@ class Attachment extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param string $value * @param string $value
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setFilenameAttribute(string $value) public function setFilenameAttribute(string $value)
{ {
@@ -184,6 +192,7 @@ class Attachment extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param string $value * @param string $value
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setMimeAttribute(string $value) public function setMimeAttribute(string $value)
{ {
@@ -194,6 +203,7 @@ class Attachment extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param string $value * @param string $value
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setTitleAttribute(string $value) public function setTitleAttribute(string $value)
{ {

View File

@@ -72,6 +72,7 @@ class Bill extends Model
* @param string $value * @param string $value
* *
* @return Bill * @return Bill
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): Bill public static function routeBinder(string $value): Bill
{ {
@@ -100,6 +101,7 @@ class Bill extends Model
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getMatchAttribute($value) public function getMatchAttribute($value)
{ {
@@ -116,6 +118,7 @@ class Bill extends Model
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getNameAttribute($value) public function getNameAttribute($value)
{ {
@@ -159,6 +162,7 @@ class Bill extends Model
* @param $value * @param $value
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setMatchAttribute($value) public function setMatchAttribute($value)
{ {
@@ -171,6 +175,7 @@ class Bill extends Model
* @param $value * @param $value
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setNameAttribute($value) public function setNameAttribute($value)
{ {

View File

@@ -87,6 +87,7 @@ class Budget extends Model
* @param string $value * @param string $value
* *
* @return Budget * @return Budget
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): Budget public static function routeBinder(string $value): Budget
{ {
@@ -115,6 +116,7 @@ class Budget extends Model
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getNameAttribute($value) public function getNameAttribute($value)
{ {
@@ -129,6 +131,8 @@ class Budget extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param $value * @param $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setNameAttribute($value) public function setNameAttribute($value)
{ {

View File

@@ -48,6 +48,7 @@ class BudgetLimit extends Model
* @param string $value * @param string $value
* *
* @return mixed * @return mixed
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): BudgetLimit public static function routeBinder(string $value): BudgetLimit
{ {

View File

@@ -86,6 +86,7 @@ class Category extends Model
* @param string $value * @param string $value
* *
* @return Category * @return Category
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): Category public static function routeBinder(string $value): Category
{ {
@@ -105,6 +106,7 @@ class Category extends Model
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getNameAttribute($value) public function getNameAttribute($value)
{ {
@@ -119,6 +121,8 @@ class Category extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param $value * @param $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setNameAttribute($value) public function setNameAttribute($value)
{ {

View File

@@ -179,6 +179,7 @@ class ImportJob extends Model
/** /**
* @return string * @return string
* *
* @throws \Illuminate\Contracts\Encryption\DecryptException
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/ */
public function uploadFileContents(): string public function uploadFileContents(): string

View File

@@ -64,6 +64,7 @@ class PiggyBank extends Model
* @param string $value * @param string $value
* *
* @return PiggyBank * @return PiggyBank
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): PiggyBank public static function routeBinder(string $value): PiggyBank
{ {
@@ -116,6 +117,7 @@ class PiggyBank extends Model
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getNameAttribute($value) public function getNameAttribute($value)
{ {
@@ -202,6 +204,8 @@ class PiggyBank extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param $value * @param $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setNameAttribute($value) public function setNameAttribute($value)
{ {

View File

@@ -84,6 +84,8 @@ class Preference extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param $value * @param $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setDataAttribute($value) public function setDataAttribute($value)
{ {

View File

@@ -52,6 +52,7 @@ class Rule extends Model
* @param string $value * @param string $value
* *
* @return Rule * @return Rule
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): Rule public static function routeBinder(string $value): Rule
{ {

View File

@@ -55,6 +55,7 @@ class RuleGroup extends Model
* @param string $value * @param string $value
* *
* @return RuleGroup * @return RuleGroup
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): RuleGroup public static function routeBinder(string $value): RuleGroup
{ {

View File

@@ -90,6 +90,7 @@ class Tag extends Model
* @param string $value * @param string $value
* *
* @return Tag * @return Tag
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): Tag public static function routeBinder(string $value): Tag
{ {
@@ -109,6 +110,7 @@ class Tag extends Model
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getDescriptionAttribute($value) public function getDescriptionAttribute($value)
{ {
@@ -125,6 +127,7 @@ class Tag extends Model
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getTagAttribute($value) public function getTagAttribute($value)
{ {
@@ -139,6 +142,8 @@ class Tag extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param $value * @param $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setDescriptionAttribute($value) public function setDescriptionAttribute($value)
{ {
@@ -149,6 +154,7 @@ class Tag extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param $value * @param $value
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setTagAttribute($value) public function setTagAttribute($value)
{ {

View File

@@ -137,6 +137,7 @@ class Transaction extends Model
* @param string $value * @param string $value
* *
* @return Transaction * @return Transaction
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): Transaction public static function routeBinder(string $value): Transaction
{ {

View File

@@ -57,6 +57,7 @@ class TransactionCurrency extends Model
* @param string $value * @param string $value
* *
* @return TransactionCurrency * @return TransactionCurrency
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): TransactionCurrency public static function routeBinder(string $value): TransactionCurrency
{ {

View File

@@ -88,6 +88,7 @@ class TransactionJournal extends Model
* @param string $value * @param string $value
* *
* @return TransactionJournal * @return TransactionJournal
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value): TransactionJournal public static function routeBinder(string $value): TransactionJournal
{ {
@@ -169,6 +170,7 @@ class TransactionJournal extends Model
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function getDescriptionAttribute($value) public function getDescriptionAttribute($value)
{ {
@@ -344,6 +346,8 @@ class TransactionJournal extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param $value * @param $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setDescriptionAttribute($value) public function setDescriptionAttribute($value)
{ {

View File

@@ -108,6 +108,8 @@ class TransactionJournalLink extends Model
* @codeCoverageIgnore * @codeCoverageIgnore
* *
* @param $value * @param $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/ */
public function setCommentAttribute($value): void public function setCommentAttribute($value): void
{ {

View File

@@ -36,23 +36,23 @@ class TransactionType extends Model
/** /**
* *
*/ */
const WITHDRAWAL = 'Withdrawal'; public const WITHDRAWAL = 'Withdrawal';
/** /**
* *
*/ */
const DEPOSIT = 'Deposit'; public const DEPOSIT = 'Deposit';
/** /**
* *
*/ */
const TRANSFER = 'Transfer'; public const TRANSFER = 'Transfer';
/** /**
* *
*/ */
const OPENING_BALANCE = 'Opening balance'; public const OPENING_BALANCE = 'Opening balance';
/** /**
* *
*/ */
const RECONCILIATION = 'Reconciliation'; public const RECONCILIATION = 'Reconciliation';
/** /**
* The attributes that should be casted to native types. * The attributes that should be casted to native types.
* *
@@ -71,6 +71,7 @@ class TransactionType extends Model
* @param string $type * @param string $type
* *
* @return Model|null|static * @return Model|null|static
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $type): TransactionType public static function routeBinder(string $type): TransactionType
{ {

View File

@@ -235,6 +235,7 @@ class AccountRepository implements AccountRepositoryInterface
/** /**
* Returns the date of the very first transaction in this account. * Returns the date of the very first transaction in this account.
* TODO refactor to nullable.
* *
* @param Account $account * @param Account $account
* *
@@ -242,12 +243,13 @@ class AccountRepository implements AccountRepositoryInterface
*/ */
public function oldestJournalDate(Account $account): Carbon public function oldestJournalDate(Account $account): Carbon
{ {
$result = new Carbon;
$journal = $this->oldestJournal($account); $journal = $this->oldestJournal($account);
if (null === $journal->id) { if (null !== $journal->id) {
return new Carbon; $result = $journal->date;
} }
return $journal->date; return $result;
} }
/** /**
@@ -262,6 +264,8 @@ class AccountRepository implements AccountRepositoryInterface
* @param array $data * @param array $data
* *
* @return Account * @return Account
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \FireflyIII\Exceptions\FireflyException
*/ */
public function store(array $data): Account public function store(array $data): Account
{ {
@@ -278,6 +282,8 @@ class AccountRepository implements AccountRepositoryInterface
* @param array $data * @param array $data
* *
* @return Account * @return Account
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \FireflyIII\Exceptions\FireflyException
*/ */
public function update(Account $account, array $data): Account public function update(Account $account, array $data): Account
{ {

View File

@@ -133,6 +133,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
* *
* @return string * @return string
* *
* @throws \Illuminate\Contracts\Encryption\DecryptException
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/ */
public function getContent(Attachment $attachment): string public function getContent(Attachment $attachment): string

View File

@@ -136,6 +136,7 @@ class BillRepository implements BillRepositoryInterface
* @param Collection $accounts * @param Collection $accounts
* *
* @return Collection * @return Collection
* @throws \InvalidArgumentException
*/ */
public function getBillsForAccounts(Collection $accounts): Collection public function getBillsForAccounts(Collection $accounts): Collection
{ {
@@ -221,7 +222,6 @@ class BillRepository implements BillRepositoryInterface
* @param Carbon $end * @param Carbon $end
* *
* @return string * @return string
* @throws \FireflyIII\Exceptions\FireflyException
*/ */
public function getBillsUnpaidInRange(Carbon $start, Carbon $end): string public function getBillsUnpaidInRange(Carbon $start, Carbon $end): string
{ {
@@ -276,6 +276,7 @@ class BillRepository implements BillRepositoryInterface
* @param int $size * @param int $size
* *
* @return LengthAwarePaginator * @return LengthAwarePaginator
* @throws \InvalidArgumentException
*/ */
public function getPaginator(int $size): LengthAwarePaginator public function getPaginator(int $size): LengthAwarePaginator
{ {

View File

@@ -252,6 +252,7 @@ class BudgetRepository implements BudgetRepositoryInterface
* @param Budget $budget * @param Budget $budget
* *
* @return Carbon * @return Carbon
* @throws \InvalidArgumentException
*/ */
public function firstUseDate(Budget $budget): Carbon public function firstUseDate(Budget $budget): Carbon
{ {
@@ -362,7 +363,7 @@ class BudgetRepository implements BudgetRepositoryInterface
*/ */
public function getBudgetLimits(Budget $budget, Carbon $start, Carbon $end): Collection public function getBudgetLimits(Budget $budget, Carbon $start, Carbon $end): Collection
{ {
$set = $budget->budgetLimits() $set = $budget->budgetlimits()
->where( ->where(
function (Builder $q5) use ($start, $end) { function (Builder $q5) use ($start, $end) {
$q5->where( $q5->where(

View File

@@ -210,6 +210,8 @@ class ImportJobRepository implements ImportJobRepositoryInterface
* @param UploadedFile $file * @param UploadedFile $file
* *
* @return bool * @return bool
* @throws \RuntimeException
* @throws \LogicException
*/ */
public function processConfiguration(ImportJob $job, UploadedFile $file): bool public function processConfiguration(ImportJob $job, UploadedFile $file): bool
{ {
@@ -247,6 +249,9 @@ class ImportJobRepository implements ImportJobRepositoryInterface
* *
* @return bool * @return bool
* *
* @throws \RuntimeException
* @throws \LogicException
* @throws \Illuminate\Contracts\Encryption\EncryptException
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/ */
public function processFile(ImportJob $job, ?UploadedFile $file): bool public function processFile(ImportJob $job, ?UploadedFile $file): bool

View File

@@ -129,13 +129,13 @@ class RuleRepository implements RuleRepositoryInterface
$order = $rule->order; $order = $rule->order;
// find the rule with order+1 and give it order-1 // find the rule with order+1 and give it order-1
$other = $rule->ruleGroup->rules()->where('order', ($order + 1))->first(); $other = $rule->ruleGroup->rules()->where('order', $order + 1)->first();
if ($other) { if ($other) {
$other->order = $other->order - 1; --$other->order;
$other->save(); $other->save();
} }
$rule->order = ($rule->order + 1); ++$rule->order;
$rule->save(); $rule->save();
$this->resetRulesInGroupOrder($rule->ruleGroup); $this->resetRulesInGroupOrder($rule->ruleGroup);
@@ -152,13 +152,13 @@ class RuleRepository implements RuleRepositoryInterface
$order = $rule->order; $order = $rule->order;
// find the rule with order-1 and give it order+1 // find the rule with order-1 and give it order+1
$other = $rule->ruleGroup->rules()->where('order', ($order - 1))->first(); $other = $rule->ruleGroup->rules()->where('order', $order - 1)->first();
if ($other) { if ($other) {
$other->order = ($other->order + 1); ++$other->order;
$other->save(); $other->save();
} }
$rule->order = ($rule->order - 1); --$rule->order;
$rule->save(); $rule->save();
$this->resetRulesInGroupOrder($rule->ruleGroup); $this->resetRulesInGroupOrder($rule->ruleGroup);

View File

@@ -185,13 +185,13 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
$order = $ruleGroup->order; $order = $ruleGroup->order;
// find the rule with order+1 and give it order-1 // find the rule with order+1 and give it order-1
$other = $this->user->ruleGroups()->where('order', ($order + 1))->first(); $other = $this->user->ruleGroups()->where('order', $order + 1)->first();
if ($other) { if ($other) {
$other->order = ($other->order - 1); --$other->order;
$other->save(); $other->save();
} }
$ruleGroup->order = ($ruleGroup->order + 1); ++$ruleGroup->order;
$ruleGroup->save(); $ruleGroup->save();
$this->resetRuleGroupOrder(); $this->resetRuleGroupOrder();
@@ -208,13 +208,13 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
$order = $ruleGroup->order; $order = $ruleGroup->order;
// find the rule with order-1 and give it order+1 // find the rule with order-1 and give it order+1
$other = $this->user->ruleGroups()->where('order', ($order - 1))->first(); $other = $this->user->ruleGroups()->where('order', $order - 1)->first();
if ($other) { if ($other) {
$other->order = ($other->order + 1); ++$other->order;
$other->save(); $other->save();
} }
$ruleGroup->order = ($ruleGroup->order - 1); --$ruleGroup->order;
$ruleGroup->save(); $ruleGroup->save();
$this->resetRuleGroupOrder(); $this->resetRuleGroupOrder();
@@ -286,7 +286,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
'user_id' => $this->user->id, 'user_id' => $this->user->id,
'title' => $data['title'], 'title' => $data['title'],
'description' => $data['description'], 'description' => $data['description'],
'order' => ($order + 1), 'order' => $order + 1,
'active' => 1, 'active' => 1,
] ]
); );

View File

@@ -47,6 +47,8 @@ class DeviceServer extends BunqObject
* DeviceServer constructor. * DeviceServer constructor.
* *
* @param array $data * @param array $data
*
* @throws \InvalidArgumentException
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {

View File

@@ -74,6 +74,8 @@ class MonetaryAccountBank extends BunqObject
* MonetaryAccountBank constructor. * MonetaryAccountBank constructor.
* *
* @param array $data * @param array $data
*
* @throws \InvalidArgumentException
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {

View File

@@ -60,6 +60,8 @@ class Payment extends BunqObject
* Payment constructor. * Payment constructor.
* *
* @param array $data * @param array $data
*
* @throws \InvalidArgumentException
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {

View File

@@ -94,6 +94,8 @@ class UserCompany extends BunqObject
* UserCompany constructor. * UserCompany constructor.
* *
* @param array $data * @param array $data
*
* @throws \InvalidArgumentException
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {

View File

@@ -56,6 +56,8 @@ class UserLight extends BunqObject
* UserLight constructor. * UserLight constructor.
* *
* @param array $data * @param array $data
*
* @throws \InvalidArgumentException
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {

View File

@@ -116,6 +116,8 @@ class UserPerson extends BunqObject
* UserPerson constructor. * UserPerson constructor.
* *
* @param array $data * @param array $data
*
* @throws \InvalidArgumentException
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {

View File

@@ -178,7 +178,7 @@ abstract class BunqRequest
$userAgent = sprintf('FireflyIII v%s', config('firefly.version')); $userAgent = sprintf('FireflyIII v%s', config('firefly.version'));
return [ return [
'X-Bunq-Client-Request-Id' => uniqid('FFIII'), 'X-Bunq-Client-Request-Id' => uniqid('FFIII', true),
'Cache-Control' => 'no-cache', 'Cache-Control' => 'no-cache',
'User-Agent' => $userAgent, 'User-Agent' => $userAgent,
'X-Bunq-Language' => 'en_US', 'X-Bunq-Language' => 'en_US',

View File

@@ -95,6 +95,8 @@ class BunqToken
/** /**
* @param array $response * @param array $response
*
* @throws \InvalidArgumentException
*/ */
protected function makeTokenFromResponse(array $response): void protected function makeTokenFromResponse(array $response): void
{ {

View File

@@ -218,7 +218,7 @@ trait AccountServiceTrait
*/ */
public function storeOpposingAccount(User $user, string $name): Account public function storeOpposingAccount(User $user, string $name): Account
{ {
$name = $name . ' initial balance'; $name .= ' initial balance';
Log::debug('Going to create an opening balance opposing account.'); Log::debug('Going to create an opening balance opposing account.');
/** @var AccountFactory $factory */ /** @var AccountFactory $factory */
$factory = app(AccountFactory::class); $factory = app(AccountFactory::class);

View File

@@ -154,8 +154,8 @@ class TransactionUpdateService
*/ */
public function updateCategory(Transaction $transaction, string $category): Transaction public function updateCategory(Transaction $transaction, string $category): Transaction
{ {
$category = $this->findCategory(0, $category); $found = $this->findCategory(0, $category);
$this->setCategory($transaction, $category); $this->setCategory($transaction, $found);
return $transaction; return $transaction;
} }

View File

@@ -50,10 +50,7 @@ class PwndVerifier implements Verifier
return true; return true;
} }
Log::debug(sprintf('Status code returned is %d', $result->status_code)); Log::debug(sprintf('Status code returned is %d', $result->status_code));
if (404 === $result->status_code) {
return true;
}
return false; return 404 === $result->status_code;
} }
} }

View File

@@ -40,6 +40,8 @@ class ListLoginsRequest extends SpectreRequest
/** /**
* *
* @throws \FireflyIII\Services\Spectre\Exception\SpectreException
* @throws \FireflyIII\Exceptions\FireflyException
*/ */
public function call(): void public function call(): void
{ {

View File

@@ -55,6 +55,8 @@ abstract class SpectreRequest
* *
* @param User $user * @param User $user
* *
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Illuminate\Container\EntryNotFoundException * @throws \Illuminate\Container\EntryNotFoundException
*/ */
public function __construct(User $user) public function __construct(User $user)
@@ -180,7 +182,6 @@ abstract class SpectreRequest
* @return array * @return array
* *
* @throws FireflyException * @throws FireflyException
* @throws SpectreException
*/ */
protected function sendSignedSpectreGet(string $uri, array $data): array protected function sendSignedSpectreGet(string $uri, array $data): array
{ {
@@ -224,7 +225,6 @@ abstract class SpectreRequest
* @return array * @return array
* *
* @throws FireflyException * @throws FireflyException
* @throws SpectreException
*/ */
protected function sendSignedSpectrePost(string $uri, array $data): array protected function sendSignedSpectrePost(string $uri, array $data): array
{ {

View File

@@ -166,7 +166,7 @@ class Amount
$cache->addProperty('getCurrencyCode'); $cache->addProperty('getCurrencyCode');
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); // @codeCoverageIgnore return $cache->get(); // @codeCoverageIgnore
} else { }
$currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR')); $currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR'));
$currency = TransactionCurrency::where('code', $currencyPreference->data)->first(); $currency = TransactionCurrency::where('code', $currencyPreference->data)->first();
@@ -177,8 +177,7 @@ class Amount
} }
$cache->store(config('firefly.default_currency', 'EUR')); $cache->store(config('firefly.default_currency', 'EUR'));
return strval(config('firefly.default_currency', 'EUR')); return (string)config('firefly.default_currency', 'EUR');
}
} }
/** /**

View File

@@ -39,6 +39,7 @@ class AccountList implements BinderInterface
* @param Route $route * @param Route $route
* *
* @return Collection * @return Collection
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value, Route $route): Collection public static function routeBinder(string $value, Route $route): Collection
{ {

View File

@@ -37,6 +37,7 @@ class BudgetList implements BinderInterface
* @param Route $route * @param Route $route
* *
* @return Collection * @return Collection
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value, Route $route): Collection public static function routeBinder(string $value, Route $route): Collection
{ {

View File

@@ -37,6 +37,7 @@ class CategoryList implements BinderInterface
* @param Route $route * @param Route $route
* *
* @return Collection * @return Collection
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value, Route $route): Collection public static function routeBinder(string $value, Route $route): Collection
{ {

View File

@@ -36,6 +36,7 @@ class CurrencyCode implements BinderInterface
* @param Route $route * @param Route $route
* *
* @return TransactionCurrency * @return TransactionCurrency
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value, Route $route): TransactionCurrency public static function routeBinder(string $value, Route $route): TransactionCurrency
{ {

View File

@@ -39,6 +39,7 @@ class Date implements BinderInterface
* @param Route $route * @param Route $route
* *
* @return Carbon * @return Carbon
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value, Route $route): Carbon public static function routeBinder(string $value, Route $route): Carbon
{ {

View File

@@ -36,6 +36,7 @@ class JournalList implements BinderInterface
* @param Route $route * @param Route $route
* *
* @return mixed * @return mixed
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value, Route $route): Collection public static function routeBinder(string $value, Route $route): Collection
{ {

View File

@@ -39,6 +39,7 @@ class TagList implements BinderInterface
* @param Route $route * @param Route $route
* *
* @return Collection * @return Collection
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value, Route $route): Collection public static function routeBinder(string $value, Route $route): Collection
{ {

View File

@@ -36,6 +36,7 @@ class UnfinishedJournal implements BinderInterface
* @param Route $route * @param Route $route
* *
* @return TransactionJournal * @return TransactionJournal
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/ */
public static function routeBinder(string $value, Route $route): TransactionJournal public static function routeBinder(string $value, Route $route): TransactionJournal
{ {

View File

@@ -58,7 +58,7 @@ class ChartColour
*/ */
public static function getColour(int $index): string public static function getColour(int $index): string
{ {
$index = $index % count(self::$colours); $index %= count(self::$colours);
$row = self::$colours[$index]; $row = self::$colours[$index];
return sprintf('rgba(%d, %d, %d, 0.7)', $row[0], $row[1], $row[2]); return sprintf('rgba(%d, %d, %d, 0.7)', $row[0], $row[1], $row[2]);

View File

@@ -354,8 +354,7 @@ class ExpandedForm
$value = $this->fillFieldValue($name, $value); $value = $this->fillFieldValue($name, $value);
$options['step'] = 'any'; $options['step'] = 'any';
$selectedCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency(); $selectedCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();
unset($options['currency']); unset($options['currency'], $options['placeholder']);
unset($options['placeholder']);
// make sure value is formatted nicely: // make sure value is formatted nicely:
if (null !== $value && '' !== $value) { if (null !== $value && '' !== $value) {
@@ -384,8 +383,7 @@ class ExpandedForm
$value = $this->fillFieldValue($name, $value); $value = $this->fillFieldValue($name, $value);
$options['step'] = 'any'; $options['step'] = 'any';
$selectedCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency(); $selectedCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();
unset($options['currency']); unset($options['currency'], $options['placeholder']);
unset($options['placeholder']);
// make sure value is formatted nicely: // make sure value is formatted nicely:
if (null !== $value && '' !== $value) { if (null !== $value && '' !== $value) {
@@ -479,8 +477,7 @@ class ExpandedForm
$options = $this->expandOptionArray($name, $label, $options); $options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name); $classes = $this->getHolderClasses($name);
$selected = $this->fillFieldValue($name, $selected); $selected = $this->fillFieldValue($name, $selected);
unset($options['autocomplete']); unset($options['autocomplete'], $options['placeholder']);
unset($options['placeholder']);
$html = view('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render(); $html = view('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render();
return $html; return $html;
@@ -666,8 +663,7 @@ class ExpandedForm
$options['step'] = 'any'; $options['step'] = 'any';
$defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency(); $defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();
$currencies = app('amount')->getAllCurrencies(); $currencies = app('amount')->getAllCurrencies();
unset($options['currency']); unset($options['currency'], $options['placeholder']);
unset($options['placeholder']);
// perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount) // perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount)
$preFilled = session('preFilled'); $preFilled = session('preFilled');

View File

@@ -65,7 +65,7 @@ class Navigation
throw new FireflyException(sprintf('Cannot do addPeriod for $repeat_freq "%s"', $repeatFreq)); throw new FireflyException(sprintf('Cannot do addPeriod for $repeat_freq "%s"', $repeatFreq));
} }
if (isset($modifierMap[$repeatFreq])) { if (isset($modifierMap[$repeatFreq])) {
$add = $add * $modifierMap[$repeatFreq]; $add *= $modifierMap[$repeatFreq];
} }
$function = $functionMap[$repeatFreq]; $function = $functionMap[$repeatFreq];
$date->$function($add); $date->$function($add);
@@ -99,7 +99,7 @@ class Navigation
*/ */
$perMonthEnd = clone $end; $perMonthEnd = clone $end;
$perMonthStart = clone $end; $perMonthStart = clone $end;
$perMonthStart->startOfyear()->subYear(); $perMonthStart->startOfYear()->subYear();
$perMonthStart = $start->lt($perMonthStart) ? $perMonthStart : $start; $perMonthStart = $start->lt($perMonthStart) ? $perMonthStart : $start;
// loop first set: // loop first set:
@@ -537,7 +537,7 @@ class Navigation
return $date; return $date;
} }
if (isset($modifierMap[$repeatFreq])) { if (isset($modifierMap[$repeatFreq])) {
$subtract = $subtract * $modifierMap[$repeatFreq]; $subtract *= $modifierMap[$repeatFreq];
$date->subMonths($subtract); $date->subMonths($subtract);
Log::debug(sprintf('%s is in modifier map with value %d, execute subMonths with argument %d', $repeatFreq, $modifierMap[$repeatFreq], $subtract)); Log::debug(sprintf('%s is in modifier map with value %d, execute subMonths with argument %d', $repeatFreq, $modifierMap[$repeatFreq], $subtract));
Log::debug(sprintf('subtractPeriod: resulting date is %s', $date->format('Y-m-d'))); Log::debug(sprintf('subtractPeriod: resulting date is %s', $date->format('Y-m-d')));

View File

@@ -242,6 +242,7 @@ class Steam
* @param $value * @param $value
* *
* @return string * @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/ */
public function decrypt(int $isEncrypted, string $value) public function decrypt(int $isEncrypted, string $value)
{ {

View File

@@ -56,16 +56,6 @@ class AmountFormat extends Twig_Extension
]; ];
} }
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName(): string
{
return 'FireflyIII\Support\Twig\AmountFormat';
}
/** /**
* @return Twig_SimpleFilter * @return Twig_SimpleFilter
*/ */

View File

@@ -67,14 +67,6 @@ class General extends Twig_Extension
]; ];
} }
/**
* {@inheritdoc}
*/
public function getName(): string
{
return 'FireflyIII\Support\Twig\General';
}
/** /**
* Will return "active" when a part of the route matches the argument. * Will return "active" when a part of the route matches the argument.
* ie. "accounts" will match "accounts.index". * ie. "accounts" will match "accounts.index".

View File

@@ -102,16 +102,6 @@ class Journal extends Twig_Extension
return $functions; return $functions;
} }
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName(): string
{
return 'FireflyIII\Support\Twig\Journals';
}
/** /**
* @return Twig_SimpleFunction * @return Twig_SimpleFunction
*/ */

View File

@@ -55,13 +55,4 @@ class PiggyBank extends Twig_Extension
return $functions; return $functions;
} }
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName(): string
{
return 'FireflyIII\Support\Twig\PiggyBank';
}
} }

View File

@@ -103,14 +103,4 @@ class Rule extends Twig_Extension
$this->allActionTriggers(), $this->allActionTriggers(),
]; ];
} }
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName(): string
{
return 'FireflyIII\Support\Twig\Rule';
}
} }

View File

@@ -52,14 +52,4 @@ class Transaction extends Twig_Extension
return $filters; return $filters;
} }
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName(): string
{
return 'transaction';
}
} }

View File

@@ -41,7 +41,7 @@ class Translation extends Twig_Extension
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'_', '_',
function ($name) { function ($name) {
return strval(trans(sprintf('firefly.%s', $name))); return (string)trans(sprintf('firefly.%s', $name));
}, },
['is_safe' => ['html']] ['is_safe' => ['html']]
); );
@@ -59,13 +59,6 @@ class Translation extends Twig_Extension
]; ];
} }
/**
* {@inheritdoc}
*/
public function getName(): string
{
return 'FireflyIII\Support\Twig\Translation';
}
/** /**
* @return Twig_SimpleFunction * @return Twig_SimpleFunction

View File

@@ -54,7 +54,7 @@ class AppendDescription implements ActionInterface
public function act(TransactionJournal $journal): bool public function act(TransactionJournal $journal): bool
{ {
Log::debug(sprintf('RuleAction AppendDescription appended "%s" to "%s".', $this->action->action_value, $journal->description)); Log::debug(sprintf('RuleAction AppendDescription appended "%s" to "%s".', $this->action->action_value, $journal->description));
$journal->description = $journal->description . $this->action->action_value; $journal->description .= $this->action->action_value;
$journal->save(); $journal->save();
return true; return true;

View File

@@ -61,7 +61,7 @@ class AppendNotes implements ActionInterface
} }
$notes = $dbNote->text; $notes = $dbNote->text;
Log::debug(sprintf('RuleAction AppendNotes appended "%s" to "%s".', $this->action->action_value, $notes)); Log::debug(sprintf('RuleAction AppendNotes appended "%s" to "%s".', $this->action->action_value, $notes));
$notes = $notes . $this->action->action_value; $notes .= $this->action->action_value;
$dbNote->text = $notes; $dbNote->text = $notes;
$dbNote->save(); $dbNote->save();
$journal->save(); $journal->save();

View File

@@ -184,6 +184,7 @@ class TransactionMatcher
* @param Processor $processor * @param Processor $processor
* *
* @return Collection * @return Collection
* @throws \FireflyIII\Exceptions\FireflyException
*/ */
private function runProcessor(Processor $processor): Collection private function runProcessor(Processor $processor): Collection
{ {

View File

@@ -72,7 +72,7 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface
*/ */
public function triggered(TransactionJournal $journal): bool public function triggered(TransactionJournal $journal): bool
{ {
$search = trim(strtolower($this->triggerValue)); $search = strtolower(trim($this->triggerValue));
if (0 === strlen($search)) { if (0 === strlen($search)) {
Log::debug(sprintf('RuleTrigger NotesContain for journal #%d: "%s" is empty, return false.', $journal->id, $search)); Log::debug(sprintf('RuleTrigger NotesContain for journal #%d: "%s" is empty, return false.', $journal->id, $search));

View File

@@ -41,6 +41,7 @@ use Symfony\Component\HttpFoundation\ParameterBag;
*/ */
class AccountTransformer extends TransformerAbstract class AccountTransformer extends TransformerAbstract
{ {
/** @noinspection ClassOverridesFieldOfSuperClassInspection */
/** /**
* List of resources possible to include. * List of resources possible to include.
* *
@@ -180,7 +181,7 @@ class AccountTransformer extends TransformerAbstract
if ($type === AccountType::ASSET) { if ($type === AccountType::ASSET) {
/** @var AccountRepositoryInterface $repository */ /** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class); $repository = app(AccountRepositoryInterface::class);
$repository->setuser($account->user); $repository->setUser($account->user);
$amount = $repository->getOpeningBalanceAmount($account); $amount = $repository->getOpeningBalanceAmount($account);
$openingBalance = is_null($amount) ? null : round($amount, $decimalPlaces); $openingBalance = is_null($amount) ? null : round($amount, $decimalPlaces);
$openingBalanceDate = $repository->getOpeningBalanceDate($account); $openingBalanceDate = $repository->getOpeningBalanceDate($account);

View File

@@ -93,11 +93,8 @@ class FireflyValidator extends Validator
return true; return true;
} }
$count = DB::table($parameters[0])->where('user_id', auth()->user()->id)->where($field, $value)->count(); $count = DB::table($parameters[0])->where('user_id', auth()->user()->id)->where($field, $value)->count();
if (1 === $count) {
return true;
}
return false; return 1 === $count;
} }
/** /**
@@ -234,11 +231,8 @@ class FireflyValidator extends Validator
return true; return true;
} }
$count = DB::table($parameters[0])->where($field, $value)->count(); $count = DB::table($parameters[0])->where($field, $value)->count();
if (1 === $count) {
return true;
}
return false; return 1 === $count;
} }
/** /**
@@ -323,7 +317,7 @@ class FireflyValidator extends Validator
/** @var TriggerInterface $class */ /** @var TriggerInterface $class */
$class = $classes[$name]; $class = $classes[$name];
return !($class::willMatchEverything($value)); return !$class::willMatchEverything($value);
} }
return false; return false;

View File

@@ -455,8 +455,7 @@ return [
'preferences_security' => 'Sicherheit', 'preferences_security' => 'Sicherheit',
'preferences_layout' => 'Anordnung', 'preferences_layout' => 'Anordnung',
'pref_home_show_deposits' => 'Einnahmen auf dem Startbildschirm anzeigen', 'pref_home_show_deposits' => 'Einnahmen auf dem Startbildschirm anzeigen',
'pref_home_show_deposits_info' => 'Der Startbildschirm zeigt schon Ihre Ausgabenkonten an. 'pref_home_show_deposits_info' => 'Der Startbildschirm zeigt schon Ihre Ausgabenkonten an. Sollen zusätzlich Ihre Girokonten angezeigt werden?',
Sollen zusätzlich Ihre Girokonten angezeigt werden?',
'pref_home_do_show_deposits' => 'Ja, zeige sie an', 'pref_home_do_show_deposits' => 'Ja, zeige sie an',
'successful_count' => 'davon :count erfolgreich', 'successful_count' => 'davon :count erfolgreich',
'list_page_size_title' => 'Einträge pro Seite', 'list_page_size_title' => 'Einträge pro Seite',