From 44c661997a6e30a18893518ba147dab2e910fbb4 Mon Sep 17 00:00:00 2001 From: Kirill Uksusov Date: Tue, 3 Dec 2024 14:05:31 +0400 Subject: [PATCH] Code style --- src/Helpers/AppHelper.php | 2 +- src/Helpers/ExifHelper.php | 8 ++++---- src/Http/Controllers/AdminController.php | 9 ++++----- src/Http/Controllers/DataController.php | 4 ++-- src/Modules/FacesModule.php | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Helpers/AppHelper.php b/src/Helpers/AppHelper.php index 2f1eecd..862013f 100644 --- a/src/Helpers/AppHelper.php +++ b/src/Helpers/AppHelper.php @@ -19,4 +19,4 @@ public static function get(string $class) throw new Exception('Can not find container resolver'); } -} \ No newline at end of file +} diff --git a/src/Helpers/ExifHelper.php b/src/Helpers/ExifHelper.php index d0932c9..dff5750 100644 --- a/src/Helpers/ExifHelper.php +++ b/src/Helpers/ExifHelper.php @@ -29,10 +29,10 @@ public function getMediaMap(string $file): ?array private function getCoordinates($face, $width, $height): ?array { - $x = (int)round($width * ($face['stArea:x'] - $face['stArea:w'] / 2)); - $y = (int)round($height * ($face['stArea:y'] - $face['stArea:h'] / 2)); - $w = (int)round($width * $face['stArea:w']); - $h = (int)round($height * $face['stArea:h']); + $x = (int) round($width * ($face['stArea:x'] - $face['stArea:w'] / 2)); + $y = (int) round($height * ($face['stArea:y'] - $face['stArea:h'] / 2)); + $w = (int) round($width * $face['stArea:w']); + $h = (int) round($height * $face['stArea:h']); return $face['stArea:unit'] === 'normalized' ? [ $x, diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index 84dc28d..c3d6dea 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -11,7 +11,6 @@ use Fisharebest\Webtrees\Media; use Fisharebest\Webtrees\MediaFile; use Fisharebest\Webtrees\Registry; -use Fisharebest\Webtrees\Services\LinkedRecordService; use Fisharebest\Webtrees\Services\TreeService; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface; @@ -155,9 +154,9 @@ private function prepareRow($row): array if ( $row->m_file === null || - ($tree = $this->trees->find((int)$row->m_file)) === null || + ($tree = $this->trees->find((int) $row->m_file)) === null || ($media = Registry::mediaFactory()->make($row->f_m_id, $tree)) === null || - ($file = $this->module->media->getMediaImageFileByOrder($media, (int)$row->f_m_order)) === null + ($file = $this->module->media->getMediaImageFileByOrder($media, (int) $row->f_m_order)) === null ) { return $this->rowMissed($row, $pids); } @@ -271,9 +270,9 @@ private function settingTab(): Response private function destroy(Request $request): Response { $count = $this->module->query->setMediaMap( - (int)$request->getQueryParams()['tid'], + (int) $request->getQueryParams()['tid'], $request->getQueryParams()['mid'], - (int)$request->getQueryParams()['order'], + (int) $request->getQueryParams()['order'], null, null ); diff --git a/src/Http/Controllers/DataController.php b/src/Http/Controllers/DataController.php index 75d74c6..4485f81 100644 --- a/src/Http/Controllers/DataController.php +++ b/src/Http/Controllers/DataController.php @@ -93,7 +93,7 @@ private function attach(Request $request, Media $media, string $fact): Response $map = $this->getMediaMap($media, $fact); - $map[] = (object)[ + $map[] = (object) [ 'pid' => $pid, 'coords' => $coords, ]; @@ -179,7 +179,7 @@ private function getMediaMapForTree(Media $media, string $fact): array $priorFact = $this->getMediaFacts($media)->first(); foreach ($areas as $area) { - $pid = (string)$area['pid']; + $pid = (string) $area['pid']; $result[$pid] = [ 'link' => null, 'pid' => $pid, diff --git a/src/Modules/FacesModule.php b/src/Modules/FacesModule.php index 742dbb2..2a51e23 100644 --- a/src/Modules/FacesModule.php +++ b/src/Modules/FacesModule.php @@ -183,14 +183,14 @@ public function settingToggle(string $key): bool { $state = !$this->settingEnabled($key); - $this->setPreference($key, (string)$state); + $this->setPreference($key, (string) $state); return $state; } public function settingEnabled(string $key): bool { - return (bool)$this->getPreference($key, (string)false); + return (bool) $this->getPreference($key, (string) false); } public function getConfigLink(): string