Test Failed
Push — master ( 628e98...a0d58b )
by Pieter
03:08
created

Search::accuracy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace PeeHaa\AsyncTwitter\Api\Request\Geo;
4
5
use PeeHaa\AsyncTwitter\Api\Request\BaseRequest;
6
7
class Search extends BaseRequest
8
{
9
    const METHOD   = 'GET';
10
    const ENDPOINT = '/geo/search.json';
11
12
    public function __construct()
13
    {
14
        parent::__construct(self::METHOD, self::ENDPOINT);
15
    }
16
17
    public function latitude(string $latitude): Search
18
    {
19
        $this->parameters['lat'] = $latitude;
20
21
        return $this;
22
    }
23
24
    public function longitude(string $longitude): Search
25
    {
26
        $this->parameters['long'] = $longitude;
27
28
        return $this;
29
    }
30
31
    public function query(string $query): Search
32
    {
33
        $this->parameters['query'] = $query;
34
35
        return $this;
36
    }
37
38
    public function ip(string $ip): Search
39
    {
40
        $this->parameters['ip'] = $ip;
41
42
        return $this;
43
    }
44
45 View Code Duplication
    public function granularity(string $granularity): Search
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
    {
47
        if (!in_array($granularity, ['poi', 'neighborhood', 'city', 'admin', 'county'], true)) {
48
            throw new InvalidGranularityException();
49
        }
50
51
        $this->parameters['granularity'] = $granularity;
52
53
        return $this;
54
    }
55
56
    public function accuracy(string $accuracy): Search
57
    {
58
        $this->parameters['accuracy'] = $accuracy;
59
60
        return $this;
61
    }
62
63
    public function amount(int $amount): Search
64
    {
65
        $this->parameters['max_results'] = (string) $amount;
66
67
        return $this;
68
    }
69
70
    public function containedWithin(string $placeId): Search
71
    {
72
        $this->parameters['contained_within'] = $placeId;
73
74
        return $this;
75
    }
76
77
    public function streetAddress(string $address): Search
78
    {
79
        $this->parameters['attribute:street_address'] = $address;
80
81
        return $this;
82
    }
83
84
    public function callback(string $callback): Search
85
    {
86
        $this->parameters['callback'] = $callback;
87
88
        return $this;
89
    }
90
}
91