@@ -25,106 +25,106 @@ |
||
25 | 25 | */ |
26 | 26 | class GenericPlaceMapperConfig implements PlaceMapperConfigInterface |
27 | 27 | { |
28 | - /** @var array<string, mixed> $config */ |
|
29 | - private array $config = []; |
|
28 | + /** @var array<string, mixed> $config */ |
|
29 | + private array $config = []; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Get the generic mapper's config |
|
33 | - * |
|
34 | - * @return array<string, mixed> |
|
35 | - */ |
|
36 | - public function config(): array |
|
37 | - { |
|
38 | - return $this->config; |
|
39 | - } |
|
31 | + /** |
|
32 | + * Get the generic mapper's config |
|
33 | + * |
|
34 | + * @return array<string, mixed> |
|
35 | + */ |
|
36 | + public function config(): array |
|
37 | + { |
|
38 | + return $this->config; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Set the generic mapper's config |
|
43 | - * |
|
44 | - * @param array<string, mixed> $config |
|
45 | - * @return $this |
|
46 | - */ |
|
47 | - public function setConfig(array $config): self |
|
48 | - { |
|
49 | - $this->config = $config; |
|
50 | - return $this; |
|
51 | - } |
|
41 | + /** |
|
42 | + * Set the generic mapper's config |
|
43 | + * |
|
44 | + * @param array<string, mixed> $config |
|
45 | + * @return $this |
|
46 | + */ |
|
47 | + public function setConfig(array $config): self |
|
48 | + { |
|
49 | + $this->config = $config; |
|
50 | + return $this; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * {@inheritDoc} |
|
55 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
56 | - */ |
|
57 | - public function get(string $key, $default = null) |
|
58 | - { |
|
59 | - return $this->config[$key] ?? $default; |
|
60 | - } |
|
53 | + /** |
|
54 | + * {@inheritDoc} |
|
55 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
56 | + */ |
|
57 | + public function get(string $key, $default = null) |
|
58 | + { |
|
59 | + return $this->config[$key] ?? $default; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * {@inheritDoc} |
|
64 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
65 | - */ |
|
66 | - public function has(string $key): bool |
|
67 | - { |
|
68 | - return key_exists($key, $this->config); |
|
69 | - } |
|
62 | + /** |
|
63 | + * {@inheritDoc} |
|
64 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
65 | + */ |
|
66 | + public function has(string $key): bool |
|
67 | + { |
|
68 | + return key_exists($key, $this->config); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * {@inheritDoc} |
|
73 | - * @see \JsonSerializable::jsonSerialize() |
|
74 | - */ |
|
75 | - #[\ReturnTypeWillChange] |
|
76 | - public function jsonSerialize() |
|
77 | - { |
|
78 | - return [ |
|
79 | - 'class' => get_class($this), |
|
80 | - 'config' => $this->jsonSerializeConfig() |
|
81 | - ]; |
|
82 | - } |
|
71 | + /** |
|
72 | + * {@inheritDoc} |
|
73 | + * @see \JsonSerializable::jsonSerialize() |
|
74 | + */ |
|
75 | + #[\ReturnTypeWillChange] |
|
76 | + public function jsonSerialize() |
|
77 | + { |
|
78 | + return [ |
|
79 | + 'class' => get_class($this), |
|
80 | + 'config' => $this->jsonSerializeConfig() |
|
81 | + ]; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Returns a representation of the mapper config compatible with Json serialisation |
|
86 | - * |
|
87 | - * @return mixed |
|
88 | - */ |
|
89 | - public function jsonSerializeConfig() |
|
90 | - { |
|
91 | - return $this->config; |
|
92 | - } |
|
84 | + /** |
|
85 | + * Returns a representation of the mapper config compatible with Json serialisation |
|
86 | + * |
|
87 | + * @return mixed |
|
88 | + */ |
|
89 | + public function jsonSerializeConfig() |
|
90 | + { |
|
91 | + return $this->config; |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * {@inheritDoc} |
|
96 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
97 | - * |
|
98 | - * @param mixed $config |
|
99 | - * @return $this |
|
100 | - */ |
|
101 | - public function jsonDeserialize($config): self |
|
102 | - { |
|
103 | - if (is_string($config)) { |
|
104 | - return $this->jsonDeserialize((array) json_decode($config)); |
|
105 | - } |
|
106 | - if (is_array($config)) { |
|
107 | - return $this->setConfig($config); |
|
108 | - } |
|
109 | - return $this; |
|
110 | - } |
|
94 | + /** |
|
95 | + * {@inheritDoc} |
|
96 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
97 | + * |
|
98 | + * @param mixed $config |
|
99 | + * @return $this |
|
100 | + */ |
|
101 | + public function jsonDeserialize($config): self |
|
102 | + { |
|
103 | + if (is_string($config)) { |
|
104 | + return $this->jsonDeserialize((array) json_decode($config)); |
|
105 | + } |
|
106 | + if (is_array($config)) { |
|
107 | + return $this->setConfig($config); |
|
108 | + } |
|
109 | + return $this; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * {@inheritDoc} |
|
114 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
115 | - */ |
|
116 | - public function configContent(ModuleInterface $module, Tree $tree): string |
|
117 | - { |
|
118 | - return ''; |
|
119 | - } |
|
112 | + /** |
|
113 | + * {@inheritDoc} |
|
114 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
115 | + */ |
|
116 | + public function configContent(ModuleInterface $module, Tree $tree): string |
|
117 | + { |
|
118 | + return ''; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * {@inheritDoc} |
|
123 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
124 | - * @return $this |
|
125 | - */ |
|
126 | - public function withConfigUpdate(ServerRequestInterface $request): self |
|
127 | - { |
|
128 | - return $this; |
|
129 | - } |
|
121 | + /** |
|
122 | + * {@inheritDoc} |
|
123 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
124 | + * @return $this |
|
125 | + */ |
|
126 | + public function withConfigUpdate(ServerRequestInterface $request): self |
|
127 | + { |
|
128 | + return $this; |
|
129 | + } |
|
130 | 130 | } |
@@ -26,62 +26,62 @@ |
||
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 | - #[\ReturnTypeWillChange] |
|
64 | - public function jsonSerialize() |
|
65 | - { |
|
66 | - return []; |
|
67 | - } |
|
59 | + /** |
|
60 | + * {@inheritDoc} |
|
61 | + * @see JsonSerializable::jsonSerialize() |
|
62 | + */ |
|
63 | + #[\ReturnTypeWillChange] |
|
64 | + public function jsonSerialize() |
|
65 | + { |
|
66 | + return []; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * {@inheritDoc} |
|
71 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
72 | - */ |
|
73 | - public function configContent(ModuleInterface $module, Tree $tree): string |
|
74 | - { |
|
75 | - return ''; |
|
76 | - } |
|
69 | + /** |
|
70 | + * {@inheritDoc} |
|
71 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
72 | + */ |
|
73 | + public function configContent(ModuleInterface $module, Tree $tree): string |
|
74 | + { |
|
75 | + return ''; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * {@inheritDoc} |
|
80 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
81 | - * @return $this |
|
82 | - */ |
|
83 | - public function withConfigUpdate(ServerRequestInterface $request): self |
|
84 | - { |
|
85 | - return $this; |
|
86 | - } |
|
78 | + /** |
|
79 | + * {@inheritDoc} |
|
80 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
81 | + * @return $this |
|
82 | + */ |
|
83 | + public function withConfigUpdate(ServerRequestInterface $request): self |
|
84 | + { |
|
85 | + return $this; |
|
86 | + } |
|
87 | 87 | } |
@@ -23,93 +23,93 @@ |
||
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 | - #[\ReturnTypeWillChange] |
|
106 | - public function jsonSerialize() |
|
107 | - { |
|
108 | - return [ |
|
109 | - 'default' => (string) $this->defaultColor()->toHex(), |
|
110 | - 'stroke' => (string) $this->strokeColor()->toHex(), |
|
111 | - 'maxvalue' => (string) $this->maxValueColor()->toHex(), |
|
112 | - 'hover' => (string) $this->hoverColor()->toHex(), |
|
113 | - ]; |
|
114 | - } |
|
101 | + /** |
|
102 | + * {@inheritDoc} |
|
103 | + * @see JsonSerializable::jsonSerialize() |
|
104 | + */ |
|
105 | + #[\ReturnTypeWillChange] |
|
106 | + public function jsonSerialize() |
|
107 | + { |
|
108 | + return [ |
|
109 | + 'default' => (string) $this->defaultColor()->toHex(), |
|
110 | + 'stroke' => (string) $this->strokeColor()->toHex(), |
|
111 | + 'maxvalue' => (string) $this->maxValueColor()->toHex(), |
|
112 | + 'hover' => (string) $this->hoverColor()->toHex(), |
|
113 | + ]; |
|
114 | + } |
|
115 | 115 | } |