mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Reformat various code.
This commit is contained in:
		| @@ -30,7 +30,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface; | ||||
| use Laravel\Passport\Events\AccessTokenCreated; | ||||
| use Log; | ||||
| use Mail; | ||||
| use Request; | ||||
| use Session; | ||||
|  | ||||
| /** | ||||
| @@ -50,7 +49,7 @@ class APIEventHandler | ||||
|     { | ||||
|         /** @var UserRepositoryInterface $repository */ | ||||
|         $repository = app(UserRepositoryInterface::class); | ||||
|         $user       = $repository->find((int)$event->userId); | ||||
|         $user       = $repository->find((int) $event->userId); | ||||
|         if (null !== $user) { | ||||
|             $email = $user->email; | ||||
|  | ||||
| @@ -62,7 +61,7 @@ class APIEventHandler | ||||
|             // see if user has alternative email address: | ||||
|             $pref = app('preferences')->getForUser($user, 'remote_guard_alt_email'); | ||||
|             if (null !== $pref) { | ||||
|                 $email = (string)(is_array($pref->data) ? $email : $pref->data); | ||||
|                 $email = (string) (is_array($pref->data) ? $email : $pref->data); | ||||
|             } | ||||
|  | ||||
|             Log::debug(sprintf('Now in APIEventHandler::accessTokenCreated. Email is %s', $email)); | ||||
|   | ||||
| @@ -51,7 +51,7 @@ class AdminEventHandler | ||||
|  | ||||
|         // is user even admin? | ||||
|         if ($repository->hasRole($event->user, 'owner')) { | ||||
|             $email     = $event->user->email; | ||||
|             $email = $event->user->email; | ||||
|  | ||||
|             // if user is demo user, send to owner: | ||||
|             if ($event->user->hasRole('demo')) { | ||||
|   | ||||
| @@ -132,12 +132,12 @@ class UpdatedGroupEventHandler | ||||
|                        ->orderBy('transaction_journals.description', 'DESC') | ||||
|                        ->first(); | ||||
|  | ||||
|         if(null === $first) { | ||||
|         if (null === $first) { | ||||
|             Log::warning(sprintf('Group #%d has no transaction journals.', $group->id)); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         $all   = $group->transactionJournals()->get()->pluck('id')->toArray(); | ||||
|         $all = $group->transactionJournals()->get()->pluck('id')->toArray(); | ||||
|         /** @var Account $sourceAccount */ | ||||
|         $sourceAccount = $first->transactions()->where('amount', '<', '0')->first()->account; | ||||
|         /** @var Account $destAccount */ | ||||
|   | ||||
| @@ -125,17 +125,17 @@ class UserEventHandler | ||||
|         // create a new group. | ||||
|         while (true === $groupExists) { | ||||
|             $groupExists = UserGroup::where('title', $groupTitle)->count() > 0; | ||||
|             if(false === $groupExists) { | ||||
|             if (false === $groupExists) { | ||||
|                 $group = UserGroup::create(['title' => $groupTitle]); | ||||
|                 break; | ||||
|             } | ||||
|             $groupTitle = sprintf('%s-%d', $user->email, $index); | ||||
|             $index++; | ||||
|             if($index > 99) { | ||||
|             if ($index > 99) { | ||||
|                 throw new FireflyException('Email address can no longer be used for registrations.'); | ||||
|             } | ||||
|         } | ||||
|         $role  = UserRole::where('title', UserRole::OWNER)->first(); | ||||
|         $role = UserRole::where('title', UserRole::OWNER)->first(); | ||||
|         if (null === $role) { | ||||
|             throw new FireflyException('The user role is unexpectedly empty. Did you run all migrations?'); | ||||
|         } | ||||
| @@ -226,11 +226,11 @@ class UserEventHandler | ||||
|      */ | ||||
|     public function sendEmailChangeConfirmMail(UserChangedEmail $event): bool | ||||
|     { | ||||
|         $newEmail  = $event->newEmail; | ||||
|         $oldEmail  = $event->oldEmail; | ||||
|         $user      = $event->user; | ||||
|         $token     = app('preferences')->getForUser($user, 'email_change_confirm_token', 'invalid'); | ||||
|         $uri       = route('profile.confirm-email-change', [$token->data]); | ||||
|         $newEmail = $event->newEmail; | ||||
|         $oldEmail = $event->oldEmail; | ||||
|         $user     = $event->user; | ||||
|         $token    = app('preferences')->getForUser($user, 'email_change_confirm_token', 'invalid'); | ||||
|         $uri      = route('profile.confirm-email-change', [$token->data]); | ||||
|         try { | ||||
|             Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $uri)); | ||||
|  | ||||
| @@ -251,12 +251,12 @@ class UserEventHandler | ||||
|      */ | ||||
|     public function sendEmailChangeUndoMail(UserChangedEmail $event): bool | ||||
|     { | ||||
|         $newEmail  = $event->newEmail; | ||||
|         $oldEmail  = $event->oldEmail; | ||||
|         $user      = $event->user; | ||||
|         $token     = app('preferences')->getForUser($user, 'email_change_undo_token', 'invalid'); | ||||
|         $hashed    = hash('sha256', sprintf('%s%s', (string)config('app.key'), $oldEmail)); | ||||
|         $uri       = route('profile.undo-email-change', [$token->data, $hashed]); | ||||
|         $newEmail = $event->newEmail; | ||||
|         $oldEmail = $event->oldEmail; | ||||
|         $user     = $event->user; | ||||
|         $token    = app('preferences')->getForUser($user, 'email_change_undo_token', 'invalid'); | ||||
|         $hashed   = hash('sha256', sprintf('%s%s', (string) config('app.key'), $oldEmail)); | ||||
|         $uri      = route('profile.undo-email-change', [$token->data, $hashed]); | ||||
|         try { | ||||
|             Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $uri)); | ||||
|  | ||||
|   | ||||
| @@ -51,7 +51,7 @@ class VersionCheckEventHandler | ||||
|  | ||||
|         // should not check for updates: | ||||
|         $permission = app('fireflyconfig')->get('permission_update_check', -1); | ||||
|         $value      = (int)$permission->data; | ||||
|         $value      = (int) $permission->data; | ||||
|         if (1 !== $value) { | ||||
|             Log::info('Update check is not enabled.'); | ||||
|             $this->warnToCheckForUpdates($event); | ||||
| @@ -115,7 +115,7 @@ class VersionCheckEventHandler | ||||
|         // last check time was more than a week ago. | ||||
|         Log::debug('Have warned about a new version in four weeks!'); | ||||
|  | ||||
|         session()->flash('info', (string)trans('firefly.disabled_but_check')); | ||||
|         session()->flash('info', (string) trans('firefly.disabled_but_check')); | ||||
|         app('fireflyconfig')->set('last_update_warning', time()); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user