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

BoundsPlugin::handleQuery()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 3
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\Model\Bounds;
16
use Geocoder\Plugin\Plugin;
17
use Geocoder\Query\GeocodeQuery;
18
use Geocoder\Query\Query;
19
20
/**
21
 * Add bounds to each GeocoderQuery
22
 *
23
 * @author Tobias Nyholm <[email protected]>
24
 */
25
class BoundsPlugin implements Plugin
26
{
27
    /**
28
     * @var Bounds
29
     */
30
    private $bounds;
31
32
    /**
33
     * @param Bounds $bounds
34
     */
35
    public function __construct(Bounds $bounds)
36
    {
37
        $this->bounds = $bounds;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function handleQuery(Query $query, callable $next, callable $first)
44
    {
45
        if (!$query instanceof GeocodeQuery) {
46
            return $next($query);
47
        }
48
49
        if (empty($query->getBounds())) {
50
            $query = $query->withBounds($this->bounds);
51
        }
52
53
        return $next($query);
54
    }
55
}
56