@@ -82,7 +82,7 @@ |
||
| 82 | 82 | ); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - return $this->viewResponse($this->module->name() . '::admin/view-edit', [ |
|
| 85 | + return $this->viewResponse($this->module->name().'::admin/view-edit', [ |
|
| 86 | 86 | 'module' => $this->module, |
| 87 | 87 | 'title' => I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()), |
| 88 | 88 | 'tree' => $tree, |
@@ -61,12 +61,12 @@ |
||
| 61 | 61 | { |
| 62 | 62 | return Registry::cache()->array()->remember( |
| 63 | 63 | 'maj-geodisp-maps-all', |
| 64 | - function () use ($include_disabled): Collection { |
|
| 64 | + function() use ($include_disabled): Collection { |
|
| 65 | 65 | /** @var Collection<string, MapDefinitionInterface> $map_definitions */ |
| 66 | 66 | $map_definitions = $this->module_service |
| 67 | 67 | ->findByInterface(ModuleMapDefinitionProviderInterface::class, $include_disabled) |
| 68 | 68 | ->flatMap(fn(ModuleMapDefinitionProviderInterface $module) => $module->listMapDefinition()) |
| 69 | - ->mapWithKeys(fn(MapDefinitionInterface $map) => [ $map->id() => $map ]); |
|
| 69 | + ->mapWithKeys(fn(MapDefinitionInterface $map) => [$map->id() => $map]); |
|
| 70 | 70 | |
| 71 | 71 | return $map_definitions; |
| 72 | 72 | } |
@@ -57,10 +57,9 @@ |
||
| 57 | 57 | return ''; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $titles = $this->individualTitles($individual, '/(.*?) ((' . $title_separator . ')(.*))/i'); |
|
| 60 | + $titles = $this->individualTitles($individual, '/(.*?) (('.$title_separator.')(.*))/i'); |
|
| 61 | 61 | |
| 62 | - return count($titles) === 0 ? '' : |
|
| 63 | - view($this->module()->name() . '::components/accordion-item-titles', [ 'titles' => $titles ]); |
|
| 62 | + return count($titles) === 0 ? '' : view($this->module()->name().'::components/accordion-item-titles', ['titles' => $titles]); |
|
| 64 | 63 | } |
| 65 | 64 | |
| 66 | 65 | /** |
@@ -61,12 +61,12 @@ |
||
| 61 | 61 | public function factSourcePrepend(Tree $tree, $fact): string |
| 62 | 62 | { |
| 63 | 63 | $permission_level = $tree->getPreference('MAJ_CERTIF_SHOW_CERT'); |
| 64 | - if (is_numeric($permission_level) && Auth::accessLevel($tree) <= (int) $permission_level) { |
|
| 64 | + if (is_numeric($permission_level) && Auth::accessLevel($tree) <= (int)$permission_level) { |
|
| 65 | 65 | $path = $this->extractPath($fact); |
| 66 | 66 | |
| 67 | 67 | if ($path !== '') { |
| 68 | 68 | $certificate = new Certificate($tree, $path); |
| 69 | - return view($this->module->name() . '::components/certificate-icon', [ |
|
| 69 | + return view($this->module->name().'::components/certificate-icon', [ |
|
| 70 | 70 | 'module_name' => $this->module->name(), |
| 71 | 71 | 'certificate' => $certificate, |
| 72 | 72 | 'url_obfuscator_service' => $this->url_obfuscator_service, |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | bool $add_watermark = false, |
| 80 | 80 | Watermark $watermark = null |
| 81 | 81 | ): ResponseInterface { |
| 82 | - $filesystem = $this->filesystem_service->filesystem($certificate->tree()); |
|
| 82 | + $filesystem = $this->filesystem_service->filesystem($certificate->tree()); |
|
| 83 | 83 | $filename = $certificate->path(); |
| 84 | 84 | |
| 85 | 85 | if (!$add_watermark) { |
@@ -98,34 +98,34 @@ discard block |
||
| 98 | 98 | $height = $image->height(); |
| 99 | 99 | |
| 100 | 100 | $watermark->adjustSize($width); |
| 101 | - $watermark_x = (int) ceil($watermark->textLengthEstimate() * 1.5); |
|
| 101 | + $watermark_x = (int)ceil($watermark->textLengthEstimate() * 1.5); |
|
| 102 | 102 | $watermark_y = $watermark->size() * 12 + 1; |
| 103 | 103 | |
| 104 | - $font_definition = function (AbstractFont $font) use ($watermark): void { |
|
| 105 | - $font->file(Webtrees::ROOT_DIR . 'resources/fonts/DejaVuSans.ttf'); |
|
| 104 | + $font_definition = function(AbstractFont $font) use ($watermark): void { |
|
| 105 | + $font->file(Webtrees::ROOT_DIR.'resources/fonts/DejaVuSans.ttf'); |
|
| 106 | 106 | $font->color($watermark->color()); |
| 107 | 107 | $font->size($watermark->size()); |
| 108 | 108 | $font->valign('top'); |
| 109 | 109 | }; |
| 110 | 110 | |
| 111 | - for ($i = min((int) ceil($width * 0.1), $watermark_x); $i < $width; $i += $watermark_x) { |
|
| 112 | - for ($j = min((int) ceil($height * 0.1), $watermark_y); $j < $height; $j += $watermark_y) { |
|
| 111 | + for ($i = min((int)ceil($width * 0.1), $watermark_x); $i < $width; $i += $watermark_x) { |
|
| 112 | + for ($j = min((int)ceil($height * 0.1), $watermark_y); $j < $height; $j += $watermark_y) { |
|
| 113 | 113 | $image = $image->text($watermark->text(), $i, $j, $font_definition); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $format = static::SUPPORTED_FORMATS[$image->mime()] ?? 'jpg'; |
| 118 | 118 | $quality = $this->extractImageQuality($image, static::GD_DEFAULT_IMAGE_QUALITY); |
| 119 | - $data = (string) $image->encode($format, $quality); |
|
| 119 | + $data = (string)$image->encode($format, $quality); |
|
| 120 | 120 | |
| 121 | 121 | return $this->imageResponse($data, $image->mime(), ''); |
| 122 | 122 | } catch (NotReadableException $ex) { |
| 123 | 123 | return $this->replacementImageResponse(pathinfo($filename, PATHINFO_EXTENSION)) |
| 124 | 124 | ->withHeader('X-Image-Exception', $ex->getMessage()); |
| 125 | 125 | } catch (FilesystemException | UnableToReadFile $ex) { |
| 126 | - return $this->replacementImageResponse((string) StatusCodeInterface::STATUS_NOT_FOUND); |
|
| 126 | + return $this->replacementImageResponse((string)StatusCodeInterface::STATUS_NOT_FOUND); |
|
| 127 | 127 | } catch (Throwable $ex) { |
| 128 | - return $this->replacementImageResponse((string) StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR) |
|
| 128 | + return $this->replacementImageResponse((string)StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR) |
|
| 129 | 129 | ->withHeader('X-Image-Exception', $ex->getMessage()); |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | public function certificateNeedsWatermark(Certificate $certificate, UserInterface $user): bool |
| 141 | 141 | { |
| 142 | 142 | $tree = $certificate->tree(); |
| 143 | - $watermark_level = (int) ($tree->getPreference('MAJ_CERTIF_SHOW_NO_WATERMARK', (string) Auth::PRIV_HIDE)); |
|
| 143 | + $watermark_level = (int)($tree->getPreference('MAJ_CERTIF_SHOW_NO_WATERMARK', (string)Auth::PRIV_HIDE)); |
|
| 144 | 144 | |
| 145 | 145 | return Auth::accessLevel($tree, $user) > $watermark_level; |
| 146 | 146 | } |
@@ -71,10 +71,10 @@ |
||
| 71 | 71 | return collect(); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $query = Validator::attributes($request)->string('query', ''); |
|
| 74 | + $query = Validator::attributes($request)->string('query', ''); |
|
| 75 | 75 | |
| 76 | 76 | /** @var Collection<int, string> $results */ |
| 77 | - $results = $this->certif_filesystem |
|
| 77 | + $results = $this->certif_filesystem |
|
| 78 | 78 | ->certificatesForCityContaining($tree, $city, $query) |
| 79 | 79 | ->map(fn(Certificate $certificate): string => $certificate->filename()); |
| 80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | if ($certificate === null) { |
| 85 | 85 | return $this->certif_image_factory |
| 86 | - ->replacementImageResponse((string) StatusCodeInterface::STATUS_NOT_FOUND) |
|
| 86 | + ->replacementImageResponse((string)StatusCodeInterface::STATUS_NOT_FOUND) |
|
| 87 | 87 | ->withHeader('X-Image-Exception', I18N::translate('The certificate was not found in this family tree.')) |
| 88 | 88 | ; |
| 89 | 89 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $size = $certificate->tree()->getPreference('MAJ_CERTIF_WM_FONT_MAXSIZE'); |
| 112 | 112 | $text = $this->watermarkText($request, $certificate); |
| 113 | 113 | |
| 114 | - return new Watermark($text, $color, is_numeric($size) ? (int) $size : Watermark::DEFAULT_SIZE); |
|
| 114 | + return new Watermark($text, $color, is_numeric($size) ? (int)$size : Watermark::DEFAULT_SIZE); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $tree->setPreference( |
| 64 | 64 | 'MAJ_CERTIF_SHOW_CERT', |
| 65 | - (string) Validator::parsedBody($request)->integer('MAJ_CERTIF_SHOW_CERT', Auth::PRIV_HIDE) |
|
| 65 | + (string)Validator::parsedBody($request)->integer('MAJ_CERTIF_SHOW_CERT', Auth::PRIV_HIDE) |
|
| 66 | 66 | ); |
| 67 | 67 | $tree->setPreference( |
| 68 | 68 | 'MAJ_CERTIF_SHOW_NO_WATERMARK', |
| 69 | - (string) Validator::parsedBody($request)->integer('MAJ_CERTIF_SHOW_NO_WATERMARK', Auth::PRIV_HIDE) |
|
| 69 | + (string)Validator::parsedBody($request)->integer('MAJ_CERTIF_SHOW_NO_WATERMARK', Auth::PRIV_HIDE) |
|
| 70 | 70 | ); |
| 71 | 71 | $tree->setPreference( |
| 72 | 72 | 'MAJ_CERTIF_WM_DEFAULT', |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $tree->setPreference( |
| 77 | 77 | 'MAJ_CERTIF_WM_FONT_MAXSIZE', |
| 78 | - (string) ( |
|
| 78 | + (string)( |
|
| 79 | 79 | Validator::parsedBody($request)->isBetween(0, PHP_INT_MAX)->integer('MAJ_CERTIF_WM_FONT_MAXSIZE', 18) |
| 80 | 80 | ) |
| 81 | 81 | ); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | // Only accept valid folders for MAJ_CERT_ROOTDIR |
| 90 | 90 | $cert_root_dir = Validator::parsedBody($request)->string('MAJ_CERTIF_ROOTDIR', ''); |
| 91 | 91 | $cert_root_dir = preg_replace('/[:\/\\\\]+/', '/', $cert_root_dir) ?? ''; |
| 92 | - $cert_root_dir = trim($cert_root_dir, '/') . '/'; |
|
| 92 | + $cert_root_dir = trim($cert_root_dir, '/').'/'; |
|
| 93 | 93 | $tree->setPreference('MAJ_CERTIF_ROOTDIR', $cert_root_dir); |
| 94 | 94 | |
| 95 | 95 | FlashMessages::addMessage( |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | if (!isset($this->filesystem[$tree->id()])) { |
| 49 | 49 | $cert_dir = $tree->getPreference('MAJ_CERTIF_ROOTDIR', 'certificates/'); |
| 50 | - $adapter = new ChrootAdapter(Registry::filesystem()->data(), $cert_dir); |
|
| 50 | + $adapter = new ChrootAdapter(Registry::filesystem()->data(), $cert_dir); |
|
| 51 | 51 | |
| 52 | 52 | $this->filesystem[$tree->id()] = new FileSystem($adapter); |
| 53 | 53 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function cities(Tree $tree): array |
| 91 | 91 | { |
| 92 | - $cities = $this->filesystem($tree) |
|
| 92 | + $cities = $this->filesystem($tree) |
|
| 93 | 93 | ->listContents('') |
| 94 | 94 | ->filter(fn (StorageAttributes $attributes): bool => $attributes->isDir()) |
| 95 | 95 | ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | try { |
| 151 | 151 | $mime = $filesystem->mimeType($path); |
| 152 | 152 | return Registry::cache()->array()->remember( |
| 153 | - 'maj-certif-supportedfiles-' . $mime, |
|
| 153 | + 'maj-certif-supportedfiles-'.$mime, |
|
| 154 | 154 | fn (): bool => app(CertificateImageFactory::class)->isMimeTypeSupported($mime) |
| 155 | 155 | ); |
| 156 | 156 | } catch (UnableToRetrieveMetadata | FilesystemException $ex) { |