@@ -25,105 +25,105 @@ |
||
| 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 | - public function jsonSerialize() |
|
| 76 | - { |
|
| 77 | - return [ |
|
| 78 | - 'class' => get_class($this), |
|
| 79 | - 'config' => $this->jsonSerializeConfig() |
|
| 80 | - ]; |
|
| 81 | - } |
|
| 71 | + /** |
|
| 72 | + * {@inheritDoc} |
|
| 73 | + * @see \JsonSerializable::jsonSerialize() |
|
| 74 | + */ |
|
| 75 | + public function jsonSerialize() |
|
| 76 | + { |
|
| 77 | + return [ |
|
| 78 | + 'class' => get_class($this), |
|
| 79 | + 'config' => $this->jsonSerializeConfig() |
|
| 80 | + ]; |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Returns a representation of the mapper config compatible with Json serialisation |
|
| 85 | - * |
|
| 86 | - * @return mixed |
|
| 87 | - */ |
|
| 88 | - public function jsonSerializeConfig() |
|
| 89 | - { |
|
| 90 | - return $this->config; |
|
| 91 | - } |
|
| 83 | + /** |
|
| 84 | + * Returns a representation of the mapper config compatible with Json serialisation |
|
| 85 | + * |
|
| 86 | + * @return mixed |
|
| 87 | + */ |
|
| 88 | + public function jsonSerializeConfig() |
|
| 89 | + { |
|
| 90 | + return $this->config; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * {@inheritDoc} |
|
| 95 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 96 | - * |
|
| 97 | - * @param mixed $config |
|
| 98 | - * @return $this |
|
| 99 | - */ |
|
| 100 | - public function jsonDeserialize($config): self |
|
| 101 | - { |
|
| 102 | - if (is_string($config)) { |
|
| 103 | - return $this->jsonDeserialize((array) json_decode($config)); |
|
| 104 | - } |
|
| 105 | - if (is_array($config)) { |
|
| 106 | - return $this->setConfig($config); |
|
| 107 | - } |
|
| 108 | - return $this; |
|
| 109 | - } |
|
| 93 | + /** |
|
| 94 | + * {@inheritDoc} |
|
| 95 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::jsonDeserialize() |
|
| 96 | + * |
|
| 97 | + * @param mixed $config |
|
| 98 | + * @return $this |
|
| 99 | + */ |
|
| 100 | + public function jsonDeserialize($config): self |
|
| 101 | + { |
|
| 102 | + if (is_string($config)) { |
|
| 103 | + return $this->jsonDeserialize((array) json_decode($config)); |
|
| 104 | + } |
|
| 105 | + if (is_array($config)) { |
|
| 106 | + return $this->setConfig($config); |
|
| 107 | + } |
|
| 108 | + return $this; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * {@inheritDoc} |
|
| 113 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
| 114 | - */ |
|
| 115 | - public function configContent(ModuleInterface $module, Tree $tree): string |
|
| 116 | - { |
|
| 117 | - return ''; |
|
| 118 | - } |
|
| 111 | + /** |
|
| 112 | + * {@inheritDoc} |
|
| 113 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::configContent() |
|
| 114 | + */ |
|
| 115 | + public function configContent(ModuleInterface $module, Tree $tree): string |
|
| 116 | + { |
|
| 117 | + return ''; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * {@inheritDoc} |
|
| 122 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
| 123 | - * @return $this |
|
| 124 | - */ |
|
| 125 | - public function withConfigUpdate(ServerRequestInterface $request): self |
|
| 126 | - { |
|
| 127 | - return $this; |
|
| 128 | - } |
|
| 120 | + /** |
|
| 121 | + * {@inheritDoc} |
|
| 122 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface::withConfigUpdate() |
|
| 123 | + * @return $this |
|
| 124 | + */ |
|
| 125 | + public function withConfigUpdate(ServerRequestInterface $request): self |
|
| 126 | + { |
|
| 127 | + return $this; |
|
| 128 | + } |
|
| 129 | 129 | } |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | public function jsonDeserialize($config): self |
| 101 | 101 | { |
| 102 | 102 | if (is_string($config)) { |
| 103 | - return $this->jsonDeserialize((array) json_decode($config)); |
|
| 103 | + return $this->jsonDeserialize((array)json_decode($config)); |
|
| 104 | 104 | } |
| 105 | 105 | if (is_array($config)) { |
| 106 | 106 | return $this->setConfig($config); |
@@ -27,77 +27,77 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | abstract class AbstractHookCollector implements HookCollectorInterface, HookInterface |
| 29 | 29 | { |
| 30 | - /** @var Collection<int, array<THook>> $hooks */ |
|
| 31 | - protected Collection $hooks; |
|
| 30 | + /** @var Collection<int, array<THook>> $hooks */ |
|
| 31 | + protected Collection $hooks; |
|
| 32 | 32 | |
| 33 | - private ModuleInterface $module; |
|
| 33 | + private ModuleInterface $module; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Constructor for AbstractHookCollector |
|
| 37 | - * |
|
| 38 | - * @param ModuleInterface $module |
|
| 39 | - */ |
|
| 40 | - public function __construct(ModuleInterface $module) |
|
| 41 | - { |
|
| 42 | - $this->hooks = new Collection(); |
|
| 43 | - $this->module = $module; |
|
| 44 | - } |
|
| 35 | + /** |
|
| 36 | + * Constructor for AbstractHookCollector |
|
| 37 | + * |
|
| 38 | + * @param ModuleInterface $module |
|
| 39 | + */ |
|
| 40 | + public function __construct(ModuleInterface $module) |
|
| 41 | + { |
|
| 42 | + $this->hooks = new Collection(); |
|
| 43 | + $this->module = $module; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * {@inheritDoc} |
|
| 48 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
| 49 | - */ |
|
| 50 | - public function module(): ModuleInterface |
|
| 51 | - { |
|
| 52 | - return $this->module; |
|
| 53 | - } |
|
| 46 | + /** |
|
| 47 | + * {@inheritDoc} |
|
| 48 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
| 49 | + */ |
|
| 50 | + public function module(): ModuleInterface |
|
| 51 | + { |
|
| 52 | + return $this->module; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * {@inheritDoc} |
|
| 57 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::name() |
|
| 58 | - */ |
|
| 59 | - public function name(): string |
|
| 60 | - { |
|
| 61 | - return $this->module->name() . '-' . |
|
| 62 | - mb_substr(str_replace('collector', '', mb_strtolower((new ReflectionClass($this))->getShortName())), 0, 64); |
|
| 63 | - } |
|
| 55 | + /** |
|
| 56 | + * {@inheritDoc} |
|
| 57 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::name() |
|
| 58 | + */ |
|
| 59 | + public function name(): string |
|
| 60 | + { |
|
| 61 | + return $this->module->name() . '-' . |
|
| 62 | + mb_substr(str_replace('collector', '', mb_strtolower((new ReflectionClass($this))->getShortName())), 0, 64); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * {@inheritDoc} |
|
| 67 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::title() |
|
| 68 | - */ |
|
| 69 | - abstract public function title(): string; |
|
| 65 | + /** |
|
| 66 | + * {@inheritDoc} |
|
| 67 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::title() |
|
| 68 | + */ |
|
| 69 | + abstract public function title(): string; |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * {@inheritDoc} |
|
| 73 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::description() |
|
| 74 | - */ |
|
| 75 | - abstract public function description(): string; |
|
| 71 | + /** |
|
| 72 | + * {@inheritDoc} |
|
| 73 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::description() |
|
| 74 | + */ |
|
| 75 | + abstract public function description(): string; |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * {@inheritDoc} |
|
| 79 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::hookInterface() |
|
| 80 | - */ |
|
| 81 | - abstract public function hookInterface(): string; |
|
| 77 | + /** |
|
| 78 | + * {@inheritDoc} |
|
| 79 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::hookInterface() |
|
| 80 | + */ |
|
| 81 | + abstract public function hookInterface(): string; |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * {@inheritDoc} |
|
| 85 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::register() |
|
| 86 | - */ |
|
| 87 | - public function register(HookInterface $hook_instance, int $order): void |
|
| 88 | - { |
|
| 89 | - $this->hooks->put($order, $this->hooks->get($order, []) + [$hook_instance]); |
|
| 90 | - } |
|
| 83 | + /** |
|
| 84 | + * {@inheritDoc} |
|
| 85 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::register() |
|
| 86 | + */ |
|
| 87 | + public function register(HookInterface $hook_instance, int $order): void |
|
| 88 | + { |
|
| 89 | + $this->hooks->put($order, $this->hooks->get($order, []) + [$hook_instance]); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * {@inheritDoc} |
|
| 94 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::hooks() |
|
| 95 | - * |
|
| 96 | - * @return Collection<THook> |
|
| 97 | - */ |
|
| 98 | - public function hooks(): Collection |
|
| 99 | - { |
|
| 100 | - /** @var Collection<THook> */ |
|
| 101 | - return $this->hooks->sortKeys()->flatten(); |
|
| 102 | - } |
|
| 92 | + /** |
|
| 93 | + * {@inheritDoc} |
|
| 94 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookCollectorInterface::hooks() |
|
| 95 | + * |
|
| 96 | + * @return Collection<THook> |
|
| 97 | + */ |
|
| 98 | + public function hooks(): Collection |
|
| 99 | + { |
|
| 100 | + /** @var Collection<THook> */ |
|
| 101 | + return $this->hooks->sortKeys()->flatten(); |
|
| 102 | + } |
|
| 103 | 103 | } |