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.

Country::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Geocoder package.
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license    MIT License
11
 */
12
13
namespace Geocoder\Model;
14
15
use Geocoder\Exception\InvalidArgument;
16
17
/**
18
 * A Country has either a name or a code. A Country will never be without data.
19
 *
20
 * @author William Durand <[email protected]>
21
 */
22
final class Country
23
{
24
    /**
25
     * @var string|null
26
     */
27
    private $name;
28
29
    /**
30
     * @var string|null
31
     */
32
    private $code;
33
34
    /**
35
     * @param string $name
0 ignored issues
show
Documentation introduced by
Should the type for parameter $name not be null|string?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
36
     * @param string $code
0 ignored issues
show
Documentation introduced by
Should the type for parameter $code not be null|string?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
37
     */
38
    public function __construct(string $name = null, string $code = null)
39
    {
40
        if (null === $name && null === $code) {
41
            throw new InvalidArgument('A country must have either a name or a code');
42
        }
43
44
        $this->name = $name;
45
        $this->code = $code;
46
    }
47
48
    /**
49
     * Returns the country name.
50
     *
51
     * @return string|null
52
     */
53
    public function getName()
54
    {
55
        return $this->name;
56
    }
57
58
    /**
59
     * Returns the country ISO code.
60
     *
61
     * @return string|null
62
     */
63
    public function getCode()
64
    {
65
        return $this->code;
66
    }
67
68
    /**
69
     * Returns a string with the country name.
70
     *
71
     * @return string
72
     */
73
    public function __toString(): string
74
    {
75
        return $this->getName() ?: '';
76
    }
77
}
78