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 ( b0e03a...4af0c2 )
by Tobias
02:50
created

LocalePlugin::__construct()   A

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
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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\Plugin\Plugin;
14
15
use Geocoder\Plugin\Plugin;
16
use Geocoder\Query\Query;
17
18
/**
19
 * Add locale on the query
20
 *
21
 * @author Tobias Nyholm <[email protected]>
22
 */
23
class LocalePlugin implements Plugin
24
{
25
    /**
26
     * @var string
27
     */
28
    private $locale;
29
30
    /**
31
     * @param string $locale
32
     */
33
    public function __construct(string $locale)
34
    {
35
        $this->locale = $locale;
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function handleQuery(Query $query, callable $next, callable $first)
42
    {
43
        if (empty($query->getLocale())) {
44
            $query = $query->withLocale($this->locale);
45
        }
46
47
        return $next($query);
48
    }
49
}
50