Passed
Branch feature/2.1-geodispersion-dev (1d61a8)
by Jonathan
61:21
created
src/Webtrees/Module/Certificates/Services/CertificateFilesystemService.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         if (!isset($this->filesystem[$tree->id()])) {
48 48
             $cert_dir = $tree->getPreference('MAJ_CERTIF_ROOTDIR', 'certificates/');
49
-            $adapter   = new ChrootAdapter(Registry::filesystem()->data(), $cert_dir);
49
+            $adapter = new ChrootAdapter(Registry::filesystem()->data(), $cert_dir);
50 50
 
51 51
             $this->filesystem[$tree->id()] = new FileSystem($adapter);
52 52
         }
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
     {
91 91
         return $this->filesystem($tree)
92 92
             ->listContents('')
93
-            ->filter(function (StorageAttributes $attributes): bool {
93
+            ->filter(function(StorageAttributes $attributes): bool {
94 94
                 return $attributes->isDir();
95
-            })->map(function (StorageAttributes $attributes): string {
95
+            })->map(function(StorageAttributes $attributes): string {
96 96
                 return $attributes->path();
97 97
             })->toArray();
98 98
     }
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
         $filesystem = $this->filesystem($tree);
110 110
         $certificate_paths = collect($filesystem
111 111
             ->listContents($city)
112
-            ->filter(function (StorageAttributes $attributes) use ($filesystem): bool {
112
+            ->filter(function(StorageAttributes $attributes) use ($filesystem): bool {
113 113
                 return $attributes->isFile() && $this->isFileSupported($filesystem, $attributes->path());
114
-            })->map(function (StorageAttributes $attributes): string {
114
+            })->map(function(StorageAttributes $attributes): string {
115 115
                 return $attributes->path();
116 116
             })->toArray());
117 117
 
118
-        return $certificate_paths->map(function (string $path) use ($tree): Certificate {
118
+        return $certificate_paths->map(function(string $path) use ($tree): Certificate {
119 119
             return new Certificate($tree, $path);
120 120
         });
121 121
     }
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
         $filesystem = $this->filesystem($tree);
134 134
         $certificate_paths = collect($filesystem
135 135
             ->listContents($city)
136
-            ->filter(function (StorageAttributes $attributes) use ($filesystem, $contains): bool {
136
+            ->filter(function(StorageAttributes $attributes) use ($filesystem, $contains): bool {
137 137
                 return $attributes->isFile() && $this->isFileSupported($filesystem, $attributes->path())
138 138
                     && mb_stripos($attributes->path(), $contains) !== false;
139
-            })->map(function (StorageAttributes $attributes): string {
139
+            })->map(function(StorageAttributes $attributes): string {
140 140
                 return $attributes->path();
141 141
             })->toArray());
142 142
 
143
-        return $certificate_paths->map(function (string $path) use ($tree): Certificate {
143
+        return $certificate_paths->map(function(string $path) use ($tree): Certificate {
144 144
             return new Certificate($tree, $path);
145 145
         });
146 146
     }
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
         try {
158 158
             $mime = $filesystem->mimeType($path);
159 159
             return Registry::cache()->array()->remember(
160
-                'maj-certif-supportedfiles-' . $mime,
161
-                function () use ($mime): bool {
160
+                'maj-certif-supportedfiles-'.$mime,
161
+                function() use ($mime): bool {
162 162
                     return app(CertificateImageFactory::class)->isMimeTypeSupported($mime);
163 163
                 }
164 164
             );
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/Services/UrlObfuscatorService.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
             $server_software = $request->getServerParams()['SERVER_SOFTWARE'] ?? '';
44 44
             $this->encryption_key = str_pad(md5(
45 45
                 $server_name !== '' && $server_software !== '' ?
46
-                $server_name . $server_software :
47
-                'STANDARDKEYIFNOSERVER'
46
+                $server_name.$server_software : 'STANDARDKEYIFNOSERVER'
48 47
             ), SODIUM_CRYPTO_SECRETBOX_KEYBYTES, "1234567890ABCDEF");
49 48
         }
50 49
         return $this->encryption_key;
@@ -78,7 +77,7 @@  discard block
 block discarded – undo
78 77
 
79 78
         \Fisharebest\Webtrees\DebugBar::addMessage($key);
80 79
         $encryted = sodium_crypto_secretbox($cleartext, $nonce, $key);
81
-        return strtr(base64_encode($nonce . $encryted), '+/=', '._-');
80
+        return strtr(base64_encode($nonce.$encryted), '+/=', '._-');
82 81
     }
83 82
 
84 83
     /**
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/Services/CertificateDataService.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $tree = $certificate->tree();
44 44
         return DB::table('individuals')
45 45
             ->where('i_file', '=', $tree->id())
46
-            ->where('i_gedcom', 'like', '% _ACT ' . $this->escapedSqlPath($certificate) . '%')
46
+            ->where('i_gedcom', 'like', '% _ACT '.$this->escapedSqlPath($certificate).'%')
47 47
             ->select(['individuals.*'])
48 48
             ->get()
49 49
             ->map(Registry::individualFactory()->mapper($tree))
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $tree = $certificate->tree();
65 65
         return DB::table('families')
66 66
             ->where('f_file', '=', $tree->id())
67
-            ->where('f_gedcom', 'like', '% _ACT ' . $this->escapedSqlPath($certificate) . '%')
67
+            ->where('f_gedcom', 'like', '% _ACT '.$this->escapedSqlPath($certificate).'%')
68 68
             ->select(['families.*'])
69 69
             ->get()
70 70
             ->map(Registry::familyFactory()->mapper($tree))
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $tree = $certificate->tree();
86 86
         return DB::table('media')
87 87
             ->where('m_file', '=', $tree->id())
88
-            ->where('m_gedcom', 'like', '% _ACT ' . $this->escapedSqlPath($certificate) . '%')
88
+            ->where('m_gedcom', 'like', '% _ACT '.$this->escapedSqlPath($certificate).'%')
89 89
             ->select(['media.*'])
90 90
             ->get()
91 91
             ->map(Registry::mediaFactory()->mapper($tree))
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         return DB::table('other')
108 108
             ->where('o_file', '=', $tree->id())
109 109
             ->where('o_type', '=', 'NOTE')
110
-            ->where('o_gedcom', 'like', '% _ACT ' . $this->escapedSqlPath($certificate) . '%')
110
+            ->where('o_gedcom', 'like', '% _ACT '.$this->escapedSqlPath($certificate).'%')
111 111
             ->select(['other.*'])
112 112
             ->get()
113 113
             ->map(Registry::noteFactory()->mapper($tree))
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     public function oneLinkedSource(Certificate $certificate): ?Source
136 136
     {
137 137
         $regex_query = preg_quote($certificate->gedcomPath(), '/');
138
-        $regex_pattern = '/[1-9] SOUR @(' . Gedcom::REGEX_XREF . ')@(?:\n[2-9]\s(?:(?!SOUR)\w+)\s.*)*\n[2-9] _ACT ' . $regex_query . '/i'; //phpcs:ignore Generic.Files.LineLength.TooLong
138
+        $regex_pattern = '/[1-9] SOUR @('.Gedcom::REGEX_XREF.')@(?:\n[2-9]\s(?:(?!SOUR)\w+)\s.*)*\n[2-9] _ACT '.$regex_query.'/i'; //phpcs:ignore Generic.Files.LineLength.TooLong
139 139
 
140 140
         foreach ($this->linkedRecordsLists($certificate) as $linked_records) {
141 141
             foreach ($linked_records as $gedcom_record) {
Please login to merge, or discard this patch.
src/Webtrees/Module/Certificates/Factories/CertificateImageFactory.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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::INTERVENTION_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
     }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Model/GeoAnalysisMapAdapter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                     ->withProperty(
124 124
                         'places',
125 125
                         $feature_data->places()
126
-                            ->map(fn(GeoAnalysisPlace $place): string => $place->place()->firstParts(1)->first())
126
+                            ->map(fn(GeoAnalysisPlace $place) : string => $place->place()->firstParts(1)->first())
127 127
                             ->sort(I18N::comparator())
128 128
                             ->toArray()
129 129
                     );
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         $features_data
136 136
             ->filter(fn(MapFeatureAnalysisData $data) => !$data->existsInMap())
137 137
             ->each(
138
-                fn (MapFeatureAnalysisData $data) =>
138
+                fn(MapFeatureAnalysisData $data) =>
139 139
                     $data->places()->each(
140 140
                         fn(GeoAnalysisPlace $place) => $result->exclude($place)
141 141
                     )
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         $features_mapping = new Collection();
156 156
 
157 157
         $byplaces = $result->knownPlaces();
158
-        $byplaces->each(function (GeoAnalysisResultItem $item) use ($features_mapping, $result): void {
158
+        $byplaces->each(function(GeoAnalysisResultItem $item) use ($features_mapping, $result): void {
159 159
             $id = $this->place_mapper->map($item->place()->place(), $this->config->mapMappingProperty());
160 160
 
161 161
             if ($id !== null && mb_strlen($id) > 0) {
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             }
169 169
         });
170 170
 
171
-        return [ $features_mapping, $result];
171
+        return [$features_mapping, $result];
172 172
     }
173 173
 
174 174
     /**
Please login to merge, or discard this patch.
Webtrees/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewTabs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
         assert($tree instanceof Tree);
61 61
 
62 62
         $view_id = $request->getAttribute('view_id');
63
-        $view_id = is_numeric($view_id) ? (int) $view_id : 0;
63
+        $view_id = is_numeric($view_id) ? (int)$view_id : 0;
64 64
 
65 65
         $view = $this->geoviewdata_service->find($tree, $view_id);
66 66
 
Please login to merge, or discard this patch.
Webtrees/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewsList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
             ->all($tree)
68 68
             ->sortBy(fn(AbstractGeoAnalysisView $view) => $view->description());
69 69
 
70
-        return $this->viewResponse($this->module->name() . '::geoanalysisviews-list', [
70
+        return $this->viewResponse($this->module->name().'::geoanalysisviews-list', [
71 71
             'module'        =>  $this->module,
72 72
             'title'         =>  I18N::translate('Geographical dispersion'),
73 73
             'tree'          =>  $tree,
Please login to merge, or discard this patch.
Webtrees/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewPage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@
 block discarded – undo
63 63
         assert($tree instanceof Tree);
64 64
 
65 65
         $view_id = $request->getAttribute('view_id');
66
-        $view_id = is_numeric($view_id) ? (int) $view_id : 0;
66
+        $view_id = is_numeric($view_id) ? (int)$view_id : 0;
67 67
 
68
-        return $this->viewResponse($this->module->name() . '::geoanalysisview-page', [
68
+        return $this->viewResponse($this->module->name().'::geoanalysisview-page', [
69 69
             'module_name'           =>  $this->module->name(),
70 70
             'title'                 =>  I18N::translate('Geographical dispersion'),
71 71
             'tree'                  =>  $tree,
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/GeoDispersionModule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     // How to update the database schema for this module
57 57
     private const SCHEMA_TARGET_VERSION   = 2;
58 58
     private const SCHEMA_SETTING_NAME     = 'MAJ_GEODISP_SCHEMA_VERSION';
59
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
59
+    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema';
60 60
 
61 61
     /**
62 62
      * {@inheritDoc}
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function loadRoutes(Map $router): void
108 108
     {
109
-        $router->attach('', '', static function (Map $router): void {
109
+        $router->attach('', '', static function(Map $router): void {
110 110
 
111
-            $router->attach('', '/module-maj/geodispersion', static function (Map $router): void {
111
+            $router->attach('', '/module-maj/geodispersion', static function(Map $router): void {
112 112
 
113 113
                 $router->get(GeoAnalysisViewsList::class, '/list/{tree}', GeoAnalysisViewsList::class);
114 114
 
115
-                $router->attach('', '/analysisview/{tree}/{view_id}', static function (Map $router): void {
115
+                $router->attach('', '/analysisview/{tree}/{view_id}', static function(Map $router): void {
116 116
                     $router->get(GeoAnalysisViewPage::class, '', GeoAnalysisViewPage::class);
117 117
                     $router->get(GeoAnalysisViewTabs::class, '/tabs', GeoAnalysisViewTabs::class);
118 118
                 });
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public function headContent(): string
146 146
     {
147
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
147
+        return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">';
148 148
     }
149 149
 
150 150
     /**
Please login to merge, or discard this patch.