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
Push — master ( dfe346...d1ee0e )
by joseph
15s queued 11s
created

LocaleIdentifierFakerData::__invoke()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.1481

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 4
cts 6
cp 0.6667
crap 2.1481
rs 10
c 0
b 0
f 0
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 LocaleIdentifierFakerData 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 null === self::locales is always false.
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 1
            return false;
44
        }
45
46 2
        return true;
47
    }
48
}
49