Passed
Branch feature/2.1-geodispersion-dev (1d61a8)
by Jonathan
61:21
created

MapViewConfig   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 35
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A mapperConfig() 0 3 1
A mapMappingProperty() 0 3 1
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
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
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
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
56
    {
57
        return $this->mapper_config;
58
    }
59
}