NearbySearchHandler   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 5
Bugs 1 Features 2
Metric Value
wmc 5
c 5
b 1
f 2
lcom 1
cbo 5
dl 0
loc 33
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B handle() 0 25 5
1
<?php
2
3
namespace Arthem\GoogleApi\Domain\Place\Query\Search;
4
5
use Arthem\GoogleApi\Domain\Place\Query\AbstractHandler;
6
use Arthem\GoogleApi\Domain\Place\VO\PlaceCollection;
7
8
class NearbySearchHandler extends AbstractHandler
9
{
10
    /**
11
     * @param NearbySearchQuery $query
12
     *
13
     * @return PlaceCollection
14
     */
15
    public function handle(NearbySearchQuery $query)
16
    {
17
        $location = $query->getLocation();
18
        $params = [
19
            'location' => $location->getLatitude().','.$location->getLongitude(),
20
        ];
21
22
        if (null !== $query->getName()) {
23
            $params['name'] = $query->getName();
24
        }
25
26
        if (null !== $query->getRadius()) {
27
            $params['radius'] = $query->getRadius()->getRadius();
28
        }
29
30
        if (null !== $rankBy = $query->getRankBy()) {
31
            $params['rankby'] = $rankBy;
32
        }
33
34
        if (null !== $types = $query->getTypes()) {
35
            $params['types'] = implode('|', $types);
36
        }
37
38
        return $this->client->nearbysearch($params);
39
    }
40
}
41