@@ -28,66 +28,66 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class AllEventsByCenturyGeoAnalysis implements GeoAnalysisInterface |
| 30 | 30 | { |
| 31 | - private GeoAnalysisDataService $geoanalysis_data_service; |
|
| 32 | - private CenturyService $century_service; |
|
| 31 | + private GeoAnalysisDataService $geoanalysis_data_service; |
|
| 32 | + private CenturyService $century_service; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Constructor for AllEventsByCenturyGeoAnalysis |
|
| 36 | - * |
|
| 37 | - * @param GeoAnalysisDataService $geoanalysis_data_service |
|
| 38 | - * @param CenturyService $century_service |
|
| 39 | - */ |
|
| 40 | - public function __construct(GeoAnalysisDataService $geoanalysis_data_service, CenturyService $century_service) |
|
| 41 | - { |
|
| 42 | - $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
| 43 | - $this->century_service = $century_service; |
|
| 44 | - } |
|
| 34 | + /** |
|
| 35 | + * Constructor for AllEventsByCenturyGeoAnalysis |
|
| 36 | + * |
|
| 37 | + * @param GeoAnalysisDataService $geoanalysis_data_service |
|
| 38 | + * @param CenturyService $century_service |
|
| 39 | + */ |
|
| 40 | + public function __construct(GeoAnalysisDataService $geoanalysis_data_service, CenturyService $century_service) |
|
| 41 | + { |
|
| 42 | + $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
| 43 | + $this->century_service = $century_service; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * {@inheritDoc} |
|
| 48 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::title() |
|
| 49 | - */ |
|
| 50 | - public function title(): string |
|
| 51 | - { |
|
| 52 | - return I18N::translate('All events places by century'); |
|
| 53 | - } |
|
| 46 | + /** |
|
| 47 | + * {@inheritDoc} |
|
| 48 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::title() |
|
| 49 | + */ |
|
| 50 | + public function title(): string |
|
| 51 | + { |
|
| 52 | + return I18N::translate('All events places by century'); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * {@inheritDoc} |
|
| 57 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::itemsDescription() |
|
| 58 | - */ |
|
| 59 | - public function itemsDescription(): callable |
|
| 60 | - { |
|
| 61 | - return fn(int $count): string => I18N::plural('event', 'events', $count); |
|
| 62 | - } |
|
| 55 | + /** |
|
| 56 | + * {@inheritDoc} |
|
| 57 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::itemsDescription() |
|
| 58 | + */ |
|
| 59 | + public function itemsDescription(): callable |
|
| 60 | + { |
|
| 61 | + return fn(int $count): string => I18N::plural('event', 'events', $count); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * {@inheritDoc} |
|
| 66 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::results() |
|
| 67 | - */ |
|
| 68 | - public function results(Tree $tree, int $depth): GeoAnalysisResults |
|
| 69 | - { |
|
| 70 | - $results = new GeoAnalysisResults(); |
|
| 64 | + /** |
|
| 65 | + * {@inheritDoc} |
|
| 66 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::results() |
|
| 67 | + */ |
|
| 68 | + public function results(Tree $tree, int $depth): GeoAnalysisResults |
|
| 69 | + { |
|
| 70 | + $results = new GeoAnalysisResults(); |
|
| 71 | 71 | |
| 72 | - foreach ($this->geoanalysis_data_service->individualsAndFamilies($tree) as $record) { |
|
| 73 | - foreach ($record->facts([]) as $fact) { |
|
| 74 | - $place = new GeoAnalysisPlace($tree, $fact->place(), $depth); |
|
| 75 | - if ($place->isUnknown()) { |
|
| 76 | - continue; |
|
| 77 | - } |
|
| 78 | - $results->addPlace($place); |
|
| 79 | - $date = $fact->date(); |
|
| 80 | - if ($date->isOK()) { |
|
| 81 | - $century = intdiv($date->gregorianYear(), 100); |
|
| 82 | - $results->addPlaceInCategory( |
|
| 83 | - I18N::translate('%s century', $this->century_service->centuryName($century)), |
|
| 84 | - $century, |
|
| 85 | - $place |
|
| 86 | - ); |
|
| 87 | - } |
|
| 88 | - } |
|
| 89 | - } |
|
| 72 | + foreach ($this->geoanalysis_data_service->individualsAndFamilies($tree) as $record) { |
|
| 73 | + foreach ($record->facts([]) as $fact) { |
|
| 74 | + $place = new GeoAnalysisPlace($tree, $fact->place(), $depth); |
|
| 75 | + if ($place->isUnknown()) { |
|
| 76 | + continue; |
|
| 77 | + } |
|
| 78 | + $results->addPlace($place); |
|
| 79 | + $date = $fact->date(); |
|
| 80 | + if ($date->isOK()) { |
|
| 81 | + $century = intdiv($date->gregorianYear(), 100); |
|
| 82 | + $results->addPlaceInCategory( |
|
| 83 | + I18N::translate('%s century', $this->century_service->centuryName($century)), |
|
| 84 | + $century, |
|
| 85 | + $place |
|
| 86 | + ); |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - return $results; |
|
| 92 | - } |
|
| 91 | + return $results; |
|
| 92 | + } |
|
| 93 | 93 | } |
@@ -24,23 +24,23 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class SimplePlaceMapper implements PlaceMapperInterface |
| 26 | 26 | { |
| 27 | - use PlaceMapperTrait; |
|
| 27 | + use PlaceMapperTrait; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * {@inheritDoc} |
|
| 31 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::title() |
|
| 32 | - */ |
|
| 33 | - public function title(): string |
|
| 34 | - { |
|
| 35 | - return I18N::translate('Mapping on place name'); |
|
| 36 | - } |
|
| 29 | + /** |
|
| 30 | + * {@inheritDoc} |
|
| 31 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::title() |
|
| 32 | + */ |
|
| 33 | + public function title(): string |
|
| 34 | + { |
|
| 35 | + return I18N::translate('Mapping on place name'); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * {@inheritDoc} |
|
| 40 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::map() |
|
| 41 | - */ |
|
| 42 | - public function map(Place $place, string $feature_property): ?string |
|
| 43 | - { |
|
| 44 | - return $place->firstParts(1)->first(); |
|
| 45 | - } |
|
| 38 | + /** |
|
| 39 | + * {@inheritDoc} |
|
| 40 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::map() |
|
| 41 | + */ |
|
| 42 | + public function map(Place $place, string $feature_property): ?string |
|
| 43 | + { |
|
| 44 | + return $place->firstParts(1)->first(); |
|
| 45 | + } |
|
| 46 | 46 | } |
@@ -28,51 +28,51 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class SimpleTopFilteredPlaceMapper extends SimplePlaceMapper implements PlaceMapperInterface |
| 30 | 30 | { |
| 31 | - use TopFilteredPlaceMapperTrait; |
|
| 31 | + use TopFilteredPlaceMapperTrait; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * {@inheritDoc} |
|
| 35 | - * @see \MyArtJaub\Webtrees\Module\GeoDispersion\PlaceMappers\SimplePlaceMapper::title() |
|
| 36 | - */ |
|
| 37 | - public function title(): string |
|
| 38 | - { |
|
| 39 | - return I18N::translate('Mapping on place name with filter'); |
|
| 40 | - } |
|
| 33 | + /** |
|
| 34 | + * {@inheritDoc} |
|
| 35 | + * @see \MyArtJaub\Webtrees\Module\GeoDispersion\PlaceMappers\SimplePlaceMapper::title() |
|
| 36 | + */ |
|
| 37 | + public function title(): string |
|
| 38 | + { |
|
| 39 | + return I18N::translate('Mapping on place name with filter'); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * {@inheritDoc} |
|
| 44 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::boot() |
|
| 45 | - */ |
|
| 46 | - public function boot(): void |
|
| 47 | - { |
|
| 48 | - parent::boot(); |
|
| 49 | - $top_places = $this->config()->get('topPlaces'); |
|
| 50 | - if (is_array($top_places)) { |
|
| 51 | - $this->setTopPlaces($top_places); |
|
| 52 | - } |
|
| 53 | - } |
|
| 42 | + /** |
|
| 43 | + * {@inheritDoc} |
|
| 44 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::boot() |
|
| 45 | + */ |
|
| 46 | + public function boot(): void |
|
| 47 | + { |
|
| 48 | + parent::boot(); |
|
| 49 | + $top_places = $this->config()->get('topPlaces'); |
|
| 50 | + if (is_array($top_places)) { |
|
| 51 | + $this->setTopPlaces($top_places); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * {@inheritDoc} |
|
| 57 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::config() |
|
| 58 | - */ |
|
| 59 | - public function config(): PlaceMapperConfigInterface |
|
| 60 | - { |
|
| 61 | - if (!(parent::config() instanceof FilteredTopPlaceMapperConfig)) { |
|
| 62 | - $this->setConfig(app(FilteredTopPlaceMapperConfig::class)); |
|
| 63 | - } |
|
| 64 | - return parent::config(); |
|
| 65 | - } |
|
| 55 | + /** |
|
| 56 | + * {@inheritDoc} |
|
| 57 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::config() |
|
| 58 | + */ |
|
| 59 | + public function config(): PlaceMapperConfigInterface |
|
| 60 | + { |
|
| 61 | + if (!(parent::config() instanceof FilteredTopPlaceMapperConfig)) { |
|
| 62 | + $this->setConfig(app(FilteredTopPlaceMapperConfig::class)); |
|
| 63 | + } |
|
| 64 | + return parent::config(); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * {@inheritDoc} |
|
| 69 | - * @see \MyArtJaub\Webtrees\Module\GeoDispersion\PlaceMappers\SimplePlaceMapper::map() |
|
| 70 | - */ |
|
| 71 | - public function map(Place $place, string $feature_property): ?string |
|
| 72 | - { |
|
| 73 | - if (!$this->belongsToTopLevels($place)) { |
|
| 74 | - return null; |
|
| 75 | - } |
|
| 76 | - return parent::map($place, $feature_property); |
|
| 77 | - } |
|
| 67 | + /** |
|
| 68 | + * {@inheritDoc} |
|
| 69 | + * @see \MyArtJaub\Webtrees\Module\GeoDispersion\PlaceMappers\SimplePlaceMapper::map() |
|
| 70 | + */ |
|
| 71 | + public function map(Place $place, string $feature_property): ?string |
|
| 72 | + { |
|
| 73 | + if (!$this->belongsToTopLevels($place)) { |
|
| 74 | + return null; |
|
| 75 | + } |
|
| 76 | + return parent::map($place, $feature_property); |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -20,32 +20,32 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class TokenService |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * Returns a random-ish generated token of a given size |
|
| 25 | - * |
|
| 26 | - * @param int $length Length of the token, default to 32 |
|
| 27 | - * @return string Random token |
|
| 28 | - */ |
|
| 29 | - public function generateRandomToken(int $length = 32): string |
|
| 30 | - { |
|
| 31 | - $chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); |
|
| 32 | - $len_chars = count($chars); |
|
| 33 | - $token = ''; |
|
| 34 | - |
|
| 35 | - for ($i = 0; $i < $length; $i++) { |
|
| 36 | - $token .= $chars[mt_rand(0, $len_chars - 1)]; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - # Number of 32 char chunks |
|
| 40 | - $chunks = ceil(strlen($token) / 32); |
|
| 41 | - $md5token = ''; |
|
| 42 | - |
|
| 43 | - # Run each chunk through md5 |
|
| 44 | - for ($i = 1; $i <= $chunks; $i++) { |
|
| 45 | - $md5token .= md5(substr($token, $i * 32 - 32, 32)); |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - # Trim the token to the required length |
|
| 49 | - return substr($md5token, 0, $length); |
|
| 50 | - } |
|
| 23 | + /** |
|
| 24 | + * Returns a random-ish generated token of a given size |
|
| 25 | + * |
|
| 26 | + * @param int $length Length of the token, default to 32 |
|
| 27 | + * @return string Random token |
|
| 28 | + */ |
|
| 29 | + public function generateRandomToken(int $length = 32): string |
|
| 30 | + { |
|
| 31 | + $chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); |
|
| 32 | + $len_chars = count($chars); |
|
| 33 | + $token = ''; |
|
| 34 | + |
|
| 35 | + for ($i = 0; $i < $length; $i++) { |
|
| 36 | + $token .= $chars[mt_rand(0, $len_chars - 1)]; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + # Number of 32 char chunks |
|
| 40 | + $chunks = ceil(strlen($token) / 32); |
|
| 41 | + $md5token = ''; |
|
| 42 | + |
|
| 43 | + # Run each chunk through md5 |
|
| 44 | + for ($i = 1; $i <= $chunks; $i++) { |
|
| 45 | + $md5token .= md5(substr($token, $i * 32 - 32, 32)); |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + # Trim the token to the required length |
|
| 49 | + return substr($md5token, 0, $length); |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -28,15 +28,15 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | function hook(string $hook_interface, callable $apply, $default = null) |
| 30 | 30 | { |
| 31 | - try { |
|
| 32 | - $hook_collector = app(HookServiceInterface::class)->use($hook_interface); |
|
| 33 | - if ($hook_collector !== null) { |
|
| 34 | - return $apply($hook_collector); |
|
| 35 | - } |
|
| 36 | - } catch (BindingResolutionException $ex) { |
|
| 37 | - } |
|
| 31 | + try { |
|
| 32 | + $hook_collector = app(HookServiceInterface::class)->use($hook_interface); |
|
| 33 | + if ($hook_collector !== null) { |
|
| 34 | + return $apply($hook_collector); |
|
| 35 | + } |
|
| 36 | + } catch (BindingResolutionException $ex) { |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - return $default; |
|
| 39 | + return $default; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -48,5 +48,5 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | function columnIndex(int $initial_index, Collection $new_column_indexes): int |
| 50 | 50 | { |
| 51 | - return $initial_index + $new_column_indexes->filter(fn(int $i) => $i <= $initial_index)->count(); |
|
| 51 | + return $initial_index + $new_column_indexes->filter(fn(int $i) => $i <= $initial_index)->count(); |
|
| 52 | 52 | } |
@@ -24,225 +24,225 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class GeoAnalysisResult |
| 26 | 26 | { |
| 27 | - private string $description; |
|
| 28 | - private int $order; |
|
| 29 | - private int $unknown_count; |
|
| 30 | - /** |
|
| 31 | - * @var Collection<GeoAnalysisResultItem> |
|
| 32 | - */ |
|
| 33 | - private Collection $places; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Constructor for GeoAnalysisResult |
|
| 37 | - * |
|
| 38 | - * @param string $description |
|
| 39 | - * @param int $order |
|
| 40 | - * @param Collection<GeoAnalysisResultItem> $places |
|
| 41 | - * @param int $unknown |
|
| 42 | - */ |
|
| 43 | - final public function __construct( |
|
| 44 | - string $description, |
|
| 45 | - int $order = 0, |
|
| 46 | - Collection $places = null, |
|
| 47 | - int $unknown = 0 |
|
| 48 | - ) { |
|
| 49 | - $this->description = $description; |
|
| 50 | - $this->order = $order; |
|
| 51 | - $this->places = $places ?? new Collection(); |
|
| 52 | - $this->unknown_count = $unknown; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Get the category description |
|
| 57 | - * |
|
| 58 | - * @return string |
|
| 59 | - */ |
|
| 60 | - public function description(): string |
|
| 61 | - { |
|
| 62 | - return $this->description; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Get the category order |
|
| 67 | - * |
|
| 68 | - * @return int |
|
| 69 | - */ |
|
| 70 | - public function order(): int |
|
| 71 | - { |
|
| 72 | - return $this->order; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * Add a place to the analysis result |
|
| 77 | - * |
|
| 78 | - * @param GeoAnalysisPlace $place |
|
| 79 | - */ |
|
| 80 | - public function addPlace(GeoAnalysisPlace $place): void |
|
| 81 | - { |
|
| 82 | - if ($place->isKnown()) { |
|
| 83 | - /** @var GeoAnalysisResultItem $item */ |
|
| 84 | - $item = $this->places->get($place->key(), new GeoAnalysisResultItem($place)); |
|
| 85 | - $this->places->put($item->key(), $item->increment()); |
|
| 86 | - } else { |
|
| 87 | - $this->addUnknown(); |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Exclude a place from the analysis result |
|
| 93 | - * |
|
| 94 | - * @param GeoAnalysisPlace $place |
|
| 95 | - */ |
|
| 96 | - public function exclude(GeoAnalysisPlace $place): void |
|
| 97 | - { |
|
| 98 | - /** @var GeoAnalysisResultItem|null $item */ |
|
| 99 | - $item = $this->places->get($place->key()); |
|
| 100 | - if ($item !== null) { |
|
| 101 | - $item->place()->exclude(); |
|
| 102 | - } |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * Add an unknown place to the analysis result |
|
| 107 | - */ |
|
| 108 | - public function addUnknown(): void |
|
| 109 | - { |
|
| 110 | - $this->unknown_count++; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Take a copy of the current analysis result |
|
| 115 | - * |
|
| 116 | - * @return static |
|
| 117 | - */ |
|
| 118 | - public function copy(): self |
|
| 119 | - { |
|
| 120 | - return new static( |
|
| 121 | - $this->description(), |
|
| 122 | - $this->order(), |
|
| 123 | - $this->places->map(fn(GeoAnalysisResultItem $item): GeoAnalysisResultItem => clone $item), |
|
| 124 | - $this->countUnknown() |
|
| 125 | - ); |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Merge the current analysis result with another. |
|
| 130 | - * The current object is modified, not the second one. |
|
| 131 | - * |
|
| 132 | - * @param GeoAnalysisResult $other |
|
| 133 | - * @return $this |
|
| 134 | - */ |
|
| 135 | - public function merge(GeoAnalysisResult $other): self |
|
| 136 | - { |
|
| 137 | - $this->places->each(function (GeoAnalysisResultItem $item) use ($other): void { |
|
| 138 | - if ($other->places->has($item->key())) { |
|
| 139 | - $item->place()->exclude( |
|
| 140 | - $item->place()->isExcluded() |
|
| 141 | - && $other->places->get($item->key())->place()->isExcluded() |
|
| 142 | - ); |
|
| 143 | - } |
|
| 144 | - }); |
|
| 145 | - |
|
| 146 | - $other->places->each(function (GeoAnalysisResultItem $item): void { |
|
| 147 | - if (!$this->places->has($item->key())) { |
|
| 148 | - $this->addPlace($item->place()); |
|
| 149 | - } |
|
| 150 | - }); |
|
| 151 | - |
|
| 152 | - return $this; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Get the count of Known places |
|
| 157 | - * |
|
| 158 | - * @return int |
|
| 159 | - */ |
|
| 160 | - public function countKnown(): int |
|
| 161 | - { |
|
| 162 | - return $this->places->sum(fn(GeoAnalysisResultItem $item): int => $item->count()) ?? 0; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Get the count of Found places |
|
| 167 | - * |
|
| 168 | - * @return int |
|
| 169 | - */ |
|
| 170 | - public function countFound(): int |
|
| 171 | - { |
|
| 172 | - return $this->places |
|
| 173 | - ->reject(fn(GeoAnalysisResultItem $item): bool => $item->place()->isExcluded()) |
|
| 174 | - ->sum(fn(GeoAnalysisResultItem $item): int => $item->count()) ?? 0; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * Get the count of Excluded places |
|
| 179 | - * |
|
| 180 | - * @return int |
|
| 181 | - */ |
|
| 182 | - public function countExcluded(): int |
|
| 183 | - { |
|
| 184 | - return $this->places |
|
| 185 | - ->filter(fn(GeoAnalysisResultItem $item): bool => $item->place()->isExcluded()) |
|
| 186 | - ->sum(fn(GeoAnalysisResultItem $item): int => $item->count()) ?? 0; |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Get the count of Unknown places |
|
| 191 | - * |
|
| 192 | - * @return int |
|
| 193 | - */ |
|
| 194 | - public function countUnknown(): int |
|
| 195 | - { |
|
| 196 | - return $this->unknown_count; |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - /** |
|
| 200 | - * Get the count of the most represented Place in the analysis result |
|
| 201 | - * |
|
| 202 | - * @return int |
|
| 203 | - */ |
|
| 204 | - public function maxCount(): int |
|
| 205 | - { |
|
| 206 | - return $this->places->max(fn(GeoAnalysisResultItem $item): int => $item->count()) ?? 0; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * Get the list of Known places with their associated count |
|
| 211 | - * |
|
| 212 | - * @param bool $exclude_other |
|
| 213 | - * @return Collection<GeoAnalysisResultItem> |
|
| 214 | - */ |
|
| 215 | - public function knownPlaces(bool $exclude_other = false): Collection |
|
| 216 | - { |
|
| 217 | - if ($exclude_other) { |
|
| 218 | - return $this->places->reject(fn(GeoAnalysisResultItem $item): bool => $item->place()->isExcluded()); |
|
| 219 | - } |
|
| 220 | - return $this->places; |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * Get the list of Known places with their associated count. |
|
| 225 | - * The list is sorted first by descending count, then by ascending Place name |
|
| 226 | - * |
|
| 227 | - * @param bool $exclude_other |
|
| 228 | - * @return Collection<GeoAnalysisResultItem> |
|
| 229 | - */ |
|
| 230 | - public function sortedKnownPlaces(bool $exclude_other = false): Collection |
|
| 231 | - { |
|
| 232 | - return $this->knownPlaces($exclude_other)->sortBy([ |
|
| 233 | - fn (GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => $b->count() <=> $a->count(), |
|
| 234 | - fn (GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => |
|
| 235 | - I18N::comparator()($a->place()->place()->gedcomName(), $b->place()->place()->gedcomName()) |
|
| 236 | - ]); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - /** |
|
| 240 | - * Get the list of Excluded places |
|
| 241 | - * |
|
| 242 | - * @return Collection<GeoAnalysisResultItem> |
|
| 243 | - */ |
|
| 244 | - public function excludedPlaces(): Collection |
|
| 245 | - { |
|
| 246 | - return $this->places->filter(fn(GeoAnalysisResultItem $item): bool => $item->place()->isExcluded()); |
|
| 247 | - } |
|
| 27 | + private string $description; |
|
| 28 | + private int $order; |
|
| 29 | + private int $unknown_count; |
|
| 30 | + /** |
|
| 31 | + * @var Collection<GeoAnalysisResultItem> |
|
| 32 | + */ |
|
| 33 | + private Collection $places; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Constructor for GeoAnalysisResult |
|
| 37 | + * |
|
| 38 | + * @param string $description |
|
| 39 | + * @param int $order |
|
| 40 | + * @param Collection<GeoAnalysisResultItem> $places |
|
| 41 | + * @param int $unknown |
|
| 42 | + */ |
|
| 43 | + final public function __construct( |
|
| 44 | + string $description, |
|
| 45 | + int $order = 0, |
|
| 46 | + Collection $places = null, |
|
| 47 | + int $unknown = 0 |
|
| 48 | + ) { |
|
| 49 | + $this->description = $description; |
|
| 50 | + $this->order = $order; |
|
| 51 | + $this->places = $places ?? new Collection(); |
|
| 52 | + $this->unknown_count = $unknown; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Get the category description |
|
| 57 | + * |
|
| 58 | + * @return string |
|
| 59 | + */ |
|
| 60 | + public function description(): string |
|
| 61 | + { |
|
| 62 | + return $this->description; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Get the category order |
|
| 67 | + * |
|
| 68 | + * @return int |
|
| 69 | + */ |
|
| 70 | + public function order(): int |
|
| 71 | + { |
|
| 72 | + return $this->order; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * Add a place to the analysis result |
|
| 77 | + * |
|
| 78 | + * @param GeoAnalysisPlace $place |
|
| 79 | + */ |
|
| 80 | + public function addPlace(GeoAnalysisPlace $place): void |
|
| 81 | + { |
|
| 82 | + if ($place->isKnown()) { |
|
| 83 | + /** @var GeoAnalysisResultItem $item */ |
|
| 84 | + $item = $this->places->get($place->key(), new GeoAnalysisResultItem($place)); |
|
| 85 | + $this->places->put($item->key(), $item->increment()); |
|
| 86 | + } else { |
|
| 87 | + $this->addUnknown(); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Exclude a place from the analysis result |
|
| 93 | + * |
|
| 94 | + * @param GeoAnalysisPlace $place |
|
| 95 | + */ |
|
| 96 | + public function exclude(GeoAnalysisPlace $place): void |
|
| 97 | + { |
|
| 98 | + /** @var GeoAnalysisResultItem|null $item */ |
|
| 99 | + $item = $this->places->get($place->key()); |
|
| 100 | + if ($item !== null) { |
|
| 101 | + $item->place()->exclude(); |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * Add an unknown place to the analysis result |
|
| 107 | + */ |
|
| 108 | + public function addUnknown(): void |
|
| 109 | + { |
|
| 110 | + $this->unknown_count++; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Take a copy of the current analysis result |
|
| 115 | + * |
|
| 116 | + * @return static |
|
| 117 | + */ |
|
| 118 | + public function copy(): self |
|
| 119 | + { |
|
| 120 | + return new static( |
|
| 121 | + $this->description(), |
|
| 122 | + $this->order(), |
|
| 123 | + $this->places->map(fn(GeoAnalysisResultItem $item): GeoAnalysisResultItem => clone $item), |
|
| 124 | + $this->countUnknown() |
|
| 125 | + ); |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Merge the current analysis result with another. |
|
| 130 | + * The current object is modified, not the second one. |
|
| 131 | + * |
|
| 132 | + * @param GeoAnalysisResult $other |
|
| 133 | + * @return $this |
|
| 134 | + */ |
|
| 135 | + public function merge(GeoAnalysisResult $other): self |
|
| 136 | + { |
|
| 137 | + $this->places->each(function (GeoAnalysisResultItem $item) use ($other): void { |
|
| 138 | + if ($other->places->has($item->key())) { |
|
| 139 | + $item->place()->exclude( |
|
| 140 | + $item->place()->isExcluded() |
|
| 141 | + && $other->places->get($item->key())->place()->isExcluded() |
|
| 142 | + ); |
|
| 143 | + } |
|
| 144 | + }); |
|
| 145 | + |
|
| 146 | + $other->places->each(function (GeoAnalysisResultItem $item): void { |
|
| 147 | + if (!$this->places->has($item->key())) { |
|
| 148 | + $this->addPlace($item->place()); |
|
| 149 | + } |
|
| 150 | + }); |
|
| 151 | + |
|
| 152 | + return $this; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Get the count of Known places |
|
| 157 | + * |
|
| 158 | + * @return int |
|
| 159 | + */ |
|
| 160 | + public function countKnown(): int |
|
| 161 | + { |
|
| 162 | + return $this->places->sum(fn(GeoAnalysisResultItem $item): int => $item->count()) ?? 0; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Get the count of Found places |
|
| 167 | + * |
|
| 168 | + * @return int |
|
| 169 | + */ |
|
| 170 | + public function countFound(): int |
|
| 171 | + { |
|
| 172 | + return $this->places |
|
| 173 | + ->reject(fn(GeoAnalysisResultItem $item): bool => $item->place()->isExcluded()) |
|
| 174 | + ->sum(fn(GeoAnalysisResultItem $item): int => $item->count()) ?? 0; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * Get the count of Excluded places |
|
| 179 | + * |
|
| 180 | + * @return int |
|
| 181 | + */ |
|
| 182 | + public function countExcluded(): int |
|
| 183 | + { |
|
| 184 | + return $this->places |
|
| 185 | + ->filter(fn(GeoAnalysisResultItem $item): bool => $item->place()->isExcluded()) |
|
| 186 | + ->sum(fn(GeoAnalysisResultItem $item): int => $item->count()) ?? 0; |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Get the count of Unknown places |
|
| 191 | + * |
|
| 192 | + * @return int |
|
| 193 | + */ |
|
| 194 | + public function countUnknown(): int |
|
| 195 | + { |
|
| 196 | + return $this->unknown_count; |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + /** |
|
| 200 | + * Get the count of the most represented Place in the analysis result |
|
| 201 | + * |
|
| 202 | + * @return int |
|
| 203 | + */ |
|
| 204 | + public function maxCount(): int |
|
| 205 | + { |
|
| 206 | + return $this->places->max(fn(GeoAnalysisResultItem $item): int => $item->count()) ?? 0; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * Get the list of Known places with their associated count |
|
| 211 | + * |
|
| 212 | + * @param bool $exclude_other |
|
| 213 | + * @return Collection<GeoAnalysisResultItem> |
|
| 214 | + */ |
|
| 215 | + public function knownPlaces(bool $exclude_other = false): Collection |
|
| 216 | + { |
|
| 217 | + if ($exclude_other) { |
|
| 218 | + return $this->places->reject(fn(GeoAnalysisResultItem $item): bool => $item->place()->isExcluded()); |
|
| 219 | + } |
|
| 220 | + return $this->places; |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * Get the list of Known places with their associated count. |
|
| 225 | + * The list is sorted first by descending count, then by ascending Place name |
|
| 226 | + * |
|
| 227 | + * @param bool $exclude_other |
|
| 228 | + * @return Collection<GeoAnalysisResultItem> |
|
| 229 | + */ |
|
| 230 | + public function sortedKnownPlaces(bool $exclude_other = false): Collection |
|
| 231 | + { |
|
| 232 | + return $this->knownPlaces($exclude_other)->sortBy([ |
|
| 233 | + fn (GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => $b->count() <=> $a->count(), |
|
| 234 | + fn (GeoAnalysisResultItem $a, GeoAnalysisResultItem $b): int => |
|
| 235 | + I18N::comparator()($a->place()->place()->gedcomName(), $b->place()->place()->gedcomName()) |
|
| 236 | + ]); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + /** |
|
| 240 | + * Get the list of Excluded places |
|
| 241 | + * |
|
| 242 | + * @return Collection<GeoAnalysisResultItem> |
|
| 243 | + */ |
|
| 244 | + public function excludedPlaces(): Collection |
|
| 245 | + { |
|
| 246 | + return $this->places->filter(fn(GeoAnalysisResultItem $item): bool => $item->place()->isExcluded()); |
|
| 247 | + } |
|
| 248 | 248 | } |
@@ -27,59 +27,59 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class SimpleFilesystemMap implements MapDefinitionInterface |
| 29 | 29 | { |
| 30 | - private string $id; |
|
| 31 | - private string $title; |
|
| 32 | - private string $path; |
|
| 33 | - private FilesystemReader $filesystem; |
|
| 30 | + private string $id; |
|
| 31 | + private string $title; |
|
| 32 | + private string $path; |
|
| 33 | + private FilesystemReader $filesystem; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Constructor for SimpleFilesystemMap |
|
| 37 | - * |
|
| 38 | - * @param string $id |
|
| 39 | - * @param string $title |
|
| 40 | - * @param FilesystemReader $filesystem |
|
| 41 | - * @param string $path |
|
| 42 | - */ |
|
| 43 | - public function __construct(string $id, string $title, FilesystemReader $filesystem, string $path) |
|
| 44 | - { |
|
| 45 | - $this->id = $id; |
|
| 46 | - $this->title = $title; |
|
| 47 | - $this->filesystem = $filesystem; |
|
| 48 | - $this->path = $path; |
|
| 49 | - } |
|
| 35 | + /** |
|
| 36 | + * Constructor for SimpleFilesystemMap |
|
| 37 | + * |
|
| 38 | + * @param string $id |
|
| 39 | + * @param string $title |
|
| 40 | + * @param FilesystemReader $filesystem |
|
| 41 | + * @param string $path |
|
| 42 | + */ |
|
| 43 | + public function __construct(string $id, string $title, FilesystemReader $filesystem, string $path) |
|
| 44 | + { |
|
| 45 | + $this->id = $id; |
|
| 46 | + $this->title = $title; |
|
| 47 | + $this->filesystem = $filesystem; |
|
| 48 | + $this->path = $path; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * {@inheritDoc} |
|
| 53 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::id() |
|
| 54 | - */ |
|
| 55 | - public function id(): string |
|
| 56 | - { |
|
| 57 | - return $this->id; |
|
| 58 | - } |
|
| 51 | + /** |
|
| 52 | + * {@inheritDoc} |
|
| 53 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::id() |
|
| 54 | + */ |
|
| 55 | + public function id(): string |
|
| 56 | + { |
|
| 57 | + return $this->id; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * {@inheritDoc} |
|
| 62 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::title() |
|
| 63 | - */ |
|
| 64 | - public function title(): string |
|
| 65 | - { |
|
| 66 | - return $this->title; |
|
| 67 | - } |
|
| 60 | + /** |
|
| 61 | + * {@inheritDoc} |
|
| 62 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::title() |
|
| 63 | + */ |
|
| 64 | + public function title(): string |
|
| 65 | + { |
|
| 66 | + return $this->title; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * {@inheritDoc} |
|
| 71 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::features() |
|
| 72 | - */ |
|
| 73 | - public function features(): array |
|
| 74 | - { |
|
| 75 | - $reader = new GeoJSONReader(); |
|
| 76 | - try { |
|
| 77 | - $feature_collection = $reader->read($this->filesystem->read($this->path)); |
|
| 78 | - if ($feature_collection instanceof FeatureCollection) { |
|
| 79 | - return $feature_collection->getFeatures(); |
|
| 80 | - } |
|
| 81 | - } catch (Throwable $ex) { |
|
| 82 | - } |
|
| 83 | - return []; |
|
| 84 | - } |
|
| 69 | + /** |
|
| 70 | + * {@inheritDoc} |
|
| 71 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::features() |
|
| 72 | + */ |
|
| 73 | + public function features(): array |
|
| 74 | + { |
|
| 75 | + $reader = new GeoJSONReader(); |
|
| 76 | + try { |
|
| 77 | + $feature_collection = $reader->read($this->filesystem->read($this->path)); |
|
| 78 | + if ($feature_collection instanceof FeatureCollection) { |
|
| 79 | + return $feature_collection->getFeatures(); |
|
| 80 | + } |
|
| 81 | + } catch (Throwable $ex) { |
|
| 82 | + } |
|
| 83 | + return []; |
|
| 84 | + } |
|
| 85 | 85 | } |
@@ -23,92 +23,92 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class MapColorsConfig implements JsonSerializable |
| 25 | 25 | { |
| 26 | - private Color $default; |
|
| 27 | - private Color $stroke; |
|
| 28 | - private Color $max_value; |
|
| 29 | - private Color $hover; |
|
| 26 | + private Color $default; |
|
| 27 | + private Color $stroke; |
|
| 28 | + private Color $max_value; |
|
| 29 | + private Color $hover; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Constructor for MapColorsConfig |
|
| 33 | - * |
|
| 34 | - * @param Color $default |
|
| 35 | - * @param Color $stroke |
|
| 36 | - * @param Color $max_value |
|
| 37 | - * @param Color $hover |
|
| 38 | - */ |
|
| 39 | - public function __construct( |
|
| 40 | - Color $default, |
|
| 41 | - Color $stroke, |
|
| 42 | - Color $max_value, |
|
| 43 | - Color $hover |
|
| 44 | - ) { |
|
| 45 | - $this->default = $default; |
|
| 46 | - $this->stroke = $stroke; |
|
| 47 | - $this->max_value = $max_value; |
|
| 48 | - $this->hover = $hover; |
|
| 49 | - } |
|
| 31 | + /** |
|
| 32 | + * Constructor for MapColorsConfig |
|
| 33 | + * |
|
| 34 | + * @param Color $default |
|
| 35 | + * @param Color $stroke |
|
| 36 | + * @param Color $max_value |
|
| 37 | + * @param Color $hover |
|
| 38 | + */ |
|
| 39 | + public function __construct( |
|
| 40 | + Color $default, |
|
| 41 | + Color $stroke, |
|
| 42 | + Color $max_value, |
|
| 43 | + Color $hover |
|
| 44 | + ) { |
|
| 45 | + $this->default = $default; |
|
| 46 | + $this->stroke = $stroke; |
|
| 47 | + $this->max_value = $max_value; |
|
| 48 | + $this->hover = $hover; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Get the default color for the features |
|
| 53 | - * |
|
| 54 | - * @return Color |
|
| 55 | - */ |
|
| 56 | - public function defaultColor(): Color |
|
| 57 | - { |
|
| 58 | - return $this->default; |
|
| 59 | - } |
|
| 51 | + /** |
|
| 52 | + * Get the default color for the features |
|
| 53 | + * |
|
| 54 | + * @return Color |
|
| 55 | + */ |
|
| 56 | + public function defaultColor(): Color |
|
| 57 | + { |
|
| 58 | + return $this->default; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Get the color for the features' strokes |
|
| 63 | - * |
|
| 64 | - * @return Color |
|
| 65 | - */ |
|
| 66 | - public function strokeColor(): Color |
|
| 67 | - { |
|
| 68 | - return $this->stroke; |
|
| 69 | - } |
|
| 61 | + /** |
|
| 62 | + * Get the color for the features' strokes |
|
| 63 | + * |
|
| 64 | + * @return Color |
|
| 65 | + */ |
|
| 66 | + public function strokeColor(): Color |
|
| 67 | + { |
|
| 68 | + return $this->stroke; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Get the color for the features with the lowest count |
|
| 73 | - * |
|
| 74 | - * @return Color |
|
| 75 | - */ |
|
| 76 | - public function minValueColor(): Color |
|
| 77 | - { |
|
| 78 | - return new Rgb(255, 255, 255); |
|
| 79 | - } |
|
| 71 | + /** |
|
| 72 | + * Get the color for the features with the lowest count |
|
| 73 | + * |
|
| 74 | + * @return Color |
|
| 75 | + */ |
|
| 76 | + public function minValueColor(): Color |
|
| 77 | + { |
|
| 78 | + return new Rgb(255, 255, 255); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Get the color for the features with the highest count |
|
| 83 | - * |
|
| 84 | - * @return Color |
|
| 85 | - */ |
|
| 86 | - public function maxValueColor(): Color |
|
| 87 | - { |
|
| 88 | - return $this->max_value; |
|
| 89 | - } |
|
| 81 | + /** |
|
| 82 | + * Get the color for the features with the highest count |
|
| 83 | + * |
|
| 84 | + * @return Color |
|
| 85 | + */ |
|
| 86 | + public function maxValueColor(): Color |
|
| 87 | + { |
|
| 88 | + return $this->max_value; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * Get the color for feature hovering |
|
| 93 | - * |
|
| 94 | - * @return Color |
|
| 95 | - */ |
|
| 96 | - public function hoverColor(): Color |
|
| 97 | - { |
|
| 98 | - return $this->hover; |
|
| 99 | - } |
|
| 91 | + /** |
|
| 92 | + * Get the color for feature hovering |
|
| 93 | + * |
|
| 94 | + * @return Color |
|
| 95 | + */ |
|
| 96 | + public function hoverColor(): Color |
|
| 97 | + { |
|
| 98 | + return $this->hover; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * {@inheritDoc} |
|
| 103 | - * @see JsonSerializable::jsonSerialize() |
|
| 104 | - */ |
|
| 105 | - public function jsonSerialize() |
|
| 106 | - { |
|
| 107 | - return [ |
|
| 108 | - 'default' => (string) $this->defaultColor()->toHex(), |
|
| 109 | - 'stroke' => (string) $this->strokeColor()->toHex(), |
|
| 110 | - 'maxvalue' => (string) $this->maxValueColor()->toHex(), |
|
| 111 | - 'hover' => (string) $this->hoverColor()->toHex(), |
|
| 112 | - ]; |
|
| 113 | - } |
|
| 101 | + /** |
|
| 102 | + * {@inheritDoc} |
|
| 103 | + * @see JsonSerializable::jsonSerialize() |
|
| 104 | + */ |
|
| 105 | + public function jsonSerialize() |
|
| 106 | + { |
|
| 107 | + return [ |
|
| 108 | + 'default' => (string) $this->defaultColor()->toHex(), |
|
| 109 | + 'stroke' => (string) $this->strokeColor()->toHex(), |
|
| 110 | + 'maxvalue' => (string) $this->maxValueColor()->toHex(), |
|
| 111 | + 'hover' => (string) $this->hoverColor()->toHex(), |
|
| 112 | + ]; |
|
| 113 | + } |
|
| 114 | 114 | } |
@@ -26,61 +26,61 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class NullPlaceMapperConfig implements PlaceMapperConfigInterface |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * {@inheritDoc} |
|
| 31 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 32 | - */ |
|
| 33 | - public function get(string $key, $default = null) |
|
| 34 | - { |
|
| 35 | - return $default; |
|
| 36 | - } |
|
| 29 | + /** |
|
| 30 | + * {@inheritDoc} |
|
| 31 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 32 | + */ |
|
| 33 | + public function get(string $key, $default = null) |
|
| 34 | + { |
|
| 35 | + return $default; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * {@inheritDoc} |
|
| 40 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 41 | - */ |
|
| 42 | - public function has(string $key): bool |
|
| 43 | - { |
|
| 44 | - return false; |
|
| 45 | - } |
|
| 38 | + /** |
|
| 39 | + * {@inheritDoc} |
|
| 40 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 41 | + */ |
|
| 42 | + public function has(string $key): bool |
|
| 43 | + { |
|
| 44 | + return false; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * {@inheritDoc} |
|
| 49 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 50 | - * |
|
| 51 | - * @param mixed $config |
|
| 52 | - * @return $this |
|
| 53 | - */ |
|
| 54 | - public function jsonDeserialize($config): self |
|
| 55 | - { |
|
| 56 | - return $this; |
|
| 57 | - } |
|
| 47 | + /** |
|
| 48 | + * {@inheritDoc} |
|
| 49 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 50 | + * |
|
| 51 | + * @param mixed $config |
|
| 52 | + * @return $this |
|
| 53 | + */ |
|
| 54 | + public function jsonDeserialize($config): self |
|
| 55 | + { |
|
| 56 | + return $this; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * {@inheritDoc} |
|
| 61 | - * @see JsonSerializable::jsonSerialize() |
|
| 62 | - */ |
|
| 63 | - public function jsonSerialize() |
|
| 64 | - { |
|
| 65 | - return []; |
|
| 66 | - } |
|
| 59 | + /** |
|
| 60 | + * {@inheritDoc} |
|
| 61 | + * @see JsonSerializable::jsonSerialize() |
|
| 62 | + */ |
|
| 63 | + public function jsonSerialize() |
|
| 64 | + { |
|
| 65 | + return []; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * {@inheritDoc} |
|
| 70 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
| 71 | - */ |
|
| 72 | - public function configContent(ModuleInterface $module, Tree $tree): string |
|
| 73 | - { |
|
| 74 | - return ''; |
|
| 75 | - } |
|
| 68 | + /** |
|
| 69 | + * {@inheritDoc} |
|
| 70 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
| 71 | + */ |
|
| 72 | + public function configContent(ModuleInterface $module, Tree $tree): string |
|
| 73 | + { |
|
| 74 | + return ''; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * {@inheritDoc} |
|
| 79 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
| 80 | - * @return $this |
|
| 81 | - */ |
|
| 82 | - public function withConfigUpdate(ServerRequestInterface $request): self |
|
| 83 | - { |
|
| 84 | - return $this; |
|
| 85 | - } |
|
| 77 | + /** |
|
| 78 | + * {@inheritDoc} |
|
| 79 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
| 80 | + * @return $this |
|
| 81 | + */ |
|
| 82 | + public function withConfigUpdate(ServerRequestInterface $request): self |
|
| 83 | + { |
|
| 84 | + return $this; |
|
| 85 | + } |
|
| 86 | 86 | } |