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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handleQuery() 0 12 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