Completed
Pull Request — master (#1)
by Arthur
02:19
created

TextSearchHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 26
wmc 3
lcom 1
cbo 6
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 18 3
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 TextSearchHandler extends AbstractHandler
9
{
10
    /**
11
     * @param TextSearchQuery $query
12
     *
13
     * @return PlaceCollection
14
     */
15
    public function handle(TextSearchQuery $query)
16
    {
17
        $location = $query->getLocation();
18
19
        $params = [
20
            'query' => $query->getQuery()->getQuery(),
21
        ];
22
23
        if (null !== $location) {
24
            $params['location'] = $location->getLatitude().','.$location->getLongitude();
25
        }
26
27
        if (null !== $query->getRadius()) {
28
            $params['radius'] = $query->getRadius()->getRadius();
29
        }
30
31
        return $this->client->textsearch($params);
32
    }
33
}
34