GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

GeoExtension   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 4
Bugs 1 Features 2
Metric Value
wmc 7
eloc 13
c 4
b 1
f 2
dl 0
loc 62
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 7 1
A getCountryCode() 0 3 1
A __construct() 0 4 1
A getCityName() 0 3 1
A getName() 0 3 1
A getContinentCode() 0 3 1
A getPostalCode() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusGeoPlugin\Twig;
6
7
use Odiseo\SyliusGeoPlugin\Helper\IpGeolocalizationHelperInterface;
8
use Twig\Extension\AbstractExtension;
9
use Twig\TwigFunction;
10
11
final class GeoExtension extends AbstractExtension
12
{
13
    /** @var IpGeolocalizationHelperInterface */
14
    private $ipGeolocalizationHelper;
15
16
    public function __construct(
17
        IpGeolocalizationHelperInterface $ipGeolocalizationHelper
18
    ) {
19
        $this->ipGeolocalizationHelper = $ipGeolocalizationHelper;
20
    }
21
22
    /**
23
     * @return array|TwigFunction[]
24
     */
25
    public function getFunctions(): array
26
    {
27
        return [
28
            new TwigFunction('geo_continent_code', [$this, 'getContinentCode']),
29
            new TwigFunction('geo_country_code', [$this, 'getCountryCode']),
30
            new TwigFunction('geo_city_name', [$this, 'getCityName']),
31
            new TwigFunction('geo_postal_code', [$this, 'getPostalCode'])
32
        ];
33
    }
34
35
    /**
36
     * @return string|null
37
     */
38
    public function getContinentCode(): ?string
39
    {
40
        return $this->ipGeolocalizationHelper->getContinentCode();
41
    }
42
43
    /**
44
     * @return string|null
45
     */
46
    public function getCountryCode(): ?string
47
    {
48
        return $this->ipGeolocalizationHelper->getCountryCode();
49
    }
50
51
    /**
52
     * @return string|null
53
     */
54
    public function getCityName(): ?string
55
    {
56
        return $this->ipGeolocalizationHelper->getCityName();
57
    }
58
59
    /**
60
     * @return string|null
61
     */
62
    public function getPostalCode(): ?string
63
    {
64
        return $this->ipGeolocalizationHelper->getPostalCode();
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getName(): string
71
    {
72
        return 'geo';
73
    }
74
}
75