Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1433c17

Browse files
authored
Create interface for Query (#741)
* Create interface for Query * Applied changes from StyleCI * Removed return type
1 parent 12b3dd3 commit 1433c17

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

src/Common/Query/GeocodeQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* @author Tobias Nyholm <[email protected]>
2121
*/
22-
final class GeocodeQuery
22+
final class GeocodeQuery implements Query
2323
{
2424
/**
2525
* The address or text that should be geocoded.

src/Common/Query/Query.php

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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\Query;
14+
15+
/**
16+
* @author Tobias Nyholm <[email protected]>
17+
*/
18+
interface Query
19+
{
20+
/**
21+
* @param string $locale
22+
*
23+
* @return Query
24+
*/
25+
public function withLocale(string $locale);
26+
27+
/**
28+
* @param int $limit
29+
*
30+
* @return Query
31+
*/
32+
public function withLimit(int $limit);
33+
34+
/**
35+
* @param string $name
36+
* @param mixed $value
37+
*
38+
* @return Query
39+
*/
40+
public function withData(string $name, $value);
41+
42+
/**
43+
* @return string|null
44+
*/
45+
public function getLocale();
46+
47+
/**
48+
* @return int
49+
*/
50+
public function getLimit(): int;
51+
52+
/**
53+
* @param string $name
54+
* @param mixed|null $default
55+
*
56+
* @return mixed
57+
*/
58+
public function getData(string $name, $default = null);
59+
60+
/**
61+
* @return array
62+
*/
63+
public function getAllData(): array;
64+
65+
/**
66+
* @return string
67+
*/
68+
public function __toString();
69+
}

src/Common/Query/ReverseQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* @author Tobias Nyholm <[email protected]>
2020
*/
21-
final class ReverseQuery
21+
final class ReverseQuery implements Query
2222
{
2323
/**
2424
* @var Coordinates

0 commit comments

Comments
 (0)