|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* webtrees-lib: MyArtJaub library for webtrees |
|
4
|
|
|
* |
|
5
|
|
|
* @package MyArtJaub\Webtrees |
|
6
|
|
|
* @subpackage GeoDispersion |
|
7
|
|
|
* @author Jonathan Jaubart <[email protected]> |
|
8
|
|
|
* @copyright Copyright (c) 2021, Jonathan Jaubart |
|
9
|
|
|
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace MyArtJaub\Webtrees\Common\GeoDispersion\Config; |
|
15
|
|
|
|
|
16
|
|
|
use MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface; |
|
17
|
|
|
use MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperConfigInterface; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Generic implementation of the MapViewConfigInterface |
|
21
|
|
|
* |
|
22
|
|
|
*/ |
|
23
|
|
|
class MapViewConfig implements MapViewConfigInterface |
|
24
|
|
|
{ |
|
25
|
|
|
private string $map_mapping_property; |
|
26
|
|
|
private PlaceMapperConfigInterface $mapper_config; |
|
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
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* {@inheritDoc} |
|
44
|
|
|
* @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapMappingProperty() |
|
45
|
|
|
*/ |
|
46
|
|
|
function mapMappingProperty(): string |
|
|
|
|
|
|
47
|
|
|
{ |
|
48
|
|
|
return $this->map_mapping_property; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* {@inheritDoc} |
|
53
|
|
|
* @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\MapViewConfigInterface::mapperConfig() |
|
54
|
|
|
*/ |
|
55
|
|
|
function mapperConfig(): PlaceMapperConfigInterface |
|
|
|
|
|
|
56
|
|
|
{ |
|
57
|
|
|
return $this->mapper_config; |
|
58
|
|
|
} |
|
59
|
|
|
} |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.