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.
Completed
Pull Request — master (#90)
by Ross
16:07
created

LocaleIdentifierFakerDataProvider::isValid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.0625
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\FakerData\String;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\FakerData\AbstractFakerDataProvider;
6
use Faker\Generator;
7
use Symfony\Component\Intl\Intl;
8
9
class LocaleIdentifierFakerDataProvider extends AbstractFakerDataProvider
10
{
11
12
    /**
13
     * @var string[]
14
     */
15
    private static $locales;
16
17
    /**
18
     * LocaleIdentifierFakerDataProvider constructor.
19
     *
20
     * @param Generator $generator
21
     * @SuppressWarnings(PHPMD.StaticAccess)
22
     */
23 2
    public function __construct(Generator $generator)
24
    {
25 2
        parent::__construct($generator);
26 2
        if (null === self::$locales) {
0 ignored issues
show
introduced by
The condition self::locales is always false. If self::locales can have other possible types, add them to src/Entity/Fields/FakerD...erFakerDataProvider.php:13
Loading history...
27 1
            self::$locales = Intl::getLocaleBundle()->getLocaleNames();
28
        }
29 2
    }
30
31 2
    public function __invoke(): string
32
    {
33
        do {
34 2
            $value = $this->generator->locale;
35 2
        } while (false === $this->isValid($value));
36
37 2
        return $value;
38
    }
39
40 2
    private function isValid(string $value): bool
0 ignored issues
show
Unused Code introduced by
The method isValid() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
41
    {
42 2
        if (!isset(self::$locales[$value])) {
43
            return false;
44
        }
45
46 2
        return true;
47
    }
48
}
49