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

SimplePlaceMapper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 3 1
1
<?php
2
3
/**
4
 * webtrees-lib: MyArtJaub library for webtrees
5
 *
6
 * @package MyArtJaub\Webtrees
7
 * @subpackage GeoDispersion
8
 * @author Jonathan Jaubart <[email protected]>
9
 * @copyright Copyright (c) 2021, Jonathan Jaubart
10
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
 */
12
13
declare(strict_types=1);
14
15
namespace MyArtJaub\Webtrees\Module\GeoDispersion\PlaceMappers;
16
17
use Fisharebest\Webtrees\Place;
18
use MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface;
19
20
/**
21
 * Simple Place Mapper, returning the lowest level place name.
22
 * Depending on the map, can be a very quick mapper, but no handling of duplicates or place name changes.
23
 */
24
class SimplePlaceMapper implements PlaceMapperInterface
25
{
26
    use PlaceMapperTrait;
27
28
    /**
29
     * {@inheritDoc}
30
     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::map()
31
     */
32
    public function map(Place $place, string $feature_property): ?string
33
    {
34
        return $place->firstParts(1)->first();
35
    }
36
}
37