@@ -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 | } |
@@ -105,10 +105,10 @@ |
||
105 | 105 | public function jsonSerialize() |
106 | 106 | { |
107 | 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(), |
|
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 | 112 | ]; |
113 | 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 | } |
@@ -23,51 +23,51 @@ |
||
23 | 23 | */ |
24 | 24 | class MapViewConfig implements MapViewConfigInterface |
25 | 25 | { |
26 | - private string $map_mapping_property; |
|
27 | - private PlaceMapperConfigInterface $mapper_config; |
|
26 | + private string $map_mapping_property; |
|
27 | + private PlaceMapperConfigInterface $mapper_config; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Constructor for MapViewConfig |
|
31 | - * |
|
32 | - * @param string $map_mapping_property |
|
33 | - * @param PlaceMapperConfigInterface $mapper_config |
|
34 | - */ |
|
35 | - public function __construct( |
|
36 | - string $map_mapping_property, |
|
37 | - PlaceMapperConfigInterface $mapper_config = null |
|
38 | - ) { |
|
39 | - $this->map_mapping_property = $map_mapping_property; |
|
40 | - $this->mapper_config = $mapper_config ?? new NullPlaceMapperConfig(); |
|
41 | - } |
|
29 | + /** |
|
30 | + * Constructor for MapViewConfig |
|
31 | + * |
|
32 | + * @param string $map_mapping_property |
|
33 | + * @param PlaceMapperConfigInterface $mapper_config |
|
34 | + */ |
|
35 | + public function __construct( |
|
36 | + string $map_mapping_property, |
|
37 | + PlaceMapperConfigInterface $mapper_config = null |
|
38 | + ) { |
|
39 | + $this->map_mapping_property = $map_mapping_property; |
|
40 | + $this->mapper_config = $mapper_config ?? new NullPlaceMapperConfig(); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * {@inheritDoc} |
|
45 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapMappingProperty() |
|
46 | - */ |
|
47 | - public function mapMappingProperty(): string |
|
48 | - { |
|
49 | - return $this->map_mapping_property; |
|
50 | - } |
|
43 | + /** |
|
44 | + * {@inheritDoc} |
|
45 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapMappingProperty() |
|
46 | + */ |
|
47 | + public function mapMappingProperty(): string |
|
48 | + { |
|
49 | + return $this->map_mapping_property; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * {@inheritDoc} |
|
54 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapperConfig() |
|
55 | - */ |
|
56 | - public function mapperConfig(): PlaceMapperConfigInterface |
|
57 | - { |
|
58 | - return $this->mapper_config; |
|
59 | - } |
|
52 | + /** |
|
53 | + * {@inheritDoc} |
|
54 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapperConfig() |
|
55 | + */ |
|
56 | + public function mapperConfig(): PlaceMapperConfigInterface |
|
57 | + { |
|
58 | + return $this->mapper_config; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * {@inheritDoc} |
|
63 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::with() |
|
64 | - * @return static |
|
65 | - */ |
|
66 | - public function with(string $mapping_property, PlaceMapperConfigInterface $mapper_config): self |
|
67 | - { |
|
68 | - $new = clone $this; |
|
69 | - $new->map_mapping_property = $mapping_property; |
|
70 | - $new->mapper_config = $mapper_config; |
|
71 | - return $new; |
|
72 | - } |
|
61 | + /** |
|
62 | + * {@inheritDoc} |
|
63 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::with() |
|
64 | + * @return static |
|
65 | + */ |
|
66 | + public function with(string $mapping_property, PlaceMapperConfigInterface $mapper_config): self |
|
67 | + { |
|
68 | + $new = clone $this; |
|
69 | + $new->map_mapping_property = $mapping_property; |
|
70 | + $new->mapper_config = $mapper_config; |
|
71 | + return $new; |
|
72 | + } |
|
73 | 73 | } |
@@ -32,129 +32,129 @@ |
||
32 | 32 | */ |
33 | 33 | class CertificateFilesystemService |
34 | 34 | { |
35 | - /** |
|
36 | - * @var array<int,FilesystemOperator> $filesystem |
|
37 | - */ |
|
38 | - private array $filesystem = []; |
|
35 | + /** |
|
36 | + * @var array<int,FilesystemOperator> $filesystem |
|
37 | + */ |
|
38 | + private array $filesystem = []; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Get the filesystem containing certificates for a tree. |
|
42 | - * |
|
43 | - * @param Tree $tree |
|
44 | - * @return FilesystemOperator |
|
45 | - */ |
|
46 | - public function filesystem(Tree $tree): FilesystemOperator |
|
47 | - { |
|
48 | - if (!isset($this->filesystem[$tree->id()])) { |
|
49 | - $cert_dir = $tree->getPreference('MAJ_CERTIF_ROOTDIR', 'certificates/'); |
|
50 | - $adapter = new ChrootAdapter(Registry::filesystem()->data(), $cert_dir); |
|
40 | + /** |
|
41 | + * Get the filesystem containing certificates for a tree. |
|
42 | + * |
|
43 | + * @param Tree $tree |
|
44 | + * @return FilesystemOperator |
|
45 | + */ |
|
46 | + public function filesystem(Tree $tree): FilesystemOperator |
|
47 | + { |
|
48 | + if (!isset($this->filesystem[$tree->id()])) { |
|
49 | + $cert_dir = $tree->getPreference('MAJ_CERTIF_ROOTDIR', 'certificates/'); |
|
50 | + $adapter = new ChrootAdapter(Registry::filesystem()->data(), $cert_dir); |
|
51 | 51 | |
52 | - $this->filesystem[$tree->id()] = new FileSystem($adapter); |
|
53 | - } |
|
54 | - return $this->filesystem[$tree->id()]; |
|
55 | - } |
|
52 | + $this->filesystem[$tree->id()] = new FileSystem($adapter); |
|
53 | + } |
|
54 | + return $this->filesystem[$tree->id()]; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Set the filesystem containing certificates for a tree. |
|
59 | - * |
|
60 | - * @param Tree $tree |
|
61 | - * @param FilesystemOperator $filesystem |
|
62 | - */ |
|
63 | - public function setFilesystem(Tree $tree, FilesystemOperator $filesystem): void |
|
64 | - { |
|
65 | - $this->filesystem[$tree->id()] = $filesystem; |
|
66 | - } |
|
57 | + /** |
|
58 | + * Set the filesystem containing certificates for a tree. |
|
59 | + * |
|
60 | + * @param Tree $tree |
|
61 | + * @param FilesystemOperator $filesystem |
|
62 | + */ |
|
63 | + public function setFilesystem(Tree $tree, FilesystemOperator $filesystem): void |
|
64 | + { |
|
65 | + $this->filesystem[$tree->id()] = $filesystem; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Create the Certificate object defined by a path on the filesystem. |
|
70 | - * |
|
71 | - * @param Tree $tree |
|
72 | - * @param string $path |
|
73 | - * @return Certificate|NULL |
|
74 | - */ |
|
75 | - public function certificate(Tree $tree, string $path): ?Certificate |
|
76 | - { |
|
77 | - $filesystem = $this->filesystem($tree); |
|
78 | - if ($filesystem->fileExists($path) && $this->isFileSupported($filesystem, $path)) { |
|
79 | - return new Certificate($tree, $path); |
|
80 | - } |
|
81 | - return null; |
|
82 | - } |
|
68 | + /** |
|
69 | + * Create the Certificate object defined by a path on the filesystem. |
|
70 | + * |
|
71 | + * @param Tree $tree |
|
72 | + * @param string $path |
|
73 | + * @return Certificate|NULL |
|
74 | + */ |
|
75 | + public function certificate(Tree $tree, string $path): ?Certificate |
|
76 | + { |
|
77 | + $filesystem = $this->filesystem($tree); |
|
78 | + if ($filesystem->fileExists($path) && $this->isFileSupported($filesystem, $path)) { |
|
79 | + return new Certificate($tree, $path); |
|
80 | + } |
|
81 | + return null; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Get the cities (first-level folder) available in a the filesystem. |
|
86 | - * |
|
87 | - * @param Tree $tree |
|
88 | - * @return string[] |
|
89 | - */ |
|
90 | - public function cities(Tree $tree): array |
|
91 | - { |
|
92 | - $cities = $this->filesystem($tree) |
|
93 | - ->listContents('') |
|
94 | - ->filter(fn (StorageAttributes $attributes): bool => $attributes->isDir()) |
|
95 | - ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
|
96 | - ->toArray(); |
|
97 | - usort($cities, I18N::comparator()); |
|
98 | - return $cities; |
|
99 | - } |
|
84 | + /** |
|
85 | + * Get the cities (first-level folder) available in a the filesystem. |
|
86 | + * |
|
87 | + * @param Tree $tree |
|
88 | + * @return string[] |
|
89 | + */ |
|
90 | + public function cities(Tree $tree): array |
|
91 | + { |
|
92 | + $cities = $this->filesystem($tree) |
|
93 | + ->listContents('') |
|
94 | + ->filter(fn (StorageAttributes $attributes): bool => $attributes->isDir()) |
|
95 | + ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
|
96 | + ->toArray(); |
|
97 | + usort($cities, I18N::comparator()); |
|
98 | + return $cities; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Get the certificates available for a city (first-level folder). |
|
103 | - * |
|
104 | - * @param Tree $tree |
|
105 | - * @param string $city |
|
106 | - * @return Collection<Certificate> |
|
107 | - */ |
|
108 | - public function certificatesForCity(Tree $tree, string $city): Collection |
|
109 | - { |
|
110 | - $filesystem = $this->filesystem($tree); |
|
111 | - $certificates_paths = $filesystem->listContents($city) |
|
112 | - ->filter(fn (StorageAttributes $attributes): bool => |
|
113 | - $attributes->isFile() && $this->isFileSupported($filesystem, $attributes->path())) |
|
114 | - ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
|
115 | - ->toArray(); |
|
116 | - usort($certificates_paths, I18N::comparator()); |
|
117 | - return collect($certificates_paths)->map(fn (string $path): Certificate => new Certificate($tree, $path)); |
|
118 | - } |
|
101 | + /** |
|
102 | + * Get the certificates available for a city (first-level folder). |
|
103 | + * |
|
104 | + * @param Tree $tree |
|
105 | + * @param string $city |
|
106 | + * @return Collection<Certificate> |
|
107 | + */ |
|
108 | + public function certificatesForCity(Tree $tree, string $city): Collection |
|
109 | + { |
|
110 | + $filesystem = $this->filesystem($tree); |
|
111 | + $certificates_paths = $filesystem->listContents($city) |
|
112 | + ->filter(fn (StorageAttributes $attributes): bool => |
|
113 | + $attributes->isFile() && $this->isFileSupported($filesystem, $attributes->path())) |
|
114 | + ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
|
115 | + ->toArray(); |
|
116 | + usort($certificates_paths, I18N::comparator()); |
|
117 | + return collect($certificates_paths)->map(fn (string $path): Certificate => new Certificate($tree, $path)); |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Get the certificates available for a city (first-level folder), containing a specified text. |
|
122 | - * |
|
123 | - * @param Tree $tree |
|
124 | - * @param string $city |
|
125 | - * @param string $contains |
|
126 | - * @return Collection<Certificate> |
|
127 | - */ |
|
128 | - public function certificatesForCityContaining(Tree $tree, string $city, string $contains): Collection |
|
129 | - { |
|
130 | - $filesystem = $this->filesystem($tree); |
|
131 | - $certificates_paths = $filesystem->listContents($city) |
|
132 | - ->filter(fn (StorageAttributes $attributes): bool => |
|
133 | - $attributes->isFile() && $this->isFileSupported($filesystem, $attributes->path()) |
|
134 | - && mb_stripos($attributes->path(), $contains) !== false) |
|
135 | - ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
|
136 | - ->toArray(); |
|
137 | - usort($certificates_paths, I18N::comparator()); |
|
138 | - return collect($certificates_paths)->map(fn (string $path): Certificate => new Certificate($tree, $path)); |
|
139 | - } |
|
120 | + /** |
|
121 | + * Get the certificates available for a city (first-level folder), containing a specified text. |
|
122 | + * |
|
123 | + * @param Tree $tree |
|
124 | + * @param string $city |
|
125 | + * @param string $contains |
|
126 | + * @return Collection<Certificate> |
|
127 | + */ |
|
128 | + public function certificatesForCityContaining(Tree $tree, string $city, string $contains): Collection |
|
129 | + { |
|
130 | + $filesystem = $this->filesystem($tree); |
|
131 | + $certificates_paths = $filesystem->listContents($city) |
|
132 | + ->filter(fn (StorageAttributes $attributes): bool => |
|
133 | + $attributes->isFile() && $this->isFileSupported($filesystem, $attributes->path()) |
|
134 | + && mb_stripos($attributes->path(), $contains) !== false) |
|
135 | + ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
|
136 | + ->toArray(); |
|
137 | + usort($certificates_paths, I18N::comparator()); |
|
138 | + return collect($certificates_paths)->map(fn (string $path): Certificate => new Certificate($tree, $path)); |
|
139 | + } |
|
140 | 140 | |
141 | - /** |
|
142 | - * Check if a file on the filesystem is supported by the certificate module. |
|
143 | - * |
|
144 | - * @param FilesystemOperator $filesystem |
|
145 | - * @param string $path |
|
146 | - * @return bool |
|
147 | - */ |
|
148 | - protected function isFileSupported(FilesystemOperator $filesystem, string $path): bool |
|
149 | - { |
|
150 | - try { |
|
151 | - $mime = $filesystem->mimeType($path); |
|
152 | - return Registry::cache()->array()->remember( |
|
153 | - 'maj-certif-supportedfiles-' . $mime, |
|
154 | - fn (): bool => app(CertificateImageFactory::class)->isMimeTypeSupported($mime) |
|
155 | - ); |
|
156 | - } catch (UnableToRetrieveMetadata | FilesystemException $ex) { |
|
157 | - } |
|
158 | - return false; |
|
159 | - } |
|
141 | + /** |
|
142 | + * Check if a file on the filesystem is supported by the certificate module. |
|
143 | + * |
|
144 | + * @param FilesystemOperator $filesystem |
|
145 | + * @param string $path |
|
146 | + * @return bool |
|
147 | + */ |
|
148 | + protected function isFileSupported(FilesystemOperator $filesystem, string $path): bool |
|
149 | + { |
|
150 | + try { |
|
151 | + $mime = $filesystem->mimeType($path); |
|
152 | + return Registry::cache()->array()->remember( |
|
153 | + 'maj-certif-supportedfiles-' . $mime, |
|
154 | + fn (): bool => app(CertificateImageFactory::class)->isMimeTypeSupported($mime) |
|
155 | + ); |
|
156 | + } catch (UnableToRetrieveMetadata | FilesystemException $ex) { |
|
157 | + } |
|
158 | + return false; |
|
159 | + } |
|
160 | 160 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | if (!isset($this->filesystem[$tree->id()])) { |
49 | 49 | $cert_dir = $tree->getPreference('MAJ_CERTIF_ROOTDIR', 'certificates/'); |
50 | - $adapter = new ChrootAdapter(Registry::filesystem()->data(), $cert_dir); |
|
50 | + $adapter = new ChrootAdapter(Registry::filesystem()->data(), $cert_dir); |
|
51 | 51 | |
52 | 52 | $this->filesystem[$tree->id()] = new FileSystem($adapter); |
53 | 53 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function cities(Tree $tree): array |
91 | 91 | { |
92 | - $cities = $this->filesystem($tree) |
|
92 | + $cities = $this->filesystem($tree) |
|
93 | 93 | ->listContents('') |
94 | 94 | ->filter(fn (StorageAttributes $attributes): bool => $attributes->isDir()) |
95 | 95 | ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | try { |
151 | 151 | $mime = $filesystem->mimeType($path); |
152 | 152 | return Registry::cache()->array()->remember( |
153 | - 'maj-certif-supportedfiles-' . $mime, |
|
153 | + 'maj-certif-supportedfiles-'.$mime, |
|
154 | 154 | fn (): bool => app(CertificateImageFactory::class)->isMimeTypeSupported($mime) |
155 | 155 | ); |
156 | 156 | } catch (UnableToRetrieveMetadata | FilesystemException $ex) { |
@@ -21,19 +21,19 @@ |
||
21 | 21 | */ |
22 | 22 | interface ModuleMyArtJaubInterface extends ModuleCustomInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * Add module routes to webtrees route loader |
|
26 | - * |
|
27 | - * @param Map<\Aura\Router\Route> $router |
|
28 | - */ |
|
29 | - public function loadRoutes(Map $router): void; |
|
24 | + /** |
|
25 | + * Add module routes to webtrees route loader |
|
26 | + * |
|
27 | + * @param Map<\Aura\Router\Route> $router |
|
28 | + */ |
|
29 | + public function loadRoutes(Map $router): void; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Returns the URL of the module specific stylesheets. |
|
33 | - * It will look for a CSS file matching the theme name (e.g. xenea.min.css), |
|
34 | - * and fallback to default.min.css if none are found |
|
35 | - * |
|
36 | - * @return string |
|
37 | - */ |
|
38 | - public function moduleCssUrl(): string; |
|
31 | + /** |
|
32 | + * Returns the URL of the module specific stylesheets. |
|
33 | + * It will look for a CSS file matching the theme name (e.g. xenea.min.css), |
|
34 | + * and fallback to default.min.css if none are found |
|
35 | + * |
|
36 | + * @return string |
|
37 | + */ |
|
38 | + public function moduleCssUrl(): string; |
|
39 | 39 | } |
@@ -25,41 +25,41 @@ |
||
25 | 25 | */ |
26 | 26 | class GeoAnalysisService |
27 | 27 | { |
28 | - private ModuleService $module_service; |
|
28 | + private ModuleService $module_service; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Constructor for MapDefinitionsService |
|
32 | - * |
|
33 | - * @param ModuleService $module_service |
|
34 | - */ |
|
35 | - public function __construct(ModuleService $module_service) |
|
36 | - { |
|
37 | - $this->module_service = $module_service; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Constructor for MapDefinitionsService |
|
32 | + * |
|
33 | + * @param ModuleService $module_service |
|
34 | + */ |
|
35 | + public function __construct(ModuleService $module_service) |
|
36 | + { |
|
37 | + $this->module_service = $module_service; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Get all available geographical dispersion analyses. |
|
42 | - * |
|
43 | - * {@internal The list is generated based on the modules exposing ModuleGeoAnalysisProviderInterface |
|
44 | - * |
|
45 | - * @param bool $include_disabled |
|
46 | - * @return Collection<GeoAnalysisInterface> |
|
47 | - */ |
|
48 | - public function all(bool $include_disabled = false): Collection |
|
49 | - { |
|
50 | - /** @var Collection<GeoAnalysisInterface> $geoanalyses */ |
|
51 | - $geoanalyses = $this->module_service |
|
52 | - ->findByInterface(ModuleGeoAnalysisProviderInterface::class, $include_disabled) |
|
53 | - ->flatMap(fn(ModuleGeoAnalysisProviderInterface $module) => $module->listGeoAnalyses()) |
|
54 | - ->map(static function (string $analysis_class): ?GeoAnalysisInterface { |
|
55 | - try { |
|
56 | - $analysis = app($analysis_class); |
|
57 | - return $analysis instanceof GeoAnalysisInterface ? $analysis : null; |
|
58 | - } catch (BindingResolutionException $ex) { |
|
59 | - return null; |
|
60 | - } |
|
61 | - })->filter(); |
|
40 | + /** |
|
41 | + * Get all available geographical dispersion analyses. |
|
42 | + * |
|
43 | + * {@internal The list is generated based on the modules exposing ModuleGeoAnalysisProviderInterface |
|
44 | + * |
|
45 | + * @param bool $include_disabled |
|
46 | + * @return Collection<GeoAnalysisInterface> |
|
47 | + */ |
|
48 | + public function all(bool $include_disabled = false): Collection |
|
49 | + { |
|
50 | + /** @var Collection<GeoAnalysisInterface> $geoanalyses */ |
|
51 | + $geoanalyses = $this->module_service |
|
52 | + ->findByInterface(ModuleGeoAnalysisProviderInterface::class, $include_disabled) |
|
53 | + ->flatMap(fn(ModuleGeoAnalysisProviderInterface $module) => $module->listGeoAnalyses()) |
|
54 | + ->map(static function (string $analysis_class): ?GeoAnalysisInterface { |
|
55 | + try { |
|
56 | + $analysis = app($analysis_class); |
|
57 | + return $analysis instanceof GeoAnalysisInterface ? $analysis : null; |
|
58 | + } catch (BindingResolutionException $ex) { |
|
59 | + return null; |
|
60 | + } |
|
61 | + })->filter(); |
|
62 | 62 | |
63 | - return $geoanalyses; |
|
64 | - } |
|
63 | + return $geoanalyses; |
|
64 | + } |
|
65 | 65 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $geoanalyses = $this->module_service |
52 | 52 | ->findByInterface(ModuleGeoAnalysisProviderInterface::class, $include_disabled) |
53 | 53 | ->flatMap(fn(ModuleGeoAnalysisProviderInterface $module) => $module->listGeoAnalyses()) |
54 | - ->map(static function (string $analysis_class): ?GeoAnalysisInterface { |
|
54 | + ->map(static function(string $analysis_class): ?GeoAnalysisInterface { |
|
55 | 55 | try { |
56 | 56 | $analysis = app($analysis_class); |
57 | 57 | return $analysis instanceof GeoAnalysisInterface ? $analysis : null; |
@@ -25,41 +25,41 @@ |
||
25 | 25 | */ |
26 | 26 | class PlaceMapperService |
27 | 27 | { |
28 | - private ModuleService $module_service; |
|
28 | + private ModuleService $module_service; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Constructor for PlaceMapperService |
|
32 | - * |
|
33 | - * @param ModuleService $module_service |
|
34 | - */ |
|
35 | - public function __construct(ModuleService $module_service) |
|
36 | - { |
|
37 | - $this->module_service = $module_service; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Constructor for PlaceMapperService |
|
32 | + * |
|
33 | + * @param ModuleService $module_service |
|
34 | + */ |
|
35 | + public function __construct(ModuleService $module_service) |
|
36 | + { |
|
37 | + $this->module_service = $module_service; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Get all place mappers available. |
|
42 | - * |
|
43 | - * {@internal The list is generated based on the modules exposing ModulePlaceMapperProviderInterface} |
|
44 | - * |
|
45 | - * @param bool $include_disabled |
|
46 | - * @return Collection<PlaceMapperInterface> |
|
47 | - */ |
|
48 | - public function all(bool $include_disabled = false): Collection |
|
49 | - { |
|
50 | - /** @var Collection<PlaceMapperInterface> $place_mappers */ |
|
51 | - $place_mappers = $this->module_service |
|
52 | - ->findByInterface(ModulePlaceMapperProviderInterface::class, $include_disabled) |
|
53 | - ->flatMap(fn(ModulePlaceMapperProviderInterface $module) => $module->listPlaceMappers()) |
|
54 | - ->map(static function (string $mapper_class): ?PlaceMapperInterface { |
|
55 | - try { |
|
56 | - $mapper = app($mapper_class); |
|
57 | - return $mapper instanceof PlaceMapperInterface ? $mapper : null; |
|
58 | - } catch (BindingResolutionException $ex) { |
|
59 | - return null; |
|
60 | - } |
|
61 | - })->filter(); |
|
40 | + /** |
|
41 | + * Get all place mappers available. |
|
42 | + * |
|
43 | + * {@internal The list is generated based on the modules exposing ModulePlaceMapperProviderInterface} |
|
44 | + * |
|
45 | + * @param bool $include_disabled |
|
46 | + * @return Collection<PlaceMapperInterface> |
|
47 | + */ |
|
48 | + public function all(bool $include_disabled = false): Collection |
|
49 | + { |
|
50 | + /** @var Collection<PlaceMapperInterface> $place_mappers */ |
|
51 | + $place_mappers = $this->module_service |
|
52 | + ->findByInterface(ModulePlaceMapperProviderInterface::class, $include_disabled) |
|
53 | + ->flatMap(fn(ModulePlaceMapperProviderInterface $module) => $module->listPlaceMappers()) |
|
54 | + ->map(static function (string $mapper_class): ?PlaceMapperInterface { |
|
55 | + try { |
|
56 | + $mapper = app($mapper_class); |
|
57 | + return $mapper instanceof PlaceMapperInterface ? $mapper : null; |
|
58 | + } catch (BindingResolutionException $ex) { |
|
59 | + return null; |
|
60 | + } |
|
61 | + })->filter(); |
|
62 | 62 | |
63 | - return $place_mappers; |
|
64 | - } |
|
63 | + return $place_mappers; |
|
64 | + } |
|
65 | 65 | } |
@@ -48,10 +48,10 @@ |
||
48 | 48 | public function all(bool $include_disabled = false): Collection |
49 | 49 | { |
50 | 50 | /** @var Collection<PlaceMapperInterface> $place_mappers */ |
51 | - $place_mappers = $this->module_service |
|
51 | + $place_mappers = $this->module_service |
|
52 | 52 | ->findByInterface(ModulePlaceMapperProviderInterface::class, $include_disabled) |
53 | 53 | ->flatMap(fn(ModulePlaceMapperProviderInterface $module) => $module->listPlaceMappers()) |
54 | - ->map(static function (string $mapper_class): ?PlaceMapperInterface { |
|
54 | + ->map(static function(string $mapper_class): ?PlaceMapperInterface { |
|
55 | 55 | try { |
56 | 56 | $mapper = app($mapper_class); |
57 | 57 | return $mapper instanceof PlaceMapperInterface ? $mapper : null; |
@@ -24,67 +24,67 @@ |
||
24 | 24 | */ |
25 | 25 | trait PlaceMapperTrait |
26 | 26 | { |
27 | - private ?PlaceMapperConfigInterface $config = null; |
|
27 | + private ?PlaceMapperConfigInterface $config = null; |
|
28 | 28 | |
29 | - /** @var array<string, mixed> $data */ |
|
30 | - private array $data = []; |
|
29 | + /** @var array<string, mixed> $data */ |
|
30 | + private array $data = []; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Implementation of PlaceMapperInterface::boot |
|
34 | - * |
|
35 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::boot() |
|
36 | - */ |
|
37 | - public function boot(): void |
|
38 | - { |
|
39 | - } |
|
32 | + /** |
|
33 | + * Implementation of PlaceMapperInterface::boot |
|
34 | + * |
|
35 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::boot() |
|
36 | + */ |
|
37 | + public function boot(): void |
|
38 | + { |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Implementation of PlaceMapperInterface::config |
|
43 | - * |
|
44 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::config() |
|
45 | - * |
|
46 | - * @return PlaceMapperConfigInterface |
|
47 | - */ |
|
48 | - public function config(): PlaceMapperConfigInterface |
|
49 | - { |
|
50 | - return $this->config ?? new NullPlaceMapperConfig(); |
|
51 | - } |
|
41 | + /** |
|
42 | + * Implementation of PlaceMapperInterface::config |
|
43 | + * |
|
44 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::config() |
|
45 | + * |
|
46 | + * @return PlaceMapperConfigInterface |
|
47 | + */ |
|
48 | + public function config(): PlaceMapperConfigInterface |
|
49 | + { |
|
50 | + return $this->config ?? new NullPlaceMapperConfig(); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Implementation of PlaceMapperInterface::setConfig |
|
55 | - * |
|
56 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setConfig() |
|
57 | - * |
|
58 | - * @param PlaceMapperConfigInterface $config |
|
59 | - */ |
|
60 | - public function setConfig(PlaceMapperConfigInterface $config): void |
|
61 | - { |
|
62 | - $this->config = $config; |
|
63 | - } |
|
53 | + /** |
|
54 | + * Implementation of PlaceMapperInterface::setConfig |
|
55 | + * |
|
56 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setConfig() |
|
57 | + * |
|
58 | + * @param PlaceMapperConfigInterface $config |
|
59 | + */ |
|
60 | + public function setConfig(PlaceMapperConfigInterface $config): void |
|
61 | + { |
|
62 | + $this->config = $config; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Implementation of PlaceMapperInterface::data |
|
67 | - * |
|
68 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::data() |
|
69 | - * |
|
70 | - * @param string $key |
|
71 | - * @return NULL|mixed |
|
72 | - */ |
|
73 | - public function data(string $key) |
|
74 | - { |
|
75 | - return $this->data[$key] ?? null; |
|
76 | - } |
|
65 | + /** |
|
66 | + * Implementation of PlaceMapperInterface::data |
|
67 | + * |
|
68 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::data() |
|
69 | + * |
|
70 | + * @param string $key |
|
71 | + * @return NULL|mixed |
|
72 | + */ |
|
73 | + public function data(string $key) |
|
74 | + { |
|
75 | + return $this->data[$key] ?? null; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Implementation of PlaceMapperInterface::setData |
|
80 | - * |
|
81 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setData() |
|
82 | - * |
|
83 | - * @param string $key |
|
84 | - * @param mixed|null $data |
|
85 | - */ |
|
86 | - public function setData(string $key, $data): void |
|
87 | - { |
|
88 | - $this->data[$key] = $data; |
|
89 | - } |
|
78 | + /** |
|
79 | + * Implementation of PlaceMapperInterface::setData |
|
80 | + * |
|
81 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setData() |
|
82 | + * |
|
83 | + * @param string $key |
|
84 | + * @param mixed|null $data |
|
85 | + */ |
|
86 | + public function setData(string $key, $data): void |
|
87 | + { |
|
88 | + $this->data[$key] = $data; |
|
89 | + } |
|
90 | 90 | } |
@@ -23,104 +23,104 @@ |
||
23 | 23 | */ |
24 | 24 | class GeoAnalysisResults |
25 | 25 | { |
26 | - private GeoAnalysisResult $global; |
|
26 | + private GeoAnalysisResult $global; |
|
27 | 27 | |
28 | - /** |
|
29 | - * @var Collection<string, GeoAnalysisResult> $detailed |
|
30 | - */ |
|
31 | - private Collection $detailed; |
|
28 | + /** |
|
29 | + * @var Collection<string, GeoAnalysisResult> $detailed |
|
30 | + */ |
|
31 | + private Collection $detailed; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Constructor for GeoAnalysisResults |
|
35 | - */ |
|
36 | - public function __construct() |
|
37 | - { |
|
38 | - $this->global = new GeoAnalysisResult('Global', 0); |
|
39 | - $this->detailed = new Collection(); |
|
40 | - } |
|
33 | + /** |
|
34 | + * Constructor for GeoAnalysisResults |
|
35 | + */ |
|
36 | + public function __construct() |
|
37 | + { |
|
38 | + $this->global = new GeoAnalysisResult('Global', 0); |
|
39 | + $this->detailed = new Collection(); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Global result of the geographical analysis |
|
44 | - * |
|
45 | - * @return GeoAnalysisResult |
|
46 | - */ |
|
47 | - public function global(): GeoAnalysisResult |
|
48 | - { |
|
49 | - return $this->global; |
|
50 | - } |
|
42 | + /** |
|
43 | + * Global result of the geographical analysis |
|
44 | + * |
|
45 | + * @return GeoAnalysisResult |
|
46 | + */ |
|
47 | + public function global(): GeoAnalysisResult |
|
48 | + { |
|
49 | + return $this->global; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * List of results by category of the geographical analysis |
|
54 | - * |
|
55 | - * @return Collection<string, GeoAnalysisResult> |
|
56 | - */ |
|
57 | - public function detailed(): Collection |
|
58 | - { |
|
59 | - return $this->detailed; |
|
60 | - } |
|
52 | + /** |
|
53 | + * List of results by category of the geographical analysis |
|
54 | + * |
|
55 | + * @return Collection<string, GeoAnalysisResult> |
|
56 | + */ |
|
57 | + public function detailed(): Collection |
|
58 | + { |
|
59 | + return $this->detailed; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * List of results by category of the geographical analysis. |
|
64 | - * The list is sorted first by the category order, then by the category description |
|
65 | - * |
|
66 | - * @return Collection<string, GeoAnalysisResult> |
|
67 | - */ |
|
68 | - public function sortedDetailed(): Collection |
|
69 | - { |
|
70 | - return $this->detailed->sortBy([ |
|
71 | - fn(GeoAnalysisResult $a, GeoAnalysisResult $b): int => $a->order() <=> $b->order(), |
|
72 | - fn(GeoAnalysisResult $a, GeoAnalysisResult $b): int => |
|
73 | - I18N::comparator()($a->description(), $b->description()) |
|
74 | - ]); |
|
75 | - } |
|
62 | + /** |
|
63 | + * List of results by category of the geographical analysis. |
|
64 | + * The list is sorted first by the category order, then by the category description |
|
65 | + * |
|
66 | + * @return Collection<string, GeoAnalysisResult> |
|
67 | + */ |
|
68 | + public function sortedDetailed(): Collection |
|
69 | + { |
|
70 | + return $this->detailed->sortBy([ |
|
71 | + fn(GeoAnalysisResult $a, GeoAnalysisResult $b): int => $a->order() <=> $b->order(), |
|
72 | + fn(GeoAnalysisResult $a, GeoAnalysisResult $b): int => |
|
73 | + I18N::comparator()($a->description(), $b->description()) |
|
74 | + ]); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Add a GeoAnalysis Place to the global result |
|
79 | - * |
|
80 | - * @param GeoAnalysisPlace $place |
|
81 | - */ |
|
82 | - public function addPlace(GeoAnalysisPlace $place): void |
|
83 | - { |
|
84 | - $this->global()->addPlace($place); |
|
85 | - } |
|
77 | + /** |
|
78 | + * Add a GeoAnalysis Place to the global result |
|
79 | + * |
|
80 | + * @param GeoAnalysisPlace $place |
|
81 | + */ |
|
82 | + public function addPlace(GeoAnalysisPlace $place): void |
|
83 | + { |
|
84 | + $this->global()->addPlace($place); |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * Add a new category to the list of results, if it does not exist yet |
|
89 | - * |
|
90 | - * @param string $description |
|
91 | - * @param int $order |
|
92 | - */ |
|
93 | - public function addCategory(string $description, int $order): void |
|
94 | - { |
|
95 | - if (!$this->detailed->has($description)) { |
|
96 | - $this->detailed->put($description, new GeoAnalysisResult($description, $order)); |
|
97 | - } |
|
98 | - } |
|
87 | + /** |
|
88 | + * Add a new category to the list of results, if it does not exist yet |
|
89 | + * |
|
90 | + * @param string $description |
|
91 | + * @param int $order |
|
92 | + */ |
|
93 | + public function addCategory(string $description, int $order): void |
|
94 | + { |
|
95 | + if (!$this->detailed->has($description)) { |
|
96 | + $this->detailed->put($description, new GeoAnalysisResult($description, $order)); |
|
97 | + } |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * Add a GeoAnalysis Place to a category result, if the category exist. |
|
102 | - * |
|
103 | - * @param string $category_name |
|
104 | - * @param GeoAnalysisPlace $place |
|
105 | - */ |
|
106 | - public function addPlaceInCreatedCategory(string $category_name, GeoAnalysisPlace $place): void |
|
107 | - { |
|
108 | - if ($this->detailed->has($category_name)) { |
|
109 | - $this->detailed->get($category_name)->addPlace($place); |
|
110 | - } |
|
111 | - } |
|
100 | + /** |
|
101 | + * Add a GeoAnalysis Place to a category result, if the category exist. |
|
102 | + * |
|
103 | + * @param string $category_name |
|
104 | + * @param GeoAnalysisPlace $place |
|
105 | + */ |
|
106 | + public function addPlaceInCreatedCategory(string $category_name, GeoAnalysisPlace $place): void |
|
107 | + { |
|
108 | + if ($this->detailed->has($category_name)) { |
|
109 | + $this->detailed->get($category_name)->addPlace($place); |
|
110 | + } |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * Add a GeoAnalysis Place to a category result, after creating the category if it does not exist. |
|
115 | - * |
|
116 | - * @param string $category_name |
|
117 | - * @param GeoAnalysisPlace $place |
|
118 | - */ |
|
119 | - public function addPlaceInCategory(string $category_name, int $category_order, GeoAnalysisPlace $place): void |
|
120 | - { |
|
121 | - if (!$this->detailed->has($category_name)) { |
|
122 | - $this->addCategory($category_name, $category_order); |
|
123 | - } |
|
124 | - $this->addPlaceInCreatedCategory($category_name, $place); |
|
125 | - } |
|
113 | + /** |
|
114 | + * Add a GeoAnalysis Place to a category result, after creating the category if it does not exist. |
|
115 | + * |
|
116 | + * @param string $category_name |
|
117 | + * @param GeoAnalysisPlace $place |
|
118 | + */ |
|
119 | + public function addPlaceInCategory(string $category_name, int $category_order, GeoAnalysisPlace $place): void |
|
120 | + { |
|
121 | + if (!$this->detailed->has($category_name)) { |
|
122 | + $this->addCategory($category_name, $category_order); |
|
123 | + } |
|
124 | + $this->addPlaceInCreatedCategory($category_name, $place); |
|
125 | + } |
|
126 | 126 | } |