mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 18:41:08 +00:00
PHP7 compatible type hinting [skip ci]
This commit is contained in:
@@ -29,7 +29,7 @@ interface AccountChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end);
|
public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
@@ -38,7 +38,7 @@ interface AccountChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function frontpage(Collection $accounts, Carbon $start, Carbon $end);
|
public function frontpage(Collection $accounts, Carbon $start, Carbon $end): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
@@ -47,5 +47,5 @@ interface AccountChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function single(Account $account, Carbon $start, Carbon $end);
|
public function single(Account $account, Carbon $start, Carbon $end): array;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end)
|
public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end): array
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
@@ -69,7 +69,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function frontpage(Collection $accounts, Carbon $start, Carbon $end)
|
public function frontpage(Collection $accounts, Carbon $start, Carbon $end): array
|
||||||
{
|
{
|
||||||
// language:
|
// language:
|
||||||
$format = (string)trans('config.month_and_day');
|
$format = (string)trans('config.month_and_day');
|
||||||
@@ -116,7 +116,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function single(Account $account, Carbon $start, Carbon $end)
|
public function single(Account $account, Carbon $start, Carbon $end): array
|
||||||
{
|
{
|
||||||
// language:
|
// language:
|
||||||
$format = (string)trans('config.month_and_day');
|
$format = (string)trans('config.month_and_day');
|
||||||
@@ -153,7 +153,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getIdsFromCollection(Collection $collection)
|
protected function getIdsFromCollection(Collection $collection): array
|
||||||
{
|
{
|
||||||
$ids = [];
|
$ids = [];
|
||||||
foreach ($collection as $entry) {
|
foreach ($collection as $entry) {
|
||||||
@@ -170,7 +170,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function isInArray($array, $entryId)
|
protected function isInArray($array, $entryId): string
|
||||||
{
|
{
|
||||||
if (isset($array[$entryId])) {
|
if (isset($array[$entryId])) {
|
||||||
return $array[$entryId];
|
return $array[$entryId];
|
||||||
|
@@ -28,7 +28,7 @@ interface BillChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function frontpage(string $paid, string $unpaid);
|
public function frontpage(string $paid, string $unpaid): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
@@ -36,6 +36,6 @@ interface BillChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function single(Bill $bill, Collection $entries);
|
public function single(Bill $bill, Collection $entries): array;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function frontpage(string $paid, string $unpaid)
|
public function frontpage(string $paid, string $unpaid): array
|
||||||
{
|
{
|
||||||
bcscale(2);
|
bcscale(2);
|
||||||
$data = [
|
$data = [
|
||||||
@@ -55,7 +55,7 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function single(Bill $bill, Collection $entries)
|
public function single(Bill $bill, Collection $entries): array
|
||||||
{
|
{
|
||||||
bcscale(2);
|
bcscale(2);
|
||||||
$format = (string)trans('config.month');
|
$format = (string)trans('config.month');
|
||||||
|
@@ -24,28 +24,28 @@ interface BudgetChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function budget(Collection $entries);
|
public function budget(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function budgetLimit(Collection $entries);
|
public function budgetLimit(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function frontpage(Collection $entries);
|
public function frontpage(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function multiYear(Collection $entries);
|
public function multiYear(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $budgets
|
* @param Collection $budgets
|
||||||
@@ -53,6 +53,6 @@ interface BudgetChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function year(Collection $budgets, Collection $entries);
|
public function year(Collection $budgets, Collection $entries): array;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function budget(Collection $entries, $dateFormat = 'month')
|
public function budget(Collection $entries, $dateFormat = 'month'): array
|
||||||
{
|
{
|
||||||
// language:
|
// language:
|
||||||
$language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
|
$language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
|
||||||
@@ -56,7 +56,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function budgetLimit(Collection $entries)
|
public function budgetLimit(Collection $entries): array
|
||||||
{
|
{
|
||||||
return $this->budget($entries, 'monthAndDay');
|
return $this->budget($entries, 'monthAndDay');
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function frontpage(Collection $entries)
|
public function frontpage(Collection $entries): array
|
||||||
{
|
{
|
||||||
bcscale(2);
|
bcscale(2);
|
||||||
$data = [
|
$data = [
|
||||||
@@ -112,7 +112,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function multiYear(Collection $entries)
|
public function multiYear(Collection $entries): array
|
||||||
{
|
{
|
||||||
// dataset:
|
// dataset:
|
||||||
$data = [
|
$data = [
|
||||||
@@ -147,7 +147,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function year(Collection $budgets, Collection $entries)
|
public function year(Collection $budgets, Collection $entries): array
|
||||||
{
|
{
|
||||||
// language:
|
// language:
|
||||||
$format = (string)trans('config.month');
|
$format = (string)trans('config.month');
|
||||||
|
@@ -33,28 +33,28 @@ interface CategoryChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function earnedInPeriod(Collection $categories, Collection $entries);
|
public function earnedInPeriod(Collection $categories, Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function frontpage(Collection $entries);
|
public function frontpage(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function multiYear(Collection $entries);
|
public function multiYear(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function period(Collection $entries);
|
public function period(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $categories
|
* @param Collection $categories
|
||||||
@@ -62,5 +62,5 @@ interface CategoryChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function spentInPeriod(Collection $categories, Collection $entries);
|
public function spentInPeriod(Collection $categories, Collection $entries): array;
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function all(Collection $entries)
|
public function all(Collection $entries): array
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function earnedInPeriod(Collection $categories, Collection $entries)
|
public function earnedInPeriod(Collection $categories, Collection $entries): array
|
||||||
{
|
{
|
||||||
|
|
||||||
// language:
|
// language:
|
||||||
@@ -87,7 +87,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function frontpage(Collection $entries)
|
public function frontpage(Collection $entries): array
|
||||||
{
|
{
|
||||||
bcscale(2);
|
bcscale(2);
|
||||||
$data = [
|
$data = [
|
||||||
@@ -115,7 +115,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function multiYear(Collection $entries)
|
public function multiYear(Collection $entries): array
|
||||||
{
|
{
|
||||||
// dataset:
|
// dataset:
|
||||||
$data = [
|
$data = [
|
||||||
@@ -155,7 +155,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function period(Collection $entries)
|
public function period(Collection $entries): array
|
||||||
{
|
{
|
||||||
return $this->all($entries);
|
return $this->all($entries);
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function spentInPeriod(Collection $categories, Collection $entries)
|
public function spentInPeriod(Collection $categories, Collection $entries): array
|
||||||
{
|
{
|
||||||
|
|
||||||
// language:
|
// language:
|
||||||
|
@@ -19,7 +19,7 @@ class ChartJsPiggyBankChartGenerator implements PiggyBankChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function history(Collection $set)
|
public function history(Collection $set): array
|
||||||
{
|
{
|
||||||
|
|
||||||
// language:
|
// language:
|
||||||
|
@@ -24,5 +24,5 @@ interface PiggyBankChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function history(Collection $set);
|
public function history(Collection $set): array;
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function multiYearInOut(Collection $entries)
|
public function multiYearInOut(Collection $entries): array
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'count' => 2,
|
'count' => 2,
|
||||||
@@ -52,7 +52,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function multiYearInOutSummarized(string $income, string $expense, int $count)
|
public function multiYearInOutSummarized(string $income, string $expense, int $count): array
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'count' => 2,
|
'count' => 2,
|
||||||
@@ -81,7 +81,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function yearInOut(Collection $entries)
|
public function yearInOut(Collection $entries): array
|
||||||
{
|
{
|
||||||
// language:
|
// language:
|
||||||
$format = (string)trans('config.month');
|
$format = (string)trans('config.month');
|
||||||
@@ -117,7 +117,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function yearInOutSummarized(string $income, string $expense, int $count)
|
public function yearInOutSummarized(string $income, string $expense, int $count): array
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
@@ -25,7 +25,7 @@ interface ReportChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function multiYearInOut(Collection $entries);
|
public function multiYearInOut(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $income
|
* @param string $income
|
||||||
@@ -34,14 +34,14 @@ interface ReportChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function multiYearInOutSummarized(string $income, string $expense, int $count);
|
public function multiYearInOutSummarized(string $income, string $expense, int $count): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function yearInOut(Collection $entries);
|
public function yearInOut(Collection $entries): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $income
|
* @param string $income
|
||||||
@@ -50,6 +50,6 @@ interface ReportChartGeneratorInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function yearInOutSummarized(string $income, string $expense, int $count);
|
public function yearInOutSummarized(string $income, string $expense, int $count): array;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -17,25 +17,14 @@ use FireflyIII\Models\TransactionJournal;
|
|||||||
class ConnectJournalToPiggyBank
|
class ConnectJournalToPiggyBank
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the event handler.
|
|
||||||
*
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect a new transaction journal to any related piggy banks.
|
* Connect a new transaction journal to any related piggy banks.
|
||||||
*
|
*
|
||||||
* @param TransactionJournalStored $event
|
* @param TransactionJournalStored $event
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function handle(TransactionJournalStored $event)
|
public function handle(TransactionJournalStored $event): bool
|
||||||
{
|
{
|
||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
$journal = $event->journal;
|
$journal = $event->journal;
|
||||||
|
@@ -26,25 +26,15 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class FireRulesForStore
|
class FireRulesForStore
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create the event handler.
|
|
||||||
*
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect a new transaction journal to any related piggy banks.
|
* Connect a new transaction journal to any related piggy banks.
|
||||||
*
|
*
|
||||||
* @param TransactionJournalStored $event
|
* @param TransactionJournalStored $event
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function handle(TransactionJournalStored $event)
|
public function handle(TransactionJournalStored $event): bool
|
||||||
{
|
{
|
||||||
// get all the user's rule groups, with the rules, order by 'order'.
|
// get all the user's rule groups, with the rules, order by 'order'.
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
|
@@ -25,23 +25,14 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class FireRulesForUpdate
|
class FireRulesForUpdate
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create the event handler.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the event.
|
* Handle the event.
|
||||||
*
|
*
|
||||||
* @param TransactionJournalUpdated $event
|
* @param TransactionJournalUpdated $event
|
||||||
*
|
*
|
||||||
* @return void
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function handle(TransactionJournalUpdated $event)
|
public function handle(TransactionJournalUpdated $event): bool
|
||||||
{
|
{
|
||||||
// get all the user's rule groups, with the rules, order by 'order'.
|
// get all the user's rule groups, with the rules, order by 'order'.
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
@@ -71,5 +62,6 @@ class FireRulesForUpdate
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,26 +22,18 @@ use FireflyIII\Support\Events\BillScanner;
|
|||||||
class ScanForBillsAfterStore
|
class ScanForBillsAfterStore
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the event handler.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan a transaction journal for possible links to bills, right after storing.
|
* Scan a transaction journal for possible links to bills, right after storing.
|
||||||
*
|
*
|
||||||
* @param TransactionJournalStored $event
|
* @param TransactionJournalStored $event
|
||||||
*
|
*
|
||||||
* @return void
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function handle(TransactionJournalStored $event)
|
public function handle(TransactionJournalStored $event): bool
|
||||||
{
|
{
|
||||||
$journal = $event->journal;
|
$journal = $event->journal;
|
||||||
BillScanner::scan($journal);
|
BillScanner::scan($journal);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -21,27 +21,18 @@ use FireflyIII\Support\Events\BillScanner;
|
|||||||
*/
|
*/
|
||||||
class ScanForBillsAfterUpdate
|
class ScanForBillsAfterUpdate
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the event handler.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan a transaction journal for possibly related bills after it has been updated.
|
* Scan a transaction journal for possibly related bills after it has been updated.
|
||||||
*
|
*
|
||||||
* @param TransactionJournalUpdated $event
|
* @param TransactionJournalUpdated $event
|
||||||
*
|
*
|
||||||
* @return void
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function handle(TransactionJournalUpdated $event)
|
public function handle(TransactionJournalUpdated $event): bool
|
||||||
{
|
{
|
||||||
$journal = $event->journal;
|
$journal = $event->journal;
|
||||||
BillScanner::scan($journal);
|
BillScanner::scan($journal);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -15,23 +15,14 @@ use FireflyIII\Models\PiggyBankRepetition;
|
|||||||
class UpdateJournalConnection
|
class UpdateJournalConnection
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the event handler.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the event.
|
* Handle the event.
|
||||||
*
|
*
|
||||||
* @param TransactionJournalUpdated $event
|
* @param TransactionJournalUpdated $event
|
||||||
*
|
*
|
||||||
* @return void
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function handle(TransactionJournalUpdated $event)
|
public function handle(TransactionJournalUpdated $event):bool
|
||||||
{
|
{
|
||||||
$journal = $event->journal;
|
$journal = $event->journal;
|
||||||
|
|
||||||
@@ -39,7 +30,7 @@ class UpdateJournalConnection
|
|||||||
/** @var PiggyBankEvent $event */
|
/** @var PiggyBankEvent $event */
|
||||||
$event = PiggyBankEvent::where('transaction_journal_id', $journal->id)->first();
|
$event = PiggyBankEvent::where('transaction_journal_id', $journal->id)->first();
|
||||||
if (is_null($event)) {
|
if (is_null($event)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
$piggyBank = $event->piggyBank()->first();
|
$piggyBank = $event->piggyBank()->first();
|
||||||
$repetition = null;
|
$repetition = null;
|
||||||
@@ -49,7 +40,7 @@ class UpdateJournalConnection
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($repetition)) {
|
if (is_null($repetition)) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
bcscale(2);
|
bcscale(2);
|
||||||
|
|
||||||
@@ -62,6 +53,8 @@ class UpdateJournalConnection
|
|||||||
|
|
||||||
$event->amount = $amount;
|
$event->amount = $amount;
|
||||||
$event->save();
|
$event->save();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAttachmentLocation(Attachment $attachment)
|
public function getAttachmentLocation(Attachment $attachment): string
|
||||||
{
|
{
|
||||||
$path = storage_path('upload') . DIRECTORY_SEPARATOR . 'at-' . $attachment->id . '.data';
|
$path = storage_path('upload') . DIRECTORY_SEPARATOR . 'at-' . $attachment->id . '.data';
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
/**
|
/**
|
||||||
* @return MessageBag
|
* @return MessageBag
|
||||||
*/
|
*/
|
||||||
public function getErrors()
|
public function getErrors(): MessageBag
|
||||||
{
|
{
|
||||||
return $this->errors;
|
return $this->errors;
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
/**
|
/**
|
||||||
* @return MessageBag
|
* @return MessageBag
|
||||||
*/
|
*/
|
||||||
public function getMessages()
|
public function getMessages(): MessageBag
|
||||||
{
|
{
|
||||||
return $this->messages;
|
return $this->messages;
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function saveAttachmentsForModel(Model $model)
|
public function saveAttachmentsForModel(Model $model): bool
|
||||||
{
|
{
|
||||||
$files = null;
|
$files = null;
|
||||||
try {
|
try {
|
||||||
@@ -107,7 +107,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function hasFile(UploadedFile $file, Model $model)
|
protected function hasFile(UploadedFile $file, Model $model): bool
|
||||||
{
|
{
|
||||||
$md5 = md5_file($file->getRealPath());
|
$md5 = md5_file($file->getRealPath());
|
||||||
$name = $file->getClientOriginalName();
|
$name = $file->getClientOriginalName();
|
||||||
@@ -125,16 +125,17 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @param UploadedFile $file
|
* @param UploadedFile $file
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
*
|
*
|
||||||
* @return bool|Attachment
|
* @return Attachment
|
||||||
*/
|
*/
|
||||||
protected function processFile(UploadedFile $file, Model $model)
|
protected function processFile(UploadedFile $file, Model $model): Attachment
|
||||||
{
|
{
|
||||||
$validation = $this->validateUpload($file, $model);
|
$validation = $this->validateUpload($file, $model);
|
||||||
if ($validation === false) {
|
if ($validation === false) {
|
||||||
return false;
|
return new Attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
$attachment = new Attachment; // create Attachment object.
|
$attachment = new Attachment; // create Attachment object.
|
||||||
@@ -175,7 +176,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function validMime(UploadedFile $file)
|
protected function validMime(UploadedFile $file): bool
|
||||||
{
|
{
|
||||||
$mime = e($file->getMimeType());
|
$mime = e($file->getMimeType());
|
||||||
$name = e($file->getClientOriginalName());
|
$name = e($file->getClientOriginalName());
|
||||||
@@ -195,7 +196,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function validSize(UploadedFile $file)
|
protected function validSize(UploadedFile $file): bool
|
||||||
{
|
{
|
||||||
$size = $file->getSize();
|
$size = $file->getSize();
|
||||||
$name = e($file->getClientOriginalName());
|
$name = e($file->getClientOriginalName());
|
||||||
@@ -215,7 +216,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function validateUpload(UploadedFile $file, Model $model)
|
protected function validateUpload(UploadedFile $file, Model $model): bool
|
||||||
{
|
{
|
||||||
if (!$this->validMime($file)) {
|
if (!$this->validMime($file)) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -17,25 +17,25 @@ interface AttachmentHelperInterface
|
|||||||
/**
|
/**
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAttachmentLocation(Attachment $attachment);
|
public function getAttachmentLocation(Attachment $attachment): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return MessageBag
|
* @return MessageBag
|
||||||
*/
|
*/
|
||||||
public function getErrors();
|
public function getErrors(): MessageBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return MessageBag
|
* @return MessageBag
|
||||||
*/
|
*/
|
||||||
public function getMessages();
|
public function getMessages(): MessageBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function saveAttachmentsForModel(Model $model);
|
public function saveAttachmentsForModel(Model $model): bool;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -23,9 +23,9 @@ class Account
|
|||||||
protected $start;
|
protected $start;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getAccounts()
|
public function getAccounts(): Collection
|
||||||
{
|
{
|
||||||
return $this->accounts;
|
return $this->accounts;
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ class Account
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDifference()
|
public function getDifference(): string
|
||||||
{
|
{
|
||||||
return $this->difference;
|
return $this->difference;
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ class Account
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEnd()
|
public function getEnd(): string
|
||||||
{
|
{
|
||||||
return $this->end;
|
return $this->end;
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ class Account
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getStart()
|
public function getStart(): string
|
||||||
{
|
{
|
||||||
return $this->start;
|
return $this->start;
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@ class Balance
|
|||||||
/**
|
/**
|
||||||
* @return BalanceHeader
|
* @return BalanceHeader
|
||||||
*/
|
*/
|
||||||
public function getBalanceHeader()
|
public function getBalanceHeader(): BalanceHeader
|
||||||
{
|
{
|
||||||
return $this->balanceHeader;
|
return $this->balanceHeader;
|
||||||
}
|
}
|
||||||
@@ -53,9 +53,9 @@ class Balance
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Support\Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
public function getBalanceLines()
|
public function getBalanceLines(): Collection
|
||||||
{
|
{
|
||||||
return $this->balanceLines;
|
return $this->balanceLines;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user