Reformat various code.

This commit is contained in:
James Cole
2022-03-29 14:59:58 +02:00
parent 29bed2547c
commit d1a09ff33b
115 changed files with 2700 additions and 2699 deletions

View File

@@ -138,7 +138,7 @@ class Account extends Model
public static function routeBinder(string $value): Account
{
if (auth()->check()) {
$accountId = (int)$value;
$accountId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var Account $account */
@@ -266,7 +266,7 @@ class Account extends Model
*/
public function setVirtualBalanceAttribute($value): void
{
$value = (string)$value;
$value = (string) $value;
if ('' === $value) {
$value = null;
}

View File

@@ -49,34 +49,34 @@ use Illuminate\Support\Carbon;
*/
class AccountType extends Model
{
/** @var string */
public const DEFAULT = 'Default account';
/** @var string */
public const CASH = 'Cash account';
/** @var string */
public const ASSET = 'Asset account';
/** @var string */
public const EXPENSE = 'Expense account';
/** @var string */
public const REVENUE = 'Revenue account';
/** @var string */
public const INITIAL_BALANCE = 'Initial balance account';
/** @var string */
public const BENEFICIARY = 'Beneficiary account';
/** @var string */
public const IMPORT = 'Import account';
/** @var string */
public const RECONCILIATION = 'Reconciliation account';
/** @var string */
public const LOAN = 'Loan';
/** @var string */
public const DEBT = 'Debt';
/** @var string */
public const MORTGAGE = 'Mortgage';
public const CASH = 'Cash account';
/** @var string */
public const CREDITCARD = 'Credit card';
/** @var string */
public const DEBT = 'Debt';
/** @var string */
public const DEFAULT = 'Default account';
/** @var string */
public const EXPENSE = 'Expense account';
/** @var string */
public const IMPORT = 'Import account';
/** @var string */
public const INITIAL_BALANCE = 'Initial balance account';
/** @var string */
public const LIABILITY_CREDIT = 'Liability credit account';
/** @var string */
public const LOAN = 'Loan';
/** @var string */
public const MORTGAGE = 'Mortgage';
/** @var string */
public const RECONCILIATION = 'Reconciliation account';
/** @var string */
public const REVENUE = 'Revenue account';
/**
* The attributes that should be casted to native types.
*

View File

@@ -111,7 +111,7 @@ class Attachment extends Model
public static function routeBinder(string $value): Attachment
{
if (auth()->check()) {
$attachmentId = (int)$value;
$attachmentId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var Attachment $attachment */
@@ -143,7 +143,7 @@ class Attachment extends Model
*/
public function fileName(): string
{
return sprintf('at-%s.data', (string)$this->id);
return sprintf('at-%s.data', (string) $this->id);
}
/**

View File

@@ -96,7 +96,7 @@ class AvailableBudget extends Model
public static function routeBinder(string $value): AvailableBudget
{
if (auth()->check()) {
$availableBudgetId = (int)$value;
$availableBudgetId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var AvailableBudget $availableBudget */

View File

@@ -139,7 +139,7 @@ class Bill extends Model
public static function routeBinder(string $value): Bill
{
if (auth()->check()) {
$billId = (int)$value;
$billId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var Bill $bill */
@@ -184,7 +184,7 @@ class Bill extends Model
*/
public function setAmountMaxAttribute($value): void
{
$this->attributes['amount_max'] = (string)$value;
$this->attributes['amount_max'] = (string) $value;
}
/**
@@ -194,7 +194,7 @@ class Bill extends Model
*/
public function setAmountMinAttribute($value): void
{
$this->attributes['amount_min'] = (string)$value;
$this->attributes['amount_min'] = (string) $value;
}
/**

View File

@@ -38,26 +38,26 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* FireflyIII\Models\Budget
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property string $name
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property-read Collection|Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read Collection|AutoBudget[] $autoBudgets
* @property-read int|null $auto_budgets_count
* @property-read Collection|BudgetLimit[] $budgetlimits
* @property-read int|null $budgetlimits_count
* @property-read Collection|TransactionJournal[] $transactionJournals
* @property-read int|null $transaction_journals_count
* @property-read Collection|Transaction[] $transactions
* @property-read int|null $transactions_count
* @property-read User $user
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property string $name
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property-read Collection|Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read Collection|AutoBudget[] $autoBudgets
* @property-read int|null $auto_budgets_count
* @property-read Collection|BudgetLimit[] $budgetlimits
* @property-read int|null $budgetlimits_count
* @property-read Collection|TransactionJournal[] $transactionJournals
* @property-read int|null $transaction_journals_count
* @property-read Collection|Transaction[] $transactions
* @property-read int|null $transactions_count
* @property-read User $user
* @method static \Illuminate\Database\Eloquent\Builder|Budget newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Budget newQuery()
* @method static Builder|Budget onlyTrashed()
@@ -74,11 +74,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|Budget withTrashed()
* @method static Builder|Budget withoutTrashed()
* @mixin Eloquent
* @property string $email
* @property int|null $user_group_id
* @property string $email
* @property int|null $user_group_id
* @method static \Illuminate\Database\Eloquent\Builder|Budget whereUserGroupId($value)
* @property-read Collection|\FireflyIII\Models\Note[] $notes
* @property-read int|null $notes_count
* @property-read Collection|Note[] $notes
* @property-read int|null $notes_count
*/
class Budget extends Model
{
@@ -113,7 +113,7 @@ class Budget extends Model
public static function routeBinder(string $value): Budget
{
if (auth()->check()) {
$budgetId = (int)$value;
$budgetId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var Budget $budget */

View File

@@ -90,7 +90,7 @@ class BudgetLimit extends Model
public static function routeBinder(string $value): BudgetLimit
{
if (auth()->check()) {
$budgetLimitId = (int)$value;
$budgetLimitId = (int) $value;
$budgetLimit = self::where('budget_limits.id', $budgetLimitId)
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
->where('budgets.user_id', auth()->user()->id)

View File

@@ -104,7 +104,7 @@ class Category extends Model
public static function routeBinder(string $value): Category
{
if (auth()->check()) {
$categoryId = (int)$value;
$categoryId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var Category $category */

View File

@@ -93,7 +93,7 @@ class LinkType extends Model
public static function routeBinder(string $value): LinkType
{
if (auth()->check()) {
$linkTypeId = (int)$value;
$linkTypeId = (int) $value;
$linkType = self::find($linkTypeId);
if (null !== $linkType) {
return $linkType;

View File

@@ -90,7 +90,7 @@ class ObjectGroup extends Model
public static function routeBinder(string $value): ObjectGroup
{
if (auth()->check()) {
$objectGroupId = (int)$value;
$objectGroupId = (int) $value;
/** @var ObjectGroup $objectGroup */
$objectGroup = self::where('object_groups.id', $objectGroupId)
->where('object_groups.user_id', auth()->user()->id)->first();

View File

@@ -115,7 +115,7 @@ class PiggyBank extends Model
public static function routeBinder(string $value): PiggyBank
{
if (auth()->check()) {
$piggyBankId = (int)$value;
$piggyBankId = (int) $value;
$piggyBank = self::where('piggy_banks.id', $piggyBankId)
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
->where('accounts.user_id', auth()->user()->id)->first(['piggy_banks.*']);
@@ -186,6 +186,6 @@ class PiggyBank extends Model
*/
public function setTargetamountAttribute($value): void
{
$this->attributes['targetamount'] = (string)$value;
$this->attributes['targetamount'] = (string) $value;
}
}

View File

@@ -86,7 +86,7 @@ class PiggyBankEvent extends Model
*/
public function setAmountAttribute($value): void
{
$this->attributes['amount'] = (string)$value;
$this->attributes['amount'] = (string) $value;
}
/**

View File

@@ -31,14 +31,14 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* FireflyIII\Models\PiggyBankRepetition
*
* @property int $id
* @property int $id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property int $piggy_bank_id
* @property int $piggy_bank_id
* @property \Illuminate\Support\Carbon|null $startdate
* @property \Illuminate\Support\Carbon|null $targetdate
* @property string $currentamount
* @property-read PiggyBank $piggyBank
* @property string $currentamount
* @property-read PiggyBank $piggyBank
* @method static EloquentBuilder|PiggyBankRepetition newModelQuery()
* @method static EloquentBuilder|PiggyBankRepetition newQuery()
* @method static EloquentBuilder|PiggyBankRepetition onDates(Carbon $start, Carbon $target)
@@ -124,6 +124,6 @@ class PiggyBankRepetition extends Model
*/
public function setCurrentamountAttribute($value): void
{
$this->attributes['currentamount'] = (string)$value;
$this->attributes['currentamount'] = (string) $value;
}
}

View File

@@ -130,7 +130,7 @@ class Recurrence extends Model
public static function routeBinder(string $value): Recurrence
{
if (auth()->check()) {
$recurrenceId = (int)$value;
$recurrenceId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var Recurrence $recurrence */

View File

@@ -111,7 +111,7 @@ class Rule extends Model
public static function routeBinder(string $value): Rule
{
if (auth()->check()) {
$ruleId = (int)$value;
$ruleId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var Rule $rule */

View File

@@ -102,7 +102,7 @@ class RuleGroup extends Model
public static function routeBinder(string $value): RuleGroup
{
if (auth()->check()) {
$ruleGroupId = (int)$value;
$ruleGroupId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var RuleGroup $ruleGroup */

View File

@@ -113,7 +113,7 @@ class Tag extends Model
public static function routeBinder(string $value): Tag
{
if (auth()->check()) {
$tagId = (int)$value;
$tagId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var Tag $tag */

View File

@@ -236,7 +236,7 @@ class Transaction extends Model
*/
public function setAmountAttribute($value): void
{
$this->attributes['amount'] = (string)$value;
$this->attributes['amount'] = (string) $value;
}
/**

View File

@@ -97,7 +97,7 @@ class TransactionCurrency extends Model
public static function routeBinder(string $value): TransactionCurrency
{
if (auth()->check()) {
$currencyId = (int)$value;
$currencyId = (int) $value;
$currency = self::find($currencyId);
if (null !== $currency) {
return $currency;

View File

@@ -94,7 +94,7 @@ class TransactionGroup extends Model
public static function routeBinder(string $value): TransactionGroup
{
if (auth()->check()) {
$groupId = (int)$value;
$groupId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var TransactionGroup $group */

View File

@@ -160,7 +160,7 @@ class TransactionJournal extends Model
public static function routeBinder(string $value): TransactionJournal
{
if (auth()->check()) {
$journalId = (int)$value;
$journalId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var TransactionJournal $journal */

View File

@@ -87,7 +87,7 @@ class TransactionJournalLink extends Model
public static function routeBinder(string $value): TransactionJournalLink
{
if (auth()->check()) {
$linkId = (int)$value;
$linkId = (int) $value;
$link = self::where('journal_links.id', $linkId)
->leftJoin('transaction_journals as t_a', 't_a.id', '=', 'source_id')
->leftJoin('transaction_journals as t_b', 't_b.id', '=', 'destination_id')

View File

@@ -58,20 +58,20 @@ class TransactionType extends Model
{
use SoftDeletes;
/** @var string */
public const WITHDRAWAL = 'Withdrawal';
/** @var string */
public const DEPOSIT = 'Deposit';
/** @var string */
public const TRANSFER = 'Transfer';
public const INVALID = 'Invalid';
/** @var string */
public const LIABILITY_CREDIT = 'Liability credit';
/** @var string */
public const OPENING_BALANCE = 'Opening balance';
/** @var string */
public const RECONCILIATION = 'Reconciliation';
/** @var string */
public const INVALID = 'Invalid';
public const TRANSFER = 'Transfer';
/** @var string */
public const LIABILITY_CREDIT = 'Liability credit';
public const WITHDRAWAL = 'Withdrawal';
/** @var string[] */
protected $casts
= [

View File

@@ -53,14 +53,14 @@ use Illuminate\Support\Carbon;
*/
class UserRole extends Model
{
public const READ_ONLY = 'ro';
public const CHANGE_TRANSACTIONS = 'change_tx';
public const CHANGE_RULES = 'change_rules';
public const CHANGE_PIGGY_BANKS = 'change_piggies';
public const CHANGE_REPETITIONS = 'change_reps';
public const VIEW_REPORTS = 'view_reports';
public const CHANGE_RULES = 'change_rules';
public const CHANGE_TRANSACTIONS = 'change_tx';
public const FULL = 'full';
public const OWNER = 'owner';
public const READ_ONLY = 'ro';
public const VIEW_REPORTS = 'view_reports';
protected $fillable = ['title'];
/**

View File

@@ -80,17 +80,17 @@ class Webhook extends Model
// dont forget to update the config in firefly.php
// triggers
public const TRIGGER_STORE_TRANSACTION = 100;
public const TRIGGER_UPDATE_TRANSACTION = 110;
public const TRIGGER_DESTROY_TRANSACTION = 120;
// actions
public const RESPONSE_TRANSACTIONS = 200;
public const DELIVERY_JSON = 300;
public const RESPONSE_ACCOUNTS = 210;
public const RESPONSE_NONE = 220;
// actions
public const RESPONSE_TRANSACTIONS = 200;
public const TRIGGER_DESTROY_TRANSACTION = 120;
public const TRIGGER_STORE_TRANSACTION = 100;
// delivery
public const DELIVERY_JSON = 300;
public const TRIGGER_UPDATE_TRANSACTION = 110;
protected $casts
= [
'active' => 'boolean',
@@ -111,7 +111,7 @@ class Webhook extends Model
public static function routeBinder(string $value): Webhook
{
if (auth()->check()) {
$webhookId = (int)$value;
$webhookId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var Webhook $webhook */

View File

@@ -75,7 +75,7 @@ class WebhookAttempt extends Model
public static function routeBinder(string $value): WebhookAttempt
{
if (auth()->check()) {
$attemptId = (int)$value;
$attemptId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var WebhookAttempt $attempt */

View File

@@ -89,7 +89,7 @@ class WebhookMessage extends Model
public static function routeBinder(string $value): WebhookMessage
{
if (auth()->check()) {
$messageId = (int)$value;
$messageId = (int) $value;
/** @var User $user */
$user = auth()->user();
/** @var WebhookMessage $message */