@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | // How to update the database schema for this module |
| 71 | 71 | private const SCHEMA_TARGET_VERSION = 3; |
| 72 | 72 | private const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
| 73 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
| 73 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema'; |
|
| 74 | 74 | /** |
| 75 | 75 | * {@inheritDoc} |
| 76 | 76 | * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
@@ -110,25 +110,25 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function loadRoutes(Map $router): void |
| 112 | 112 | { |
| 113 | - $router->attach('', '', static function (Map $router): void { |
|
| 113 | + $router->attach('', '', static function(Map $router): void { |
|
| 114 | 114 | |
| 115 | - $router->attach('', '/module-maj/sosa', static function (Map $router): void { |
|
| 115 | + $router->attach('', '/module-maj/sosa', static function(Map $router): void { |
|
| 116 | 116 | |
| 117 | - $router->attach('', '/list', static function (Map $router): void { |
|
| 117 | + $router->attach('', '/list', static function(Map $router): void { |
|
| 118 | 118 | |
| 119 | 119 | $router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class); |
| 120 | - $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 121 | - $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 120 | + $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 121 | + $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 122 | 122 | $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class); |
| 123 | 123 | }); |
| 124 | 124 | |
| 125 | - $router->attach('', '/statistics/{tree}', static function (Map $router): void { |
|
| 125 | + $router->attach('', '/statistics/{tree}', static function(Map $router): void { |
|
| 126 | 126 | |
| 127 | 127 | $router->get(SosaStatistics::class, '', SosaStatistics::class); |
| 128 | 128 | $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class); |
| 129 | 129 | }); |
| 130 | 130 | |
| 131 | - $router->attach('', '/config/{tree}', static function (Map $router): void { |
|
| 131 | + $router->attach('', '/config/{tree}', static function(Map $router): void { |
|
| 132 | 132 | |
| 133 | 133 | $router->get(SosaConfig::class, '', SosaConfig::class); |
| 134 | 134 | $router->post(SosaConfigAction::class, '', SosaConfigAction::class); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | public function headContent(): string |
| 229 | 229 | { |
| 230 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
| 230 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function bodyContent(): string |
| 238 | 238 | { |
| 239 | - return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>'; |
|
| 239 | + return '<script src="'.$this->assetUrl('js/sosa.min.js').'"></script>'; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $individual = Registry::individualFactory()->make($xref, $tree); |
| 254 | 254 | |
| 255 | - return view($this->name() . '::sidebar/title', [ |
|
| 255 | + return view($this->name().'::sidebar/title', [ |
|
| 256 | 256 | 'module_name' => $this->name(), |
| 257 | 257 | 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($tree, $user, $individual) |
| 258 | 258 | ]); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree()); |
| 269 | 269 | $user = Auth::check() ? Auth::user() : new DefaultUser(); |
| 270 | 270 | |
| 271 | - return view($this->name() . '::sidebar/content', [ |
|
| 271 | + return view($this->name().'::sidebar/content', [ |
|
| 272 | 272 | 'sosa_ancestor' => $individual, |
| 273 | 273 | 'sosa_root' => $sosa_root, |
| 274 | 274 | 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function addPlace(GeoAnalysisPlace $place): void |
| 80 | 80 | { |
| 81 | - if($place->isKnown()) { |
|
| 81 | + if ($place->isKnown()) { |
|
| 82 | 82 | /** @var GeoAnalysisResultItem $item */ |
| 83 | 83 | $item = $this->places->get($place->key(), new GeoAnalysisResultItem($place)); |
| 84 | 84 | $this->places->put($item->key(), $item->increment()); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | /** @var GeoAnalysisResultItem|null $item */ |
| 98 | 98 | $item = $this->places->get($place->key()); |
| 99 | - if($item !== null) { |
|
| 99 | + if ($item !== null) { |
|
| 100 | 100 | $item->place()->exclude(); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function merge(GeoAnalysisResult $other): self |
| 135 | 135 | { |
| 136 | 136 | $this->places->each(function(GeoAnalysisResultItem $item) use ($other) : void { |
| 137 | - if($other->places->has($item->key())) { |
|
| 137 | + if ($other->places->has($item->key())) { |
|
| 138 | 138 | $item->place()->exclude( |
| 139 | 139 | $item->place()->isExcluded() |
| 140 | 140 | && $other->places->get($item->key())->place()->isExcluded() |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | }); |
| 144 | 144 | |
| 145 | 145 | $other->places->each(function(GeoAnalysisResultItem $item): void { |
| 146 | - if(!$this->places->has($item->key())) { |
|
| 146 | + if (!$this->places->has($item->key())) { |
|
| 147 | 147 | $this->addPlace($item->place()); |
| 148 | 148 | } |
| 149 | 149 | }); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function knownPlaces(bool $exclude_other = false): Collection |
| 215 | 215 | { |
| 216 | - if($exclude_other) { |
|
| 216 | + if ($exclude_other) { |
|
| 217 | 217 | return $this->places->reject(fn(GeoAnalysisResultItem $item): bool => $item->place()->isExcluded()); |
| 218 | 218 | } |
| 219 | 219 | return $this->places; |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | public function sortedKnownPlaces(bool $exclude_other = false): Collection |
| 230 | 230 | { |
| 231 | 231 | return $this->knownPlaces($exclude_other)->sortBy([ |
| 232 | - fn (GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => $b->count() <=> $a->count(), |
|
| 233 | - fn (GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => |
|
| 232 | + fn(GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => $b->count() <=> $a->count(), |
|
| 233 | + fn(GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => |
|
| 234 | 234 | I18N::comparator()($a->place()->place()->gedcomName(), $b->place()->place()->gedcomName()) |
| 235 | 235 | ]); |
| 236 | 236 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function addCategory(string $description, int $order): void |
| 91 | 91 | { |
| 92 | - if(!$this->detailed->has($description)) { |
|
| 92 | + if (!$this->detailed->has($description)) { |
|
| 93 | 93 | $this->detailed->put($description, new GeoAnalysisResult($description, $order)); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function addPlaceInCreatedCategory(string $category_name, GeoAnalysisPlace $place): void |
| 104 | 104 | { |
| 105 | - if($this->detailed->has($category_name)) { |
|
| 105 | + if ($this->detailed->has($category_name)) { |
|
| 106 | 106 | $this->detailed->get($category_name)->addPlace($place); |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function addPlaceInCategory(string $category_name, int $category_order, GeoAnalysisPlace $place): void |
| 117 | 117 | { |
| 118 | - if(!$this->detailed->has($category_name)) { |
|
| 118 | + if (!$this->detailed->has($category_name)) { |
|
| 119 | 119 | $this->addCategory($category_name, $category_order); |
| 120 | 120 | } |
| 121 | 121 | $this->addPlaceInCreatedCategory($category_name, $place); |
@@ -64,10 +64,10 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | private function extractPlace(?Place $place, int $depth, bool $strict_depth): ?Place |
| 66 | 66 | { |
| 67 | - if($place === null) return null; |
|
| 68 | - if(mb_strlen($place->gedcomName()) === 0) return null; |
|
| 67 | + if ($place === null) return null; |
|
| 68 | + if (mb_strlen($place->gedcomName()) === 0) return null; |
|
| 69 | 69 | $parts = $place->lastParts($depth); |
| 70 | - if($strict_depth && $parts->count() !== $depth) return new Place(self::INVALID_PLACE, $place->tree()); |
|
| 70 | + if ($strict_depth && $parts->count() !== $depth) return new Place(self::INVALID_PLACE, $place->tree()); |
|
| 71 | 71 | return new Place($parts->implode(', '), $place->tree()); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -74,11 +74,11 @@ |
||
| 74 | 74 | $reader = new GeoJSONReader(); |
| 75 | 75 | try { |
| 76 | 76 | $feature_collection = $reader->read($this->filesystem->read($this->path)); |
| 77 | - if($feature_collection instanceof FeatureCollection) { |
|
| 77 | + if ($feature_collection instanceof FeatureCollection) { |
|
| 78 | 78 | return $feature_collection->getFeatures(); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | - catch(Throwable $ex) { } |
|
| 81 | + catch (Throwable $ex) { } |
|
| 82 | 82 | return []; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -91,10 +91,10 @@ |
||
| 91 | 91 | */ |
| 92 | 92 | public function jsonDeserialize($config): self |
| 93 | 93 | { |
| 94 | - if(is_string($config)) { |
|
| 94 | + if (is_string($config)) { |
|
| 95 | 95 | return $this->jsonDeserialize(json_decode($config)); |
| 96 | 96 | } |
| 97 | - if(is_array($config)) { |
|
| 97 | + if (is_array($config)) { |
|
| 98 | 98 | return $this->setConfig($config); |
| 99 | 99 | } |
| 100 | 100 | return $this; |
@@ -64,10 +64,10 @@ |
||
| 64 | 64 | public function jsonSerialize() |
| 65 | 65 | { |
| 66 | 66 | return [ |
| 67 | - 'default' => (string) $this->defaultColor()->toHex(), |
|
| 68 | - 'stroke' => (string) $this->strokeColor()->toHex(), |
|
| 69 | - 'maxvalue' => (string) $this->maxValueColor()->toHex(), |
|
| 70 | - 'hover' => (string) $this->hoverColor()->toHex(), |
|
| 67 | + 'default' => (string)$this->defaultColor()->toHex(), |
|
| 68 | + 'stroke' => (string)$this->strokeColor()->toHex(), |
|
| 69 | + 'maxvalue' => (string)$this->maxValueColor()->toHex(), |
|
| 70 | + 'hover' => (string)$this->hoverColor()->toHex(), |
|
| 71 | 71 | ]; |
| 72 | 72 | } |
| 73 | 73 | |