From 174699181c3e8b53a9344745b8316979e9cc3e66 Mon Sep 17 00:00:00 2001 From: ildyria Date: Mon, 16 Jan 2023 22:14:25 +0100 Subject: [PATCH] formatting --- app/Contracts/Http/RuleSet.php | 2 +- app/Http/Livewire/Components/Header.php | 6 +---- .../Forms/Settings/BooleanSetting.php | 12 +++++----- .../Livewire/Forms/Settings/GetApiToken.php | 13 ++++++----- app/Http/Livewire/Forms/Settings/SetLogin.php | 22 +++++++++---------- app/Http/Livewire/Pages/Settings.php | 1 - app/Http/Livewire/Traits/UrlChange.php | 6 ++--- 7 files changed, 30 insertions(+), 32 deletions(-) diff --git a/app/Contracts/Http/RuleSet.php b/app/Contracts/Http/RuleSet.php index bfddb03298c..d2415af9c80 100644 --- a/app/Contracts/Http/RuleSet.php +++ b/app/Contracts/Http/RuleSet.php @@ -10,7 +10,7 @@ interface RuleSet { /** - * Return an array containing the rules to be applied to the request attributes + * Return an array containing the rules to be applied to the request attributes. * * @return array */ diff --git a/app/Http/Livewire/Components/Header.php b/app/Http/Livewire/Components/Header.php index 37a4c0a0bc7..f945bbe9821 100644 --- a/app/Http/Livewire/Components/Header.php +++ b/app/Http/Livewire/Components/Header.php @@ -28,7 +28,6 @@ class Header extends Component public ?BaseAlbum $baseAlbum = null; public ?BaseSmartAlbum $smartAlbum = null; - /** * Render the header. * @@ -39,7 +38,6 @@ public function render(): View return view('livewire.components.header'); } - /** * Open a login modal box. * @@ -51,7 +49,7 @@ public function openLoginModal(): void } /** - * Go back one step + * Go back one step. * * @return void */ @@ -79,6 +77,4 @@ public function toggleSideBar(): void { $this->emitTo('components.sidebar', 'toggle'); } - - } \ No newline at end of file diff --git a/app/Http/Livewire/Forms/Settings/BooleanSetting.php b/app/Http/Livewire/Forms/Settings/BooleanSetting.php index e10b84a15e2..82297b9c7fb 100644 --- a/app/Http/Livewire/Forms/Settings/BooleanSetting.php +++ b/app/Http/Livewire/Forms/Settings/BooleanSetting.php @@ -7,16 +7,16 @@ use Illuminate\Database\Eloquent\InvalidCastException; use Illuminate\Database\Eloquent\JsonEncodingException; use Livewire\Component; -use RuntimeException; class BooleanSetting extends Component { public Configs $config; public string $description; public string $footer; - public bool $flag; //! Wired + public bool $flag; // ! Wired - public function mount(string $description, string $name, string $footer = '') { + public function mount(string $description, string $name, string $footer = '') + { $this->description = Lang::get($description); $this->footer = $footer !== '' ? Lang::get($footer) : ''; $this->config = Configs::where('key', '=', $name)->firstOrFail(); @@ -25,6 +25,7 @@ public function mount(string $description, string $name, string $footer = '') { public function render() { $this->flag = $this->config->value === '1'; + return view('livewire.form.form-toggle'); } @@ -33,15 +34,16 @@ public function render() * * @param mixed $field * @param mixed $value + * * @return void + * * @throws InvalidCastException * @throws JsonEncodingException - * @throws RuntimeException + * @throws \RuntimeException */ public function updating($field, $value) { $this->config->value = $value === true ? '1' : '0'; $this->config->save(); } - } \ No newline at end of file diff --git a/app/Http/Livewire/Forms/Settings/GetApiToken.php b/app/Http/Livewire/Forms/Settings/GetApiToken.php index 80ca05a6150..3c55d4382f4 100644 --- a/app/Http/Livewire/Forms/Settings/GetApiToken.php +++ b/app/Http/Livewire/Forms/Settings/GetApiToken.php @@ -25,7 +25,8 @@ class GetApiToken extends Component // token is hidden public bool $isHidden; - public function mount() { + public function mount() + { $user = Auth::user(); $this->isDisabled = !$user->has_token; @@ -47,9 +48,10 @@ public function close(): void $this->closeModal(); } - public function resetToken(TokenReset $tokenReset) { + public function resetToken(TokenReset $tokenReset) + { /** - * Authorize the request + * Authorize the request. */ $this->authorize(UserPolicy::CAN_EDIT, [User::class]); @@ -58,9 +60,10 @@ public function resetToken(TokenReset $tokenReset) { $this->isHidden = false; } - public function disableToken(TokenDisable $tokenDisable) { + public function disableToken(TokenDisable $tokenDisable) + { /** - * Authorize the request + * Authorize the request. */ $this->authorize(UserPolicy::CAN_EDIT, [User::class]); diff --git a/app/Http/Livewire/Forms/Settings/SetLogin.php b/app/Http/Livewire/Forms/Settings/SetLogin.php index 5fca6d95530..302a88091bf 100644 --- a/app/Http/Livewire/Forms/Settings/SetLogin.php +++ b/app/Http/Livewire/Forms/Settings/SetLogin.php @@ -18,12 +18,12 @@ class SetLogin extends Component { use InteractWithModal; - use AuthorizesRequests; + use AuthorizesRequests; - public string $oldPassword = ''; //! wired - public string $username = ''; //! wired - public string $password = ''; //! wired - public string $confirm = ''; //! wired + public string $oldPassword = ''; // ! wired + public string $username = ''; // ! wired + public string $password = ''; // ! wired + public string $confirm = ''; // ! wired public function render() { @@ -31,18 +31,18 @@ public function render() } /** - * Update Username & Password of current user + * Update Username & Password of current user. */ - public function submit(UpdateLogin $updateLogin) { - + public function submit(UpdateLogin $updateLogin) + { /** * For the validation to work it is important that the above wired property match - * the keys in the rules applied + * the keys in the rules applied. */ $this->validate(ChangeLoginRuleSet::rules()); /** - * Authorize the request + * Authorize the request. */ $this->authorize(UserPolicy::CAN_EDIT, [User::class]); @@ -59,7 +59,6 @@ public function submit(UpdateLogin $updateLogin) { Auth::login($currentUser); } - /** * Open a login modal box. * @@ -69,5 +68,4 @@ public function openApiTokenModal(): void { $this->openModal('forms.settings.get-api-token'); } - } \ No newline at end of file diff --git a/app/Http/Livewire/Pages/Settings.php b/app/Http/Livewire/Pages/Settings.php index 9bbcf756358..8d792d041ee 100644 --- a/app/Http/Livewire/Pages/Settings.php +++ b/app/Http/Livewire/Pages/Settings.php @@ -25,5 +25,4 @@ public function render(): View { return view('livewire.pages.settings'); } - } diff --git a/app/Http/Livewire/Traits/UrlChange.php b/app/Http/Livewire/Traits/UrlChange.php index d656f644589..fd5372cc439 100644 --- a/app/Http/Livewire/Traits/UrlChange.php +++ b/app/Http/Livewire/Traits/UrlChange.php @@ -15,10 +15,11 @@ trait UrlChange * Send an event to trigger updating the URL in the browser. * * @param PageMode $page - * @param string $albumId - * @param string $photoId + * @param string $albumId + * @param string $photoId * * @return void + * * @throws BindingResolutionException * @throws RouteNotFoundException */ @@ -27,5 +28,4 @@ protected function emitUrlChange(PageMode $page, string $albumId, string $photoI // This ensures that the history has been updated $this->emit('urlChange', route('livewire_index', ['page' => $page, 'albumId' => $albumId, 'photoId' => $photoId])); } - } \ No newline at end of file