@@ -19,68 +19,68 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class GeoAnalysisResultItem |
| 21 | 21 | { |
| 22 | - private GeoAnalysisPlace $place; |
|
| 23 | - private int $count; |
|
| 22 | + private GeoAnalysisPlace $place; |
|
| 23 | + private int $count; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Constructor for GeoAnalysisResultItem |
|
| 27 | - * |
|
| 28 | - * @param GeoAnalysisPlace $place |
|
| 29 | - * @param int $count |
|
| 30 | - */ |
|
| 31 | - public function __construct(GeoAnalysisPlace $place, int $count = 0) |
|
| 32 | - { |
|
| 33 | - $this->place = $place; |
|
| 34 | - $this->count = $count; |
|
| 35 | - } |
|
| 25 | + /** |
|
| 26 | + * Constructor for GeoAnalysisResultItem |
|
| 27 | + * |
|
| 28 | + * @param GeoAnalysisPlace $place |
|
| 29 | + * @param int $count |
|
| 30 | + */ |
|
| 31 | + public function __construct(GeoAnalysisPlace $place, int $count = 0) |
|
| 32 | + { |
|
| 33 | + $this->place = $place; |
|
| 34 | + $this->count = $count; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Get the item key. |
|
| 39 | - * |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - public function key(): string |
|
| 43 | - { |
|
| 44 | - return $this->place->key(); |
|
| 45 | - } |
|
| 37 | + /** |
|
| 38 | + * Get the item key. |
|
| 39 | + * |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + public function key(): string |
|
| 43 | + { |
|
| 44 | + return $this->place->key(); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Get the referenced GeoAnalysis Place |
|
| 49 | - * |
|
| 50 | - * @return GeoAnalysisPlace |
|
| 51 | - */ |
|
| 52 | - public function place(): GeoAnalysisPlace |
|
| 53 | - { |
|
| 54 | - return $this->place; |
|
| 55 | - } |
|
| 47 | + /** |
|
| 48 | + * Get the referenced GeoAnalysis Place |
|
| 49 | + * |
|
| 50 | + * @return GeoAnalysisPlace |
|
| 51 | + */ |
|
| 52 | + public function place(): GeoAnalysisPlace |
|
| 53 | + { |
|
| 54 | + return $this->place; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Get the count of occurences of the GeoAnalysis Place in the analysis |
|
| 59 | - * |
|
| 60 | - * @return int |
|
| 61 | - */ |
|
| 62 | - public function count(): int |
|
| 63 | - { |
|
| 64 | - return $this->count; |
|
| 65 | - } |
|
| 57 | + /** |
|
| 58 | + * Get the count of occurences of the GeoAnalysis Place in the analysis |
|
| 59 | + * |
|
| 60 | + * @return int |
|
| 61 | + */ |
|
| 62 | + public function count(): int |
|
| 63 | + { |
|
| 64 | + return $this->count; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Increment the count of occurrences of the GeoAnalysis Place in the analysis |
|
| 69 | - * |
|
| 70 | - * @return self |
|
| 71 | - */ |
|
| 72 | - public function increment(): self |
|
| 73 | - { |
|
| 74 | - $this->count++; |
|
| 75 | - return $this; |
|
| 76 | - } |
|
| 67 | + /** |
|
| 68 | + * Increment the count of occurrences of the GeoAnalysis Place in the analysis |
|
| 69 | + * |
|
| 70 | + * @return self |
|
| 71 | + */ |
|
| 72 | + public function increment(): self |
|
| 73 | + { |
|
| 74 | + $this->count++; |
|
| 75 | + return $this; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Clone the item object |
|
| 80 | - */ |
|
| 81 | - public function __clone() |
|
| 82 | - { |
|
| 83 | - $this->place = clone $this->place; |
|
| 84 | - } |
|
| 78 | + /** |
|
| 79 | + * Clone the item object |
|
| 80 | + */ |
|
| 81 | + public function __clone() |
|
| 82 | + { |
|
| 83 | + $this->place = clone $this->place; |
|
| 84 | + } |
|
| 85 | 85 | } |
| 86 | 86 | |
@@ -27,132 +27,132 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class GeoAnalysisPlace |
| 29 | 29 | { |
| 30 | - /** |
|
| 31 | - * The default place name for invalid places |
|
| 32 | - * @var string INVALID_PLACE |
|
| 33 | - */ |
|
| 34 | - private const INVALID_PLACE = '##INVALID##'; |
|
| 30 | + /** |
|
| 31 | + * The default place name for invalid places |
|
| 32 | + * @var string INVALID_PLACE |
|
| 33 | + */ |
|
| 34 | + private const INVALID_PLACE = '##INVALID##'; |
|
| 35 | 35 | |
| 36 | - private Place $place; |
|
| 37 | - private int $depth; |
|
| 38 | - private bool $strict_depth; |
|
| 39 | - private bool $is_excluded; |
|
| 36 | + private Place $place; |
|
| 37 | + private int $depth; |
|
| 38 | + private bool $strict_depth; |
|
| 39 | + private bool $is_excluded; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Constructor for GeoAnalysisPlace |
|
| 43 | - * |
|
| 44 | - * @param Tree $tree Default tree |
|
| 45 | - * @param Place|null $place Place resulting from the analysis |
|
| 46 | - * @param int $depth Place hierarchy depth defined by the geographical analysis view |
|
| 47 | - * @param bool $strict_depth Checks whether places with a lower depth than defined should be flagged as invalid |
|
| 48 | - */ |
|
| 49 | - public function __construct(Tree $tree, ?Place $place, int $depth, bool $strict_depth = false) |
|
| 50 | - { |
|
| 51 | - $this->depth = $depth; |
|
| 52 | - $this->strict_depth = $strict_depth; |
|
| 53 | - $this->place = $this->extractPlace($place, $depth, $strict_depth) ?? new Place('', $tree); |
|
| 54 | - $this->is_excluded = false; |
|
| 55 | - } |
|
| 41 | + /** |
|
| 42 | + * Constructor for GeoAnalysisPlace |
|
| 43 | + * |
|
| 44 | + * @param Tree $tree Default tree |
|
| 45 | + * @param Place|null $place Place resulting from the analysis |
|
| 46 | + * @param int $depth Place hierarchy depth defined by the geographical analysis view |
|
| 47 | + * @param bool $strict_depth Checks whether places with a lower depth than defined should be flagged as invalid |
|
| 48 | + */ |
|
| 49 | + public function __construct(Tree $tree, ?Place $place, int $depth, bool $strict_depth = false) |
|
| 50 | + { |
|
| 51 | + $this->depth = $depth; |
|
| 52 | + $this->strict_depth = $strict_depth; |
|
| 53 | + $this->place = $this->extractPlace($place, $depth, $strict_depth) ?? new Place('', $tree); |
|
| 54 | + $this->is_excluded = false; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Process the provided Place to determine its status for further usage |
|
| 59 | - * |
|
| 60 | - * @param Place|null $place |
|
| 61 | - * @param int $depth |
|
| 62 | - * @param bool $strict_depth |
|
| 63 | - * @return Place|NULL |
|
| 64 | - */ |
|
| 65 | - private function extractPlace(?Place $place, int $depth, bool $strict_depth): ?Place |
|
| 66 | - { |
|
| 67 | - if($place === null) return null; |
|
| 68 | - if(mb_strlen($place->gedcomName()) === 0) return null; |
|
| 69 | - $parts = $place->lastParts($depth); |
|
| 70 | - if($strict_depth && $parts->count() !== $depth) return new Place(self::INVALID_PLACE, $place->tree()); |
|
| 71 | - return new Place($parts->implode(', '), $place->tree()); |
|
| 72 | - } |
|
| 57 | + /** |
|
| 58 | + * Process the provided Place to determine its status for further usage |
|
| 59 | + * |
|
| 60 | + * @param Place|null $place |
|
| 61 | + * @param int $depth |
|
| 62 | + * @param bool $strict_depth |
|
| 63 | + * @return Place|NULL |
|
| 64 | + */ |
|
| 65 | + private function extractPlace(?Place $place, int $depth, bool $strict_depth): ?Place |
|
| 66 | + { |
|
| 67 | + if($place === null) return null; |
|
| 68 | + if(mb_strlen($place->gedcomName()) === 0) return null; |
|
| 69 | + $parts = $place->lastParts($depth); |
|
| 70 | + if($strict_depth && $parts->count() !== $depth) return new Place(self::INVALID_PLACE, $place->tree()); |
|
| 71 | + return new Place($parts->implode(', '), $place->tree()); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Get the GeoAnalysis Place key |
|
| 76 | - * |
|
| 77 | - * @return string |
|
| 78 | - */ |
|
| 79 | - public function key(): string |
|
| 80 | - { |
|
| 81 | - return $this->place->gedcomName(); |
|
| 82 | - } |
|
| 74 | + /** |
|
| 75 | + * Get the GeoAnalysis Place key |
|
| 76 | + * |
|
| 77 | + * @return string |
|
| 78 | + */ |
|
| 79 | + public function key(): string |
|
| 80 | + { |
|
| 81 | + return $this->place->gedcomName(); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Get the underlying Place object |
|
| 86 | - * |
|
| 87 | - * @return Place |
|
| 88 | - */ |
|
| 89 | - public function place(): Place |
|
| 90 | - { |
|
| 91 | - return $this->place; |
|
| 92 | - } |
|
| 84 | + /** |
|
| 85 | + * Get the underlying Place object |
|
| 86 | + * |
|
| 87 | + * @return Place |
|
| 88 | + */ |
|
| 89 | + public function place(): Place |
|
| 90 | + { |
|
| 91 | + return $this->place; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Check if the GeoAnalysis Place is in the Known status |
|
| 96 | - * |
|
| 97 | - * @return bool |
|
| 98 | - */ |
|
| 99 | - public function isKnown(): bool |
|
| 100 | - { |
|
| 101 | - return !$this->isUnknown(); |
|
| 102 | - } |
|
| 94 | + /** |
|
| 95 | + * Check if the GeoAnalysis Place is in the Known status |
|
| 96 | + * |
|
| 97 | + * @return bool |
|
| 98 | + */ |
|
| 99 | + public function isKnown(): bool |
|
| 100 | + { |
|
| 101 | + return !$this->isUnknown(); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Check if the GeoAnalysis Place is in the Unknown status |
|
| 106 | - * |
|
| 107 | - * @return bool |
|
| 108 | - */ |
|
| 109 | - public function isUnknown(): bool |
|
| 110 | - { |
|
| 111 | - return mb_strlen($this->place->gedcomName()) === 0; |
|
| 112 | - } |
|
| 104 | + /** |
|
| 105 | + * Check if the GeoAnalysis Place is in the Unknown status |
|
| 106 | + * |
|
| 107 | + * @return bool |
|
| 108 | + */ |
|
| 109 | + public function isUnknown(): bool |
|
| 110 | + { |
|
| 111 | + return mb_strlen($this->place->gedcomName()) === 0; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * Check if the GeoAnalysis Place is in the Invalid status |
|
| 116 | - * |
|
| 117 | - * @return bool |
|
| 118 | - */ |
|
| 119 | - public function isInvalid(): bool |
|
| 120 | - { |
|
| 121 | - return $this->place->gedcomName() === self::INVALID_PLACE; |
|
| 122 | - } |
|
| 114 | + /** |
|
| 115 | + * Check if the GeoAnalysis Place is in the Invalid status |
|
| 116 | + * |
|
| 117 | + * @return bool |
|
| 118 | + */ |
|
| 119 | + public function isInvalid(): bool |
|
| 120 | + { |
|
| 121 | + return $this->place->gedcomName() === self::INVALID_PLACE; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Check if the GeoAnalysis Place is in the Excluded status |
|
| 126 | - * |
|
| 127 | - * @return bool |
|
| 128 | - */ |
|
| 129 | - public function isExcluded(): bool |
|
| 130 | - { |
|
| 131 | - return $this->isUnknown() || $this->isInvalid() || $this->is_excluded; |
|
| 132 | - } |
|
| 124 | + /** |
|
| 125 | + * Check if the GeoAnalysis Place is in the Excluded status |
|
| 126 | + * |
|
| 127 | + * @return bool |
|
| 128 | + */ |
|
| 129 | + public function isExcluded(): bool |
|
| 130 | + { |
|
| 131 | + return $this->isUnknown() || $this->isInvalid() || $this->is_excluded; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * Set the GeoAnalysis Place status to Found, if the parameter is true |
|
| 136 | - * |
|
| 137 | - * @param bool $include |
|
| 138 | - * @return self |
|
| 139 | - */ |
|
| 140 | - public function include(bool $include = true): self |
|
| 141 | - { |
|
| 142 | - $this->is_excluded = !$include; |
|
| 143 | - return $this; |
|
| 144 | - } |
|
| 134 | + /** |
|
| 135 | + * Set the GeoAnalysis Place status to Found, if the parameter is true |
|
| 136 | + * |
|
| 137 | + * @param bool $include |
|
| 138 | + * @return self |
|
| 139 | + */ |
|
| 140 | + public function include(bool $include = true): self |
|
| 141 | + { |
|
| 142 | + $this->is_excluded = !$include; |
|
| 143 | + return $this; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Set the GeoAnalysis Place status to Excluded, if the parameter is true |
|
| 148 | - * |
|
| 149 | - * @param bool $exclude |
|
| 150 | - * @return self |
|
| 151 | - */ |
|
| 152 | - public function exclude(bool $exclude = true): self |
|
| 153 | - { |
|
| 154 | - $this->is_excluded = $exclude; |
|
| 155 | - return $this; |
|
| 156 | - } |
|
| 146 | + /** |
|
| 147 | + * Set the GeoAnalysis Place status to Excluded, if the parameter is true |
|
| 148 | + * |
|
| 149 | + * @param bool $exclude |
|
| 150 | + * @return self |
|
| 151 | + */ |
|
| 152 | + public function exclude(bool $exclude = true): self |
|
| 153 | + { |
|
| 154 | + $this->is_excluded = $exclude; |
|
| 155 | + return $this; |
|
| 156 | + } |
|
| 157 | 157 | } |
| 158 | 158 | |
@@ -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 | |
@@ -64,10 +64,16 @@ |
||
| 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) { |
|
| 68 | + return null; |
|
| 69 | + } |
|
| 70 | + if(mb_strlen($place->gedcomName()) === 0) { |
|
| 71 | + return null; |
|
| 72 | + } |
|
| 69 | 73 | $parts = $place->lastParts($depth); |
| 70 | - if($strict_depth && $parts->count() !== $depth) return new Place(self::INVALID_PLACE, $place->tree()); |
|
| 74 | + if($strict_depth && $parts->count() !== $depth) { |
|
| 75 | + return new Place(self::INVALID_PLACE, $place->tree()); |
|
| 76 | + } |
|
| 71 | 77 | return new Place($parts->implode(', '), $place->tree()); |
| 72 | 78 | } |
| 73 | 79 | |
@@ -26,61 +26,61 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class SimpleFilesystemMap implements MapDefinitionInterface |
| 28 | 28 | { |
| 29 | - private string $id; |
|
| 30 | - private string $title; |
|
| 31 | - private string $path; |
|
| 32 | - private FilesystemReader $filesystem; |
|
| 29 | + private string $id; |
|
| 30 | + private string $title; |
|
| 31 | + private string $path; |
|
| 32 | + private FilesystemReader $filesystem; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Constructor for SimpleFilesystemMap |
|
| 36 | - * |
|
| 37 | - * @param string $id |
|
| 38 | - * @param string $title |
|
| 39 | - * @param FilesystemReader $filesystem |
|
| 40 | - * @param string $path |
|
| 41 | - */ |
|
| 42 | - public function __construct(string $id, string $title, FilesystemReader $filesystem, string $path) |
|
| 43 | - { |
|
| 44 | - $this->id = $id; |
|
| 45 | - $this->title = $title; |
|
| 46 | - $this->filesystem = $filesystem; |
|
| 47 | - $this->path = $path; |
|
| 48 | - } |
|
| 34 | + /** |
|
| 35 | + * Constructor for SimpleFilesystemMap |
|
| 36 | + * |
|
| 37 | + * @param string $id |
|
| 38 | + * @param string $title |
|
| 39 | + * @param FilesystemReader $filesystem |
|
| 40 | + * @param string $path |
|
| 41 | + */ |
|
| 42 | + public function __construct(string $id, string $title, FilesystemReader $filesystem, string $path) |
|
| 43 | + { |
|
| 44 | + $this->id = $id; |
|
| 45 | + $this->title = $title; |
|
| 46 | + $this->filesystem = $filesystem; |
|
| 47 | + $this->path = $path; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * {@inheritDoc} |
|
| 52 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::id() |
|
| 53 | - */ |
|
| 54 | - public function id(): string |
|
| 55 | - { |
|
| 56 | - return $this->id; |
|
| 57 | - } |
|
| 50 | + /** |
|
| 51 | + * {@inheritDoc} |
|
| 52 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::id() |
|
| 53 | + */ |
|
| 54 | + public function id(): string |
|
| 55 | + { |
|
| 56 | + return $this->id; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * {@inheritDoc} |
|
| 61 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::title() |
|
| 62 | - */ |
|
| 63 | - public function title(): string |
|
| 64 | - { |
|
| 65 | - return $this->title; |
|
| 66 | - } |
|
| 59 | + /** |
|
| 60 | + * {@inheritDoc} |
|
| 61 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::title() |
|
| 62 | + */ |
|
| 63 | + public function title(): string |
|
| 64 | + { |
|
| 65 | + return $this->title; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * {@inheritDoc} |
|
| 70 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::features() |
|
| 71 | - */ |
|
| 72 | - public function features(): array |
|
| 73 | - { |
|
| 74 | - $reader = new GeoJSONReader(); |
|
| 75 | - try { |
|
| 76 | - $feature_collection = $reader->read($this->filesystem->read($this->path)); |
|
| 77 | - if($feature_collection instanceof FeatureCollection) { |
|
| 78 | - return $feature_collection->getFeatures(); |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - catch(Throwable $ex) { } |
|
| 82 | - return []; |
|
| 83 | - } |
|
| 68 | + /** |
|
| 69 | + * {@inheritDoc} |
|
| 70 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapDefinitionInterface::features() |
|
| 71 | + */ |
|
| 72 | + public function features(): array |
|
| 73 | + { |
|
| 74 | + $reader = new GeoJSONReader(); |
|
| 75 | + try { |
|
| 76 | + $feature_collection = $reader->read($this->filesystem->read($this->path)); |
|
| 77 | + if($feature_collection instanceof FeatureCollection) { |
|
| 78 | + return $feature_collection->getFeatures(); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + catch(Throwable $ex) { } |
|
| 82 | + return []; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | \ No newline at end of file |
@@ -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 | |
@@ -77,8 +77,7 @@ |
||
| 77 | 77 | if($feature_collection instanceof FeatureCollection) { |
| 78 | 78 | return $feature_collection->getFeatures(); |
| 79 | 79 | } |
| 80 | - } |
|
| 81 | - catch(Throwable $ex) { } |
|
| 80 | + } catch(Throwable $ex) { } |
|
| 82 | 81 | return []; |
| 83 | 82 | } |
| 84 | 83 | |
@@ -22,38 +22,38 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class MapViewConfig implements MapViewConfigInterface |
| 24 | 24 | { |
| 25 | - private string $map_mapping_property; |
|
| 26 | - private PlaceMapperConfigInterface $mapper_config; |
|
| 25 | + private string $map_mapping_property; |
|
| 26 | + private PlaceMapperConfigInterface $mapper_config; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Constructor for MapViewConfig |
|
| 30 | - * |
|
| 31 | - * @param string $map_mapping_property |
|
| 32 | - * @param PlaceMapperConfigInterface $mapper_config |
|
| 33 | - */ |
|
| 34 | - public function __construct( |
|
| 35 | - string $map_mapping_property, |
|
| 36 | - PlaceMapperConfigInterface $mapper_config = null |
|
| 37 | - ) { |
|
| 38 | - $this->map_mapping_property = $map_mapping_property; |
|
| 39 | - $this->mapper_config = $mapper_config ?? new NullPlaceMapperConfig(); |
|
| 40 | - } |
|
| 28 | + /** |
|
| 29 | + * Constructor for MapViewConfig |
|
| 30 | + * |
|
| 31 | + * @param string $map_mapping_property |
|
| 32 | + * @param PlaceMapperConfigInterface $mapper_config |
|
| 33 | + */ |
|
| 34 | + public function __construct( |
|
| 35 | + string $map_mapping_property, |
|
| 36 | + PlaceMapperConfigInterface $mapper_config = null |
|
| 37 | + ) { |
|
| 38 | + $this->map_mapping_property = $map_mapping_property; |
|
| 39 | + $this->mapper_config = $mapper_config ?? new NullPlaceMapperConfig(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * {@inheritDoc} |
|
| 44 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapMappingProperty() |
|
| 45 | - */ |
|
| 46 | - function mapMappingProperty(): string |
|
| 47 | - { |
|
| 48 | - return $this->map_mapping_property; |
|
| 49 | - } |
|
| 42 | + /** |
|
| 43 | + * {@inheritDoc} |
|
| 44 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapMappingProperty() |
|
| 45 | + */ |
|
| 46 | + function mapMappingProperty(): string |
|
| 47 | + { |
|
| 48 | + return $this->map_mapping_property; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * {@inheritDoc} |
|
| 53 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapperConfig() |
|
| 54 | - */ |
|
| 55 | - function mapperConfig(): PlaceMapperConfigInterface |
|
| 56 | - { |
|
| 57 | - return $this->mapper_config; |
|
| 58 | - } |
|
| 51 | + /** |
|
| 52 | + * {@inheritDoc} |
|
| 53 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapperConfig() |
|
| 54 | + */ |
|
| 55 | + function mapperConfig(): PlaceMapperConfigInterface |
|
| 56 | + { |
|
| 57 | + return $this->mapper_config; |
|
| 58 | + } |
|
| 59 | 59 | } |
| 60 | 60 | \ No newline at end of file |
@@ -22,41 +22,41 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class NullPlaceMapperConfig implements PlaceMapperConfigInterface |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * {@inheritDoc} |
|
| 27 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 28 | - */ |
|
| 29 | - public function get(string $key, $default = null) |
|
| 30 | - { |
|
| 31 | - return $default; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * {@inheritDoc} |
|
| 36 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 37 | - */ |
|
| 38 | - public function has(string $key): bool |
|
| 39 | - { |
|
| 40 | - return false; |
|
| 41 | - } |
|
| 25 | + /** |
|
| 26 | + * {@inheritDoc} |
|
| 27 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 28 | + */ |
|
| 29 | + public function get(string $key, $default = null) |
|
| 30 | + { |
|
| 31 | + return $default; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * {@inheritDoc} |
|
| 36 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 37 | + */ |
|
| 38 | + public function has(string $key): bool |
|
| 39 | + { |
|
| 40 | + return false; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * {@inheritDoc} |
|
| 45 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 46 | - */ |
|
| 47 | - public function jsonDeserialize($config): self |
|
| 48 | - { |
|
| 49 | - return $this; |
|
| 50 | - } |
|
| 43 | + /** |
|
| 44 | + * {@inheritDoc} |
|
| 45 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 46 | + */ |
|
| 47 | + public function jsonDeserialize($config): self |
|
| 48 | + { |
|
| 49 | + return $this; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * {@inheritDoc} |
|
| 54 | - * @see JsonSerializable::jsonSerialize() |
|
| 55 | - */ |
|
| 56 | - public function jsonSerialize() |
|
| 57 | - { |
|
| 58 | - return []; |
|
| 59 | - } |
|
| 52 | + /** |
|
| 53 | + * {@inheritDoc} |
|
| 54 | + * @see JsonSerializable::jsonSerialize() |
|
| 55 | + */ |
|
| 56 | + public function jsonSerialize() |
|
| 57 | + { |
|
| 58 | + return []; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | |
@@ -21,84 +21,84 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | class GenericPlaceMapperConfig implements PlaceMapperConfigInterface |
| 23 | 23 | { |
| 24 | - private array $config = []; |
|
| 24 | + private array $config = []; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Get the generic mapper's config |
|
| 28 | - * |
|
| 29 | - * @return array |
|
| 30 | - */ |
|
| 31 | - public function config(): array |
|
| 32 | - { |
|
| 33 | - return $this->config; |
|
| 34 | - } |
|
| 26 | + /** |
|
| 27 | + * Get the generic mapper's config |
|
| 28 | + * |
|
| 29 | + * @return array |
|
| 30 | + */ |
|
| 31 | + public function config(): array |
|
| 32 | + { |
|
| 33 | + return $this->config; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Set the generic mapper's config |
|
| 38 | - * |
|
| 39 | - * @param array $config |
|
| 40 | - * @return self |
|
| 41 | - */ |
|
| 42 | - public function setConfig(array $config): self |
|
| 43 | - { |
|
| 44 | - $this->config = $config; |
|
| 45 | - return $this; |
|
| 46 | - } |
|
| 36 | + /** |
|
| 37 | + * Set the generic mapper's config |
|
| 38 | + * |
|
| 39 | + * @param array $config |
|
| 40 | + * @return self |
|
| 41 | + */ |
|
| 42 | + public function setConfig(array $config): self |
|
| 43 | + { |
|
| 44 | + $this->config = $config; |
|
| 45 | + return $this; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * {@inheritDoc} |
|
| 50 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 51 | - */ |
|
| 52 | - public function get(string $key, $default = null) |
|
| 53 | - { |
|
| 54 | - return $this->config[$key] ?? $default; |
|
| 55 | - } |
|
| 48 | + /** |
|
| 49 | + * {@inheritDoc} |
|
| 50 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 51 | + */ |
|
| 52 | + public function get(string $key, $default = null) |
|
| 53 | + { |
|
| 54 | + return $this->config[$key] ?? $default; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * {@inheritDoc} |
|
| 59 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 60 | - */ |
|
| 61 | - public function has(string $key): bool |
|
| 62 | - { |
|
| 63 | - return key_exists($key, $this->config); |
|
| 64 | - } |
|
| 57 | + /** |
|
| 58 | + * {@inheritDoc} |
|
| 59 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 60 | + */ |
|
| 61 | + public function has(string $key): bool |
|
| 62 | + { |
|
| 63 | + return key_exists($key, $this->config); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * {@inheritDoc} |
|
| 68 | - * @see \JsonSerializable::jsonSerialize() |
|
| 69 | - */ |
|
| 70 | - public function jsonSerialize() |
|
| 71 | - { |
|
| 72 | - return [ |
|
| 73 | - 'class' => get_class($this), |
|
| 74 | - 'config' => $this->jsonSerializeConfig() |
|
| 75 | - ]; |
|
| 76 | - } |
|
| 66 | + /** |
|
| 67 | + * {@inheritDoc} |
|
| 68 | + * @see \JsonSerializable::jsonSerialize() |
|
| 69 | + */ |
|
| 70 | + public function jsonSerialize() |
|
| 71 | + { |
|
| 72 | + return [ |
|
| 73 | + 'class' => get_class($this), |
|
| 74 | + 'config' => $this->jsonSerializeConfig() |
|
| 75 | + ]; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Returns a representation of the mapper config compatible with Json serialisation |
|
| 80 | - * |
|
| 81 | - * @return mixed |
|
| 82 | - */ |
|
| 83 | - public function jsonSerializeConfig() |
|
| 84 | - { |
|
| 85 | - return $this->config; |
|
| 86 | - } |
|
| 78 | + /** |
|
| 79 | + * Returns a representation of the mapper config compatible with Json serialisation |
|
| 80 | + * |
|
| 81 | + * @return mixed |
|
| 82 | + */ |
|
| 83 | + public function jsonSerializeConfig() |
|
| 84 | + { |
|
| 85 | + return $this->config; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * {@inheritDoc} |
|
| 90 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 91 | - */ |
|
| 92 | - public function jsonDeserialize($config): self |
|
| 93 | - { |
|
| 94 | - if(is_string($config)) { |
|
| 95 | - return $this->jsonDeserialize(json_decode($config)); |
|
| 96 | - } |
|
| 97 | - if(is_array($config)) { |
|
| 98 | - return $this->setConfig($config); |
|
| 99 | - } |
|
| 100 | - return $this; |
|
| 101 | - } |
|
| 88 | + /** |
|
| 89 | + * {@inheritDoc} |
|
| 90 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 91 | + */ |
|
| 92 | + public function jsonDeserialize($config): self |
|
| 93 | + { |
|
| 94 | + if(is_string($config)) { |
|
| 95 | + return $this->jsonDeserialize(json_decode($config)); |
|
| 96 | + } |
|
| 97 | + if(is_array($config)) { |
|
| 98 | + return $this->setConfig($config); |
|
| 99 | + } |
|
| 100 | + return $this; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | } |
| 105 | 105 | \ No newline at end of file |
@@ -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; |
@@ -22,53 +22,53 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class MapColorsConfig implements JsonSerializable |
| 24 | 24 | { |
| 25 | - private Color $default, $stroke, $max_value, $hover; |
|
| 25 | + private Color $default, $stroke, $max_value, $hover; |
|
| 26 | 26 | |
| 27 | - public function __construct( |
|
| 28 | - Color $default, |
|
| 29 | - Color $stroke, |
|
| 30 | - Color $max_value, |
|
| 31 | - Color $hover |
|
| 32 | - ) { |
|
| 33 | - $this->default = $default; |
|
| 34 | - $this->stroke = $stroke; |
|
| 35 | - $this->max_value = $max_value; |
|
| 36 | - $this->hover = $hover; |
|
| 37 | - } |
|
| 27 | + public function __construct( |
|
| 28 | + Color $default, |
|
| 29 | + Color $stroke, |
|
| 30 | + Color $max_value, |
|
| 31 | + Color $hover |
|
| 32 | + ) { |
|
| 33 | + $this->default = $default; |
|
| 34 | + $this->stroke = $stroke; |
|
| 35 | + $this->max_value = $max_value; |
|
| 36 | + $this->hover = $hover; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - function defaultColor(): Color |
|
| 40 | - { |
|
| 41 | - return $this->default; |
|
| 42 | - } |
|
| 39 | + function defaultColor(): Color |
|
| 40 | + { |
|
| 41 | + return $this->default; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - function strokeColor(): Color |
|
| 45 | - { |
|
| 46 | - return $this->stroke; |
|
| 47 | - } |
|
| 44 | + function strokeColor(): Color |
|
| 45 | + { |
|
| 46 | + return $this->stroke; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - function minValueColor(): Color |
|
| 50 | - { |
|
| 51 | - return new Rgb(255, 255, 255); |
|
| 52 | - } |
|
| 49 | + function minValueColor(): Color |
|
| 50 | + { |
|
| 51 | + return new Rgb(255, 255, 255); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - function maxValueColor(): Color |
|
| 55 | - { |
|
| 56 | - return $this->max_value; |
|
| 57 | - } |
|
| 54 | + function maxValueColor(): Color |
|
| 55 | + { |
|
| 56 | + return $this->max_value; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - function hoverColor(): Color |
|
| 60 | - { |
|
| 61 | - return $this->hover; |
|
| 62 | - } |
|
| 59 | + function hoverColor(): Color |
|
| 60 | + { |
|
| 61 | + return $this->hover; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - public function jsonSerialize() |
|
| 65 | - { |
|
| 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(), |
|
| 71 | - ]; |
|
| 72 | - } |
|
| 64 | + public function jsonSerialize() |
|
| 65 | + { |
|
| 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(), |
|
| 71 | + ]; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | \ No newline at end of file |
@@ -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 | |