@@ -41,127 +41,127 @@ |
||
| 41 | 41 | * Allow for tasks to be run on a (nearly-)regular schedule |
| 42 | 42 | */ |
| 43 | 43 | class AdminTasksModule extends AbstractModule implements |
| 44 | - ModuleMyArtJaubInterface, |
|
| 45 | - ModuleConfigInterface, |
|
| 46 | - ModuleGlobalInterface, |
|
| 47 | - ModuleTasksProviderInterface |
|
| 44 | + ModuleMyArtJaubInterface, |
|
| 45 | + ModuleConfigInterface, |
|
| 46 | + ModuleGlobalInterface, |
|
| 47 | + ModuleTasksProviderInterface |
|
| 48 | 48 | { |
| 49 | - use ModuleMyArtJaubTrait { |
|
| 50 | - boot as traitBoot; |
|
| 51 | - } |
|
| 52 | - use ModuleConfigTrait; |
|
| 53 | - use ModuleGlobalTrait; |
|
| 54 | - |
|
| 55 | - //How to update the database schema for this module |
|
| 56 | - private const SCHEMA_TARGET_VERSION = 2; |
|
| 57 | - private const SCHEMA_SETTING_NAME = 'MAJ_ADMTASKS_SCHEMA_VERSION'; |
|
| 58 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * {@inheritDoc} |
|
| 62 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
| 63 | - */ |
|
| 64 | - public function title(): string |
|
| 65 | - { |
|
| 66 | - return I18N::translate('Administration Tasks'); |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * {@inheritDoc} |
|
| 71 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
| 72 | - */ |
|
| 73 | - public function description(): string |
|
| 74 | - { |
|
| 75 | - return I18N::translate('Manage and run nearly-scheduled administration tasks.'); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * {@inheritDoc} |
|
| 80 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
| 81 | - */ |
|
| 82 | - public function boot(): void |
|
| 83 | - { |
|
| 84 | - $this->traitBoot(); |
|
| 85 | - app(MigrationService::class)->updateSchema( |
|
| 86 | - self::SCHEMA_MIGRATION_PREFIX, |
|
| 87 | - self::SCHEMA_SETTING_NAME, |
|
| 88 | - self::SCHEMA_TARGET_VERSION |
|
| 89 | - ); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * {@inheritDoc} |
|
| 94 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
| 95 | - */ |
|
| 96 | - public function loadRoutes(Map $router): void |
|
| 97 | - { |
|
| 98 | - $router->attach('', '', static function (Map $router): void { |
|
| 99 | - |
|
| 100 | - $router->attach('', '/module-maj/admintasks', static function (Map $router): void { |
|
| 101 | - $router->tokens(['task' => '\d+', 'enable' => '[01]']); |
|
| 102 | - |
|
| 103 | - $router->attach('', '/admin', static function (Map $router): void { |
|
| 104 | - |
|
| 105 | - $router->extras([ |
|
| 106 | - 'middleware' => [ |
|
| 107 | - AuthAdministrator::class, |
|
| 108 | - ], |
|
| 109 | - ]); |
|
| 110 | - $router->get(AdminConfigPage::class, '/config', AdminConfigPage::class); |
|
| 111 | - |
|
| 112 | - $router->attach('', '/tasks', static function (Map $router): void { |
|
| 113 | - |
|
| 114 | - $router->get(TasksList::class, '', TasksList::class); |
|
| 115 | - $router->get(TaskEditPage::class, '/{task}', TaskEditPage::class); |
|
| 116 | - $router->post(TaskEditAction::class, '/{task}', TaskEditAction::class); |
|
| 117 | - $router->get(TaskStatusAction::class, '/{task}/status/{enable}', TaskStatusAction::class); |
|
| 118 | - }); |
|
| 119 | - }); |
|
| 120 | - |
|
| 121 | - $router->get(TaskTrigger::class, '/trigger{/task}', TaskTrigger::class) |
|
| 122 | - ->allows(RequestMethodInterface::METHOD_POST); |
|
| 123 | - |
|
| 124 | - $router->post(TokenGenerate::class, '/token', TokenGenerate::class) |
|
| 125 | - ->extras(['middleware' => [AuthAdministrator::class]]); |
|
| 126 | - }); |
|
| 127 | - }); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * {@inheritDoc} |
|
| 132 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleLatestVersion() |
|
| 133 | - */ |
|
| 134 | - public function customModuleVersion(): string |
|
| 135 | - { |
|
| 136 | - return '2.0.11-v.2'; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * {@inheritDoc} |
|
| 141 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 142 | - */ |
|
| 143 | - public function getConfigLink(): string |
|
| 144 | - { |
|
| 145 | - return route(AdminConfigPage::class); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * {@inheritDoc} |
|
| 150 | - * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent() |
|
| 151 | - */ |
|
| 152 | - public function bodyContent(): string |
|
| 153 | - { |
|
| 154 | - return view($this->name() . '::snippet', [ 'url' => route(TaskTrigger::class) ]); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * {@inheritDoc} |
|
| 159 | - * @see \MyArtJaub\Webtrees\Module\AdminTasks\Contracts\ModuleTasksProviderInterface::listTasks() |
|
| 160 | - */ |
|
| 161 | - public function listTasks(): array |
|
| 162 | - { |
|
| 163 | - return [ |
|
| 164 | - 'maj-healthcheck' => HealthCheckEmailTask::class |
|
| 165 | - ]; |
|
| 166 | - } |
|
| 49 | + use ModuleMyArtJaubTrait { |
|
| 50 | + boot as traitBoot; |
|
| 51 | + } |
|
| 52 | + use ModuleConfigTrait; |
|
| 53 | + use ModuleGlobalTrait; |
|
| 54 | + |
|
| 55 | + //How to update the database schema for this module |
|
| 56 | + private const SCHEMA_TARGET_VERSION = 2; |
|
| 57 | + private const SCHEMA_SETTING_NAME = 'MAJ_ADMTASKS_SCHEMA_VERSION'; |
|
| 58 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * {@inheritDoc} |
|
| 62 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
| 63 | + */ |
|
| 64 | + public function title(): string |
|
| 65 | + { |
|
| 66 | + return I18N::translate('Administration Tasks'); |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * {@inheritDoc} |
|
| 71 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
| 72 | + */ |
|
| 73 | + public function description(): string |
|
| 74 | + { |
|
| 75 | + return I18N::translate('Manage and run nearly-scheduled administration tasks.'); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * {@inheritDoc} |
|
| 80 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
| 81 | + */ |
|
| 82 | + public function boot(): void |
|
| 83 | + { |
|
| 84 | + $this->traitBoot(); |
|
| 85 | + app(MigrationService::class)->updateSchema( |
|
| 86 | + self::SCHEMA_MIGRATION_PREFIX, |
|
| 87 | + self::SCHEMA_SETTING_NAME, |
|
| 88 | + self::SCHEMA_TARGET_VERSION |
|
| 89 | + ); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * {@inheritDoc} |
|
| 94 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
| 95 | + */ |
|
| 96 | + public function loadRoutes(Map $router): void |
|
| 97 | + { |
|
| 98 | + $router->attach('', '', static function (Map $router): void { |
|
| 99 | + |
|
| 100 | + $router->attach('', '/module-maj/admintasks', static function (Map $router): void { |
|
| 101 | + $router->tokens(['task' => '\d+', 'enable' => '[01]']); |
|
| 102 | + |
|
| 103 | + $router->attach('', '/admin', static function (Map $router): void { |
|
| 104 | + |
|
| 105 | + $router->extras([ |
|
| 106 | + 'middleware' => [ |
|
| 107 | + AuthAdministrator::class, |
|
| 108 | + ], |
|
| 109 | + ]); |
|
| 110 | + $router->get(AdminConfigPage::class, '/config', AdminConfigPage::class); |
|
| 111 | + |
|
| 112 | + $router->attach('', '/tasks', static function (Map $router): void { |
|
| 113 | + |
|
| 114 | + $router->get(TasksList::class, '', TasksList::class); |
|
| 115 | + $router->get(TaskEditPage::class, '/{task}', TaskEditPage::class); |
|
| 116 | + $router->post(TaskEditAction::class, '/{task}', TaskEditAction::class); |
|
| 117 | + $router->get(TaskStatusAction::class, '/{task}/status/{enable}', TaskStatusAction::class); |
|
| 118 | + }); |
|
| 119 | + }); |
|
| 120 | + |
|
| 121 | + $router->get(TaskTrigger::class, '/trigger{/task}', TaskTrigger::class) |
|
| 122 | + ->allows(RequestMethodInterface::METHOD_POST); |
|
| 123 | + |
|
| 124 | + $router->post(TokenGenerate::class, '/token', TokenGenerate::class) |
|
| 125 | + ->extras(['middleware' => [AuthAdministrator::class]]); |
|
| 126 | + }); |
|
| 127 | + }); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * {@inheritDoc} |
|
| 132 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleLatestVersion() |
|
| 133 | + */ |
|
| 134 | + public function customModuleVersion(): string |
|
| 135 | + { |
|
| 136 | + return '2.0.11-v.2'; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * {@inheritDoc} |
|
| 141 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
| 142 | + */ |
|
| 143 | + public function getConfigLink(): string |
|
| 144 | + { |
|
| 145 | + return route(AdminConfigPage::class); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * {@inheritDoc} |
|
| 150 | + * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent() |
|
| 151 | + */ |
|
| 152 | + public function bodyContent(): string |
|
| 153 | + { |
|
| 154 | + return view($this->name() . '::snippet', [ 'url' => route(TaskTrigger::class) ]); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * {@inheritDoc} |
|
| 159 | + * @see \MyArtJaub\Webtrees\Module\AdminTasks\Contracts\ModuleTasksProviderInterface::listTasks() |
|
| 160 | + */ |
|
| 161 | + public function listTasks(): array |
|
| 162 | + { |
|
| 163 | + return [ |
|
| 164 | + 'maj-healthcheck' => HealthCheckEmailTask::class |
|
| 165 | + ]; |
|
| 166 | + } |
|
| 167 | 167 | } |
@@ -24,100 +24,100 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | class GenericPlaceMapperConfig implements PlaceMapperConfigInterface |
| 26 | 26 | { |
| 27 | - private array $config = []; |
|
| 27 | + private array $config = []; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Get the generic mapper's config |
|
| 31 | - * |
|
| 32 | - * @return array |
|
| 33 | - */ |
|
| 34 | - public function config(): array |
|
| 35 | - { |
|
| 36 | - return $this->config; |
|
| 37 | - } |
|
| 29 | + /** |
|
| 30 | + * Get the generic mapper's config |
|
| 31 | + * |
|
| 32 | + * @return array |
|
| 33 | + */ |
|
| 34 | + public function config(): array |
|
| 35 | + { |
|
| 36 | + return $this->config; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Set the generic mapper's config |
|
| 41 | - * |
|
| 42 | - * @param array $config |
|
| 43 | - * @return self |
|
| 44 | - */ |
|
| 45 | - public function setConfig(array $config): self |
|
| 46 | - { |
|
| 47 | - $this->config = $config; |
|
| 48 | - return $this; |
|
| 49 | - } |
|
| 39 | + /** |
|
| 40 | + * Set the generic mapper's config |
|
| 41 | + * |
|
| 42 | + * @param array $config |
|
| 43 | + * @return self |
|
| 44 | + */ |
|
| 45 | + public function setConfig(array $config): self |
|
| 46 | + { |
|
| 47 | + $this->config = $config; |
|
| 48 | + return $this; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * {@inheritDoc} |
|
| 53 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 54 | - */ |
|
| 55 | - public function get(string $key, $default = null) |
|
| 56 | - { |
|
| 57 | - return $this->config[$key] ?? $default; |
|
| 58 | - } |
|
| 51 | + /** |
|
| 52 | + * {@inheritDoc} |
|
| 53 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 54 | + */ |
|
| 55 | + public function get(string $key, $default = null) |
|
| 56 | + { |
|
| 57 | + return $this->config[$key] ?? $default; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * {@inheritDoc} |
|
| 62 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 63 | - */ |
|
| 64 | - public function has(string $key): bool |
|
| 65 | - { |
|
| 66 | - return key_exists($key, $this->config); |
|
| 67 | - } |
|
| 60 | + /** |
|
| 61 | + * {@inheritDoc} |
|
| 62 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 63 | + */ |
|
| 64 | + public function has(string $key): bool |
|
| 65 | + { |
|
| 66 | + return key_exists($key, $this->config); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * {@inheritDoc} |
|
| 71 | - * @see \JsonSerializable::jsonSerialize() |
|
| 72 | - */ |
|
| 73 | - public function jsonSerialize() |
|
| 74 | - { |
|
| 75 | - return [ |
|
| 76 | - 'class' => get_class($this), |
|
| 77 | - 'config' => $this->jsonSerializeConfig() |
|
| 78 | - ]; |
|
| 79 | - } |
|
| 69 | + /** |
|
| 70 | + * {@inheritDoc} |
|
| 71 | + * @see \JsonSerializable::jsonSerialize() |
|
| 72 | + */ |
|
| 73 | + public function jsonSerialize() |
|
| 74 | + { |
|
| 75 | + return [ |
|
| 76 | + 'class' => get_class($this), |
|
| 77 | + 'config' => $this->jsonSerializeConfig() |
|
| 78 | + ]; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Returns a representation of the mapper config compatible with Json serialisation |
|
| 83 | - * |
|
| 84 | - * @return mixed |
|
| 85 | - */ |
|
| 86 | - public function jsonSerializeConfig() |
|
| 87 | - { |
|
| 88 | - return $this->config; |
|
| 89 | - } |
|
| 81 | + /** |
|
| 82 | + * Returns a representation of the mapper config compatible with Json serialisation |
|
| 83 | + * |
|
| 84 | + * @return mixed |
|
| 85 | + */ |
|
| 86 | + public function jsonSerializeConfig() |
|
| 87 | + { |
|
| 88 | + return $this->config; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * {@inheritDoc} |
|
| 93 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 94 | - */ |
|
| 95 | - public function jsonDeserialize($config): self |
|
| 96 | - { |
|
| 97 | - if(is_string($config)) { |
|
| 98 | - return $this->jsonDeserialize(json_decode($config)); |
|
| 99 | - } |
|
| 100 | - if(is_array($config)) { |
|
| 101 | - return $this->setConfig($config); |
|
| 102 | - } |
|
| 103 | - return $this; |
|
| 104 | - } |
|
| 91 | + /** |
|
| 92 | + * {@inheritDoc} |
|
| 93 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 94 | + */ |
|
| 95 | + public function jsonDeserialize($config): self |
|
| 96 | + { |
|
| 97 | + if(is_string($config)) { |
|
| 98 | + return $this->jsonDeserialize(json_decode($config)); |
|
| 99 | + } |
|
| 100 | + if(is_array($config)) { |
|
| 101 | + return $this->setConfig($config); |
|
| 102 | + } |
|
| 103 | + return $this; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * {@inheritDoc} |
|
| 108 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
| 109 | - */ |
|
| 110 | - public function configContent(ModuleInterface $module, Tree $tree): string |
|
| 111 | - { |
|
| 112 | - return ''; |
|
| 113 | - } |
|
| 106 | + /** |
|
| 107 | + * {@inheritDoc} |
|
| 108 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
| 109 | + */ |
|
| 110 | + public function configContent(ModuleInterface $module, Tree $tree): string |
|
| 111 | + { |
|
| 112 | + return ''; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * {@inheritDoc} |
|
| 117 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
| 118 | - */ |
|
| 119 | - public function withConfigUpdate(ServerRequestInterface $request): self |
|
| 120 | - { |
|
| 121 | - return $this; |
|
| 122 | - } |
|
| 115 | + /** |
|
| 116 | + * {@inheritDoc} |
|
| 117 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
| 118 | + */ |
|
| 119 | + public function withConfigUpdate(ServerRequestInterface $request): self |
|
| 120 | + { |
|
| 121 | + return $this; |
|
| 122 | + } |
|
| 123 | 123 | } |
| 124 | 124 | \ No newline at end of file |
@@ -22,90 +22,90 @@ |
||
| 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 | - /** |
|
| 28 | - * Constructor for MapColorsConfig |
|
| 29 | - * |
|
| 30 | - * @param Color $default |
|
| 31 | - * @param Color $stroke |
|
| 32 | - * @param Color $max_value |
|
| 33 | - * @param Color $hover |
|
| 34 | - */ |
|
| 35 | - public function __construct( |
|
| 36 | - Color $default, |
|
| 37 | - Color $stroke, |
|
| 38 | - Color $max_value, |
|
| 39 | - Color $hover |
|
| 40 | - ) { |
|
| 41 | - $this->default = $default; |
|
| 42 | - $this->stroke = $stroke; |
|
| 43 | - $this->max_value = $max_value; |
|
| 44 | - $this->hover = $hover; |
|
| 45 | - } |
|
| 27 | + /** |
|
| 28 | + * Constructor for MapColorsConfig |
|
| 29 | + * |
|
| 30 | + * @param Color $default |
|
| 31 | + * @param Color $stroke |
|
| 32 | + * @param Color $max_value |
|
| 33 | + * @param Color $hover |
|
| 34 | + */ |
|
| 35 | + public function __construct( |
|
| 36 | + Color $default, |
|
| 37 | + Color $stroke, |
|
| 38 | + Color $max_value, |
|
| 39 | + Color $hover |
|
| 40 | + ) { |
|
| 41 | + $this->default = $default; |
|
| 42 | + $this->stroke = $stroke; |
|
| 43 | + $this->max_value = $max_value; |
|
| 44 | + $this->hover = $hover; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Get the default color for the features |
|
| 49 | - * |
|
| 50 | - * @return Color |
|
| 51 | - */ |
|
| 52 | - public function defaultColor(): Color |
|
| 53 | - { |
|
| 54 | - return $this->default; |
|
| 55 | - } |
|
| 47 | + /** |
|
| 48 | + * Get the default color for the features |
|
| 49 | + * |
|
| 50 | + * @return Color |
|
| 51 | + */ |
|
| 52 | + public function defaultColor(): Color |
|
| 53 | + { |
|
| 54 | + return $this->default; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Get the color for the features' strokes |
|
| 59 | - * |
|
| 60 | - * @return Color |
|
| 61 | - */ |
|
| 62 | - public function strokeColor(): Color |
|
| 63 | - { |
|
| 64 | - return $this->stroke; |
|
| 65 | - } |
|
| 57 | + /** |
|
| 58 | + * Get the color for the features' strokes |
|
| 59 | + * |
|
| 60 | + * @return Color |
|
| 61 | + */ |
|
| 62 | + public function strokeColor(): Color |
|
| 63 | + { |
|
| 64 | + return $this->stroke; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Get the color for the features with the lowest count |
|
| 69 | - * |
|
| 70 | - * @return Color |
|
| 71 | - */ |
|
| 72 | - public function minValueColor(): Color |
|
| 73 | - { |
|
| 74 | - return new Rgb(255, 255, 255); |
|
| 75 | - } |
|
| 67 | + /** |
|
| 68 | + * Get the color for the features with the lowest count |
|
| 69 | + * |
|
| 70 | + * @return Color |
|
| 71 | + */ |
|
| 72 | + public function minValueColor(): Color |
|
| 73 | + { |
|
| 74 | + return new Rgb(255, 255, 255); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Get the color for the features with the highest count |
|
| 79 | - * |
|
| 80 | - * @return Color |
|
| 81 | - */ |
|
| 82 | - public function maxValueColor(): Color |
|
| 83 | - { |
|
| 84 | - return $this->max_value; |
|
| 85 | - } |
|
| 77 | + /** |
|
| 78 | + * Get the color for the features with the highest count |
|
| 79 | + * |
|
| 80 | + * @return Color |
|
| 81 | + */ |
|
| 82 | + public function maxValueColor(): Color |
|
| 83 | + { |
|
| 84 | + return $this->max_value; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Get the color for feature hovering |
|
| 89 | - * |
|
| 90 | - * @return Color |
|
| 91 | - */ |
|
| 92 | - public function hoverColor(): Color |
|
| 93 | - { |
|
| 94 | - return $this->hover; |
|
| 95 | - } |
|
| 87 | + /** |
|
| 88 | + * Get the color for feature hovering |
|
| 89 | + * |
|
| 90 | + * @return Color |
|
| 91 | + */ |
|
| 92 | + public function hoverColor(): Color |
|
| 93 | + { |
|
| 94 | + return $this->hover; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * {@inheritDoc} |
|
| 99 | - * @see JsonSerializable::jsonSerialize() |
|
| 100 | - */ |
|
| 101 | - public function jsonSerialize() |
|
| 102 | - { |
|
| 103 | - return [ |
|
| 104 | - 'default' => (string) $this->defaultColor()->toHex(), |
|
| 105 | - 'stroke' => (string) $this->strokeColor()->toHex(), |
|
| 106 | - 'maxvalue' => (string) $this->maxValueColor()->toHex(), |
|
| 107 | - 'hover' => (string) $this->hoverColor()->toHex(), |
|
| 108 | - ]; |
|
| 109 | - } |
|
| 97 | + /** |
|
| 98 | + * {@inheritDoc} |
|
| 99 | + * @see JsonSerializable::jsonSerialize() |
|
| 100 | + */ |
|
| 101 | + public function jsonSerialize() |
|
| 102 | + { |
|
| 103 | + return [ |
|
| 104 | + 'default' => (string) $this->defaultColor()->toHex(), |
|
| 105 | + 'stroke' => (string) $this->strokeColor()->toHex(), |
|
| 106 | + 'maxvalue' => (string) $this->maxValueColor()->toHex(), |
|
| 107 | + 'hover' => (string) $this->hoverColor()->toHex(), |
|
| 108 | + ]; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | 111 | } |
| 112 | 112 | \ No newline at end of file |
@@ -25,59 +25,59 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class NullPlaceMapperConfig implements PlaceMapperConfigInterface |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * {@inheritDoc} |
|
| 30 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 31 | - */ |
|
| 32 | - public function get(string $key, $default = null) |
|
| 33 | - { |
|
| 34 | - return $default; |
|
| 35 | - } |
|
| 28 | + /** |
|
| 29 | + * {@inheritDoc} |
|
| 30 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::get() |
|
| 31 | + */ |
|
| 32 | + public function get(string $key, $default = null) |
|
| 33 | + { |
|
| 34 | + return $default; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * {@inheritDoc} |
|
| 39 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 40 | - */ |
|
| 41 | - public function has(string $key): bool |
|
| 42 | - { |
|
| 43 | - return false; |
|
| 44 | - } |
|
| 37 | + /** |
|
| 38 | + * {@inheritDoc} |
|
| 39 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::has() |
|
| 40 | + */ |
|
| 41 | + public function has(string $key): bool |
|
| 42 | + { |
|
| 43 | + return false; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * {@inheritDoc} |
|
| 48 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 49 | - */ |
|
| 50 | - public function jsonDeserialize($config): self |
|
| 51 | - { |
|
| 52 | - return $this; |
|
| 53 | - } |
|
| 46 | + /** |
|
| 47 | + * {@inheritDoc} |
|
| 48 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 49 | + */ |
|
| 50 | + public function jsonDeserialize($config): self |
|
| 51 | + { |
|
| 52 | + return $this; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * {@inheritDoc} |
|
| 57 | - * @see JsonSerializable::jsonSerialize() |
|
| 58 | - */ |
|
| 59 | - public function jsonSerialize() |
|
| 60 | - { |
|
| 61 | - return []; |
|
| 62 | - } |
|
| 55 | + /** |
|
| 56 | + * {@inheritDoc} |
|
| 57 | + * @see JsonSerializable::jsonSerialize() |
|
| 58 | + */ |
|
| 59 | + public function jsonSerialize() |
|
| 60 | + { |
|
| 61 | + return []; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * {@inheritDoc} |
|
| 66 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
| 67 | - */ |
|
| 68 | - public function configContent(ModuleInterface $module, Tree $tree): string |
|
| 69 | - { |
|
| 70 | - return ''; |
|
| 71 | - } |
|
| 64 | + /** |
|
| 65 | + * {@inheritDoc} |
|
| 66 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
| 67 | + */ |
|
| 68 | + public function configContent(ModuleInterface $module, Tree $tree): string |
|
| 69 | + { |
|
| 70 | + return ''; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * {@inheritDoc} |
|
| 75 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
| 76 | - */ |
|
| 77 | - public function withConfigUpdate(ServerRequestInterface $request): self |
|
| 78 | - { |
|
| 79 | - return $this; |
|
| 80 | - } |
|
| 73 | + /** |
|
| 74 | + * {@inheritDoc} |
|
| 75 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
| 76 | + */ |
|
| 77 | + public function withConfigUpdate(ServerRequestInterface $request): self |
|
| 78 | + { |
|
| 79 | + return $this; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |
@@ -22,51 +22,51 @@ |
||
| 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 | - public function mapMappingProperty(): string |
|
| 47 | - { |
|
| 48 | - return $this->map_mapping_property; |
|
| 49 | - } |
|
| 42 | + /** |
|
| 43 | + * {@inheritDoc} |
|
| 44 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapMappingProperty() |
|
| 45 | + */ |
|
| 46 | + public 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 | - public function mapperConfig(): PlaceMapperConfigInterface |
|
| 56 | - { |
|
| 57 | - return $this->mapper_config; |
|
| 58 | - } |
|
| 51 | + /** |
|
| 52 | + * {@inheritDoc} |
|
| 53 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapperConfig() |
|
| 54 | + */ |
|
| 55 | + public function mapperConfig(): PlaceMapperConfigInterface |
|
| 56 | + { |
|
| 57 | + return $this->mapper_config; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * {@inheritDoc} |
|
| 62 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::with() |
|
| 63 | - */ |
|
| 64 | - public function with(string $mapping_property, PlaceMapperConfigInterface $mapper_config): self |
|
| 65 | - { |
|
| 66 | - $new = clone $this; |
|
| 67 | - $new->map_mapping_property = $mapping_property; |
|
| 68 | - $new->mapper_config = $mapper_config; |
|
| 69 | - return $new; |
|
| 70 | - } |
|
| 60 | + /** |
|
| 61 | + * {@inheritDoc} |
|
| 62 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::with() |
|
| 63 | + */ |
|
| 64 | + public function with(string $mapping_property, PlaceMapperConfigInterface $mapper_config): self |
|
| 65 | + { |
|
| 66 | + $new = clone $this; |
|
| 67 | + $new->map_mapping_property = $mapping_property; |
|
| 68 | + $new->mapper_config = $mapper_config; |
|
| 69 | + return $new; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | \ No newline at end of file |